bg!3 dZddlmZddlmZddlmZmZddlm Z erddlm Z m Z m Z m Z ddlmZdZGd d eZGd d eZGd deZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGdd eZGd!d"eZGd#d$eZGd%d&eZ Gd'd(eZ!Gd)d*eZ"Gd+d,eZ#Gd-d.eZ$Gd/d0eZ%Gd1d2eZ&Gd3d4e&Z'e j(Z)e j*Z+e j,Z-eZ.eZ/eZ0eZ1d5S)6zr;r:rrfsJJJJr;rc,eZdZdZ ddfd ZxZS)r%zException class which is raised when a relative import was beyond the top-level. Standard attributes: level: The level which was attempted. name: the name of the module on which the relative import was attempted. BRelative import with too many levels ({level}) for module {name!r}Nr+r,level int | NonenamerNr-rr.r/c X||_||_tj|fi|dSr1)r\r^r2r3)r6r+r\r^r-r9s r:r3zTooManyLevelsError.__init__rs8  ((C(((((r;)r[NN) r+r,r\r]r^rNr-rr.r/rWrJs@r:r%r%jsW(  ) ) ) ) ) ) ) ) ) ) )r;r%c(eZdZdZ ddfd ZxZS)rz3Exception class used when a module can't be parsed.Nr+r,rMrNrO ExceptionrRrQr.r/cRt|||||dSr1)r2r3)r6r+rMrOrRrQr9s r:r3zAstroidSyntaxError.__init__s+ '5&$?????r;r1) r+r,rMrNrOrarRrNrQrNr.r/rWrJs@r:rrsX==" @@@@@@@@@@@r;rc,eZdZdZ ddfd ZxZS)rzRaised by function's `default_value` method when an argument has no default value. Standard attributes: func: Function node. name: Name of argument without a default. %{func!r} has no default for {name!r}.Nr+r,funcnodes.FunctionDef | Noner^rNr-rr.r/c X||_||_tj|fi|dSr1)rer^r2r3)r6r+rer^r-r9s r:r3zNoDefault.__init__s8  ((C(((((r;)rdNN) r+r,rerfr^rNr-rr.r/rWrJs@r:rrsW?)- ) ) ) ) ) ) ) ) ) ) )r;rc(eZdZdZ d dfd ZxZS)r!zBase class of astroid resolution/inference error. ResolveError is not intended to be raised. Standard attributes: context: InferenceContext object. r*Nr+r,contextInferenceContext | Noner-rr.r/c J||_tj|fi|dSr1)rir2r3)r6r+rir-r9s r:r3zResolveError.__init__s1 ((C(((((r;)r*N)r+r,rirjr-rr.r/rWrJs@r:r!r!sSEI)))))))))))r;r!c0eZdZdZ ddfd ZddZxZS)ra Error raised when there is a problem with method resolution of a class. Standard attributes: mros: A sequence of sequences containing ClassDef nodes. cls: ClassDef node whose MRO resolution failed. context: InferenceContext object. Nr+r,mroslist[nodes.ClassDef]rSnodes.ClassDefrirjr-rr.r/c f||_||_||_tj|fi|dSr1)rmrSrir2r3)r6r+rmrSrir-r9s r:r3zMroError.__init__s?  ((C(((((r;cdd|jD}|j||jS)N, c3\K|]'}ddd|DdV(dS)(rrc3$K|] }|jV dSr1)r^).0bs r: z-MroError.__str__...s$+>+>qAF+>+>+>+>+>+>r;)N)join)rvms r:rxz#MroError.__str__..sIUUaA$))+>+>A+>+>+>">">AAAUUUUUUr;)rmrS)rzrmr+r?rS)r6 mro_namess r:rBzMroError.__str__sAIIUU49UUUUU |"" tx"@@@r;r1) r+r,rmrnrSrorirjr-rr.r/rCrDrJs@r:rrsm,0 ) ) ) ) ) ) )AAAAAAAAr;rceZdZdZdS)rzDError raised when there are duplicate bases in the same class bases.NrYr>r;r:rrsNNNNr;rceZdZdZdS)rz0Error raised when a class's MRO is inconsistent.NrYr>r;r:rrs::::r;rc,eZdZdZd fd Zd d ZxZS)r$zError raised when there is a problem with a *super* call. Standard attributes: *super_*: The Super instance that raised the exception. context: InferenceContext object. r+r,super_ objects.Superr-rr.r/c J||_tj|fi|dSr1)rr2r3)r6r+rr-r9s r:r3zSuperError.__init__s/ ((C(((((r;cJ|jjdit|jSr=)r+r?r@rrAs r:rBzSuperError.__str__s'"t|"77T$+%6%6777r;)r+r,rrr-rr.r/rCrDrJs@r:r$r$s[))))))88888888r;r$cJeZdZdZ d(d)fd' ZxZS)*rzRaised when we are unable to infer a node. Standard attributes: node: The node inference was called on. context: InferenceContext object. Inference failed for {node!r}.Nr+r,node$nodes.NodeNG | bases.Instance | Nonerirjtargettargetsnodes.Tuple | None attributerNunknown assign_pathlist[int] | Nonecallernodes.Call | Nonestmts.Sequence[nodes.NodeNG | bases.Instance] | Noneframenodes.LocalsDictNodeNG | None call_sitearguments.CallSite | Nonererfargpositional_arguments list | None unpacked_argskeyword_arguments dict | Noneunpacked_kwargsr-rr.r/c *||_||_||_||_||_||_||_| |_| |_| |_ | |_ | |_ ||_ ||_ ||_||_||_t#j|fi|dSr1)rrirrrrrrrrrrerrrrrr2r3)r6r+rrirrrrrrrrrrerrrrrr-r9s r:r3zInferenceError.__init__s,    " &   " $8!*!2.((C(((((r;)rNNNNNNNNNNNNNNNNN)(r+r,rrrirjrrrrrrNrrrrrrrrrrrrrerfrrNrrrrrrrrr-rr.r/rWrJs@r:rrs859+/7;&* $8<(,$(@D/3/3)-,0%))-'+'')')')')')')')')')')')r;rc.eZdZdZ ddfd ZxZS)ra Raised when a name lookup fails, corresponds to NameError. Standard attributes: name: The name for which lookup failed, as a string. scope: The node representing the scope in which the lookup occurred. context: InferenceContext object. {name!r} not found in {scope!r}.Nr+r,r^rNscoperrirjr-rr.r/c f||_||_||_tj|fi|dSr1)r^rrir2r3)r6r+r^rrir-r9s r:r3zNameInferenceError.__init__"?   ((C(((((r;)rNNN) r+r,r^rNrrrirjr-rr.r/rWrJs@r:rrsZ:/3+/ ) ) ) ) ) ) ) ) ) ) )r;rc4eZdZdZ ddfd ZxZS)raRaised when an attribute lookup fails, corresponds to AttributeError. Standard attributes: target: The node for which lookup failed. attribute: The attribute for which lookup failed, as a string. context: InferenceContext object. &{attribute!r} not found on {target!r}.r*Nr+r,rrrrirjrmlist[nodes.ClassDef] | Nonernodes.ClassDef | NonerSr-rr.r/c ||_||_||_||_||_||_t j|fi|dSr1)rrrirmrrSr2r3) r6r+rrrirmrrSr-r9s r:r3z AttributeInferenceError.__init__9sT#    ((C(((((r;)rr*NNNNN)r+r,rr,rrrirjrmrrrrSrr-rr.r/rWrJs@r:rr0sd@7;+/,0(,%))))))))))))r;rceZdZdZdS)r(zyException to be raised in custom inference function to indicate that it should go back to the default behaviour. NrYr>r;r:r(r(Mr;r(ceZdZdZdS)_NonDeducibleTypeHierarchyz[Raised when is_subtype / is_supertype can't deduce the relation between two types. NrYr>r;r:rrSrr;rc.eZdZdZ ddfd ZxZS)rz@Raised when an Indexable / Mapping does not have an index / key.r*Nr+r,rrindexnodes.Subscript | Nonerirjr-rr.r/c f||_||_||_tj|fi|dSr1rrrir2r3r6r+rrrir-r9s r:r3zAstroidIndexError.__init__\rr;r*NNN r+r,rrrrrirjr-rr.r/rWrJs@r:rrYsVJJ59(,+/ ) ) ) ) ) ) ) ) ) ) )r;rc.eZdZdZ ddfd ZxZS)rz9Raised when a TypeError would be expected in Python code.r*Nr+r,rrrrrirjr-rr.r/c f||_||_||_tj|fi|dSr1rrs r:r3zAstroidTypeError.__init__mrr;rrrWrJs@r:rrjsVCC59(,+/ ) ) ) ) ) ) ) ) ) ) )r;rceZdZdZdS)rz:Raised when a ValueError would be expected in Python code.NrYr>r;r:rr{sDDDDr;rceZdZdZdS)rzYRaised when an inference tip is overwritten. Currently only used for debugging. NrYr>r;r:rrsr;rc$eZdZdZdfd ZxZS)r zRaised when a node which is expected to have a parent attribute is missing one. Standard attributes: target: The node for which the parent lookup failed. r nodes.NodeNGr.r/cb||_td|ddS)NzParent not found on .r+)rr2r3r6rr9s r:r3zParentMissingError.__init__s7  !C!C!C!CDDDDDr;rrr.r/rWrJs@r:r r sQ EEEEEEEEEEr;r c$eZdZdZdfd ZxZS)r"aRaised when a call to node.statement() does not return a node. This is because a node in the chain does not have a parent attribute and therefore does not return a node for statement(). Standard attributes: target: The node for which the parent lookup failed. rrr.r/c`tt|d|dS)NzStatement not found on r)r2r r3rs r:r3zStatementMissing.__init__s@  $''008f88 1     r;rrWrJs@r:r"r"sG          r;r"N)2rH __future__rcollections.abcrtypingrrastroidrrr r r astroid.contextr __all__rarr rr%rrr!rrrr$rrrr(rrrrrr r"BadOperationMessagerBadUnaryOperationMessager&BadBinaryOperationMessagerr#r'rrr>r;r:rs CB""""""$$$$$$%%%%%%%%1888888888888000000 @1111191110)))))<)))8KKKKK-KKK)))))+)))* @ @ @ @ @- @ @ @))))) )))* ) ) ) ) )< ) ) ) AAAAA|AAA6OOOOO(OOO;;;;;8;;; 8 8 8 8 8 8 8 8 /)/)/)/)/)\/)/)/)h)))))))).)))))l))):)  ))))) )))")))))|)))"EEEEE EEEl E E E E E E E E      )    ")35#%' /r;