bg5 dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZddlmZmZddlmZddlmZmZmZmZddlZddlZdd lmZmZmZdd lmZdd l m!Z!dd l"m#Z#dd l$m%Z%m&Z&er ddlm'Z'ddl(m)Z)edej*Z+eddZ,ee,e+gdfZ-ej.ej/ej0ej1fZ2dZ3ddhZ4hdZ5e6hdZ7e6hdZ8dZ9dZ:dZ;dZd Z?d!Z@d"ZAd#d$d%d&d'd(d)d*ZBd+eBCDZDeEeDZFe6d,ZGhd-ZHe6hd.ZIGd/d0eJZKGd1d2eJZLd&d7ZMd'd9ZNd&d:ZOd(d<ZPejQRZd=ZSd&d>ZTd)dAZUd*dEZVd+dGZWd,dIZXd-d.dJZYd&dKZZd/dNZ[d&dOZ\d0dPZ]d1dRZ^d2dUZ_d2dVZ`GdWdXeJZaGdYdZeJZbd3d]Zcd4d_Zdd5daZed6dcZfd7deZgd8dgZhd9djZid:dlZj d;ddzZmd(d{Znd?d}Zod&d~Zpd&dZqd&dZrd@dZsdAdZtdBdZued d-dCdZvdDdZwdDdZxd&dZydEdZzeJfdFdZ{dGdZ|eJfdHdZ}eJfdIdZ~dJdZeJfdKdZdLdZdMdZd&dZdNdZdNdZdNdZdNdZdNdZdNdZdNdZd)dZd&dZdOdZdPdQdZdNdZdNdZdRdZdSdZdSdZdTdZed d-dddUdĄZedŬ d-dVdDŽZ d-dWdɄZd&dʄZdXd̄Zd(d̈́ZdYdτZd(dЄZdZd҄Zd&dӄZd[dԄZd&dՄZd\d؄Zedd&dلZd]dۄZd^d܄Z d-d_d݄ZdLdބZd`dZdLdZdadZdbdZdcdZdddZdedZdedZd&dZd&dZdfdZdfdZd(dZdgdZdgdZdgdZd&dZd&dZdhdZdidZd&dZdjdZedkdZdld ZdmdZd&dZdndZdodZdpdZÐd&dZĐdqdZŐdrdZƐdsdZǐdtd ZȐdud#Zɐdvd%ZdS(wz7Some functions that may be useful for various checkers.) annotationsN)deque)IterableIterator) lru_cachepartial)Match) TYPE_CHECKINGAnyCallableTypeVar)TooManyLevelsErrornodesutil)InferenceContext) AstroidError) ImportNode)InferenceResultSuccessfulInferenceResult)_lru_cache_wrapper) BaseChecker_NodeT)bound _CheckerTrbuiltinsabc_py_abc>abc.abstractmethodabc.abstractpropertyabc.abstractclassmethodabc.abstractstaticmethod> .Protocoltyping.Protocoltyping_extensions.Protocol>*&+^|__iter__ __aiter____next__ __getitem____class_getitem__ __setitem__ __delitem__ __contains__keys)__new____init____call____init_subclass__)$__del____repr____str__ __bytes____hash____bool____dir____len____length_hint__r* __reversed____neg____pos____abs__ __invert__ __complex____int__ __float__ __index__ __trunc__ __floor____ceil__ __enter__ __aenter____getnewargs_ex____getnewargs__ __getstate__ __reduce____copy__ __unicode__ __nonzero__ __await__r+ __anext__ __fspath____subclasses__)> __format____lt____le____eq____ne____gt____ge__ __getattr____getattribute__ __delattr__ __delete____instancecheck____subclasscheck__r- __missing__r0r1__add____sub____mul__ __truediv__ __floordiv__ __rfloordiv____mod__ __divmod__ __lshift__ __rshift____and____xor____or____radd____rsub____rmul__ __rtruediv____rmod__ __rdivmod____rpow__ __rlshift__ __rrshift____rand____rxor____ror____iadd____isub____imul__ __itruediv__ __ifloordiv____imod__ __ilshift__ __irshift____iand____ixor____ior____ipow__ __setstate__ __reduce_ex__ __deepcopy____cmp__ __matmul__ __rmatmul__ __imatmul____div__) __setattr____get____set__r/ __set_name__)__exit__ __aexit__) __round__)__pow__)Nr)rr)rrc$i|] \}}|D]}||Sr).0paramsmethodsnames f/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pylint/checkers/utils.py rsE  &)&zbuiltins.tuplez builtins.listz builtins.dictz builtins.setzbuiltins.frozensetz builtins.typezcollections.dequezcollections.defaultdictzcollections.OrderedDictzcollections.Counterzcollections.ChainMapz_collections_abc.Awaitablez_collections_abc.Coroutinez_collections_abc.AsyncIterablez_collections_abc.AsyncIteratorz_collections_abc.AsyncGeneratorz_collections_abc.Iterablez_collections_abc.Iteratorz_collections_abc.Generatorz_collections_abc.Reversiblez_collections_abc.Containerz_collections_abc.Collectionz_collections_abc.Callablez_collections_abc.Setz_collections_abc.MutableSetz_collections_abc.Mappingz_collections_abc.MutableMappingz_collections_abc.Sequencez _collections_abc.MutableSequencez_collections_abc.ByteStringz_collections_abc.MappingViewz_collections_abc.KeysViewz_collections_abc.ItemsViewz_collections_abc.ValuesViewz!contextlib.AbstractContextManagerz&contextlib.AbstractAsyncContextManagerz re.Patternzre.Match>FNT>nt._exitsys.exit posix._exit_sitebuiltins.QuitterceZdZdS)NoSuchArgumentErrorN__name__ __module__ __qualname__rrrrrDrrceZdZdS)InferredTypeErrorNrrrrrrrrrnode nodes.NodeNGreturnboolctjdtdtd|DS)z1Return whether the given node is inside a lambda.zutils.is_inside_lambda will be removed in favour of calling utils.get_node_first_ancestor_of_type(x, nodes.Lambda) in pylint 3.0r stacklevelc3JK|]}t|tjVdSN) isinstancerLambda)rparents r z#is_inside_lambda..s.TTFz&%,//TTTTTTr)warningswarnDeprecationWarninganynode_ancestorsrs ris_inside_lambdarsR M O  TTd>Q>Q>S>STTT T TTrIterable[nodes.NodeNG]c#Kt|tjtjfr!|jD]}t |Ed{VdS|VdS)z9Recursively returns all atoms in nested lists and tuples.N)rrTupleListeltsget_all_elements)rchilds rrrsp$ej122Y / /E'.. . . . . . . . . / / rcnt|dddkr|jdkrdSdS)zDReturn True if the node is referencing the "super" builtin function.rNsuperrTF)getattrrootrrs ris_superrs8tVT""g--$))++2Bj2P2Pt 5rnodes.FunctionDefc|t|jdko$t|jdtjS)z@Return true if the given function node only raises an exception.rr)lenbodyrrRaisers ris_errorrs, ty>>Q  H:dilEK#H#HHr) __builtins__c@|o|jdkS)zHReturns True if the given node is an object from the __builtin__ module.r)rrrs ris_builtin_objectr"s  2DIIKK$ 22rrstrc&|tvp|tvS)zIReturn true if could be considered as a builtin defined by python.)rSPECIAL_BUILTINS)rs r is_builtinr's 8  7t'777rvar_nodevarnamescopec(t|||duSr)defnode_in_scope)rrrs ris_defined_in_scoper,s Hgu 5 5T AArnodes.NodeNG | Nonect|tjr|jD]x}t|tjr ||jvr|cSt|tjr5|jD]-}t|tjr|j |kr|ccS.ynt|ttj fr3| tjD]}|j |kr|cSnvt|tj rQ|jD]G\}}||rn,|r)t|tjr|j |kr|cSHn t|tjtjfr|j|rf|j|rJ |j||j}t-|||}|S#t.j$rYnwxYw|St3|dd|kr|SnMt|tjr3t|j tjr|j }|j |kr|SdS)Nr)rrIfrNonlocalnamesAssigntargets AssignNamerCOMP_NODE_TYPESFornodes_of_classWithitems parent_ofr FunctionDefargs is_argument default_valuerrastroid NoDefaultr ExceptHandler) rrrrtargetass_nodeexpridsdefnodes rrr5s %""' J & &D$// Gtz4I4I $ -- &"l&&F!&%*:;;& w@V@V%  & EOUY7 8 8 ,,U-=>>  H}''(  E5: & &   ID#~~h''  z#u'788 SX=P=P EEL%*;< = = : ! !' * * z##H-- ##J,,W555!LE.x%HHG#N(DL 5&$ ' '7 2 2L 3 E5. / / ej%"2 3 3 zH}'' 4s72G++G=<G= nodes.Namec H|j}|D]1}t|||}||}t |t t jfzrRt |t jr5|}||urt |t jrdSdS|j |j krdS|D]i}|j |j krt |t j t j t j t j t jt jfrdSj3|d}|}|j} |r|j| kr|t jD]} | j|krdS|t jt jfD]} |d| jDvrdS|}|r |j| kdS)aRCheck if the given variable node is defined before. Verify that the variable node is defined by a parent node (e.g. if or with) earlier than `var_node`, or is defined by a (list, set, dict, or generator comprehension, lambda) or in a previous sibling node on the same line (statement_defining ; statement_using). NFTfuturec.g|]}|dp|dS)rrr)rrs r z%is_defined_before..s%III$47-d1gIIIr)rrrrrrrrrlinenorWhiler TryExcept TryFinallyr statementprevious_sibling fromlinenorr ImportFromImportr) rrrr defnode_scopevar_node_scope defnode_ancstmt_noder assign_nodeimp_nodes ris_defined_beforeresPmG))++  "8Wf== ?   m_ %F G G -):;; !!)!1!1!66:"E$5<<6!5544 >HO + +44"1133  K!X_44IKJO$'    ttt     T  * *D  ! ! # #E _F )E$.. //0@AA  K7**tt+,,e.> -MNN  HII(.IIIIIttJ&&(( )E$.. 5rc|s}t|tjtjfrNt j|jjd|jj D}tfd|DSdS)zcReturn true if the given Name node is used in function or lambda default argument's value. c3K|]}||V dSrr)rds rrz&is_default_argument..s"!U!Uq}!}}}}!U!Urc3dK|]*}|tjD]}|uV +dSrrrName)r default_nodedefault_name_noders rrz&is_default_argument..sc  %1%@%@%L%L  "  %       rF) rrrrr itertoolschainrdefaults kw_defaultsr)rr all_defaultss` ris_default_argumentr&s  %%+U\:;;   J !U!UUZ-C!U!U!U      ,      5rc|D]Y}t|tjrdS|js1t|tjtjtjfrnZdS)z6Return true if the name is used in function decorator.TF)rrr Decorators is_statementrComprehensionScopeListComprrs ris_func_decoratorr-s%%''   fe. / / 44   *  ( # #   E  5rframenodes.ClassDefc|t|tjsdStfd|jDS)zkReturn whether `frame` is an astroid.Class node with `node` in the subtree of its bases attribute. Fc3ZK|]%}|tjvV&dSrr)rbasers rrz#is_ancestor_name..s8OO4tt**5:666OOOOOOr)rrClassDefrbases)r.rs `ris_ancestor_namer5sC eU^ , ,u OOOO5;OOO O OOrc\t|jtjo |jj|uS)z@Return True if node is the function being called in a Call node.)rrrCallfuncrs ris_being_calledr9s% dk5: . . K4;3Ct3KKrc|rkt|tjtjtjfr:|j}|r1t|tjtjtjf:|S)zHReturn the higher parent which is not an AssignName, Tuple or List node.)rrrrrrrs r assign_parentr;s^ :dU%5u{EJ$OPP{ :dU%5u{EJ$OPP Kr class_nodec|D]5}|jdkr||vr#t||tjrdS6dS)zjReturn True if is a method overridden from an ancestor which is not the base object class. objectTF) ancestorsrrrr)r<rancestors roverrides_a_methodrAs]((** =H $ $  8   8D>5;L M M 44 5rmessagesVCallable[[AstCallbackMethod[_CheckerT, _NodeT]], AstCallbackMethod[_CheckerT, _NodeT]]cdfd }|S)aDecorator to store messages that are handled by a checker method as an attribute of the function object. This information is used by ``ASTWalker`` to decide whether to call the decorated method or not. If none of the messages is enabled, the method will be skipped. Therefore, the list of messages must be well maintained at all times! This decorator only has an effect on ``visit_*`` and ``leave_*`` methods of a class inheriting from ``BaseChecker``. r8$AstCallbackMethod[_CheckerT, _NodeT]rc|_|Sr) checks_msgs)r8rBs rstore_messagesz2only_required_for_messages..store_messagess$ r)r8rErrEr)rBrHs` ronly_required_for_messagesrIs) rcLtjdtdt|S)zKept for backwards compatibility, deprecated. Use only_required_for_messages instead, which conveys the intent of the decorator much clearer. zhutils.check_messages will be removed in favour of calling utils.only_required_for_messages in pylint 3.0rr)rrrrI)rBs rcheck_messagesrKs5 M 9  &x 00rceZdZdZdS)IncompleteFormatStringz:A format string ended in the middle of a format specifier.N)rrr__doc__rrrrMrMsDDDDrrMc$eZdZdZdfd ZxZS)UnsupportedFormatCharacterz]A format character in a format string is not one of the supported format characters. indexintrNonecXt|||_dSr)rr4rQ)selfrQ __class__s rr4z#UnsupportedFormatCharacter.__init__s&  r)rQrRrrS)rrrrNr4 __classcell__)rVs@rrPrPsGrrP format_string/tuple[set[str], int, dict[str, str], list[str]]ct}i}g}d}dfd }d}|tkr|}|dkr~||\}}d}|d krRd } ||\}}|} | dkr+|d kr| d z } n |d kr| d z} ||\}}| dk+|d z } | | }|d vr||\}}|d v|d kr|d z }||\}}n*|tjvr||\}}|tjv|dkrR||\}}|d kr|d z }||\}}n*|tjvr||\}}|tjv|dvr||\}}d} || vrt ||r|||||<n |dkr|d z }|||d z }|tk||||fS)a)Parses a format string, returning a tuple (keys, num_args). Where 'keys' is the set of mapping keys in the format string, and 'num_args' is the number of arguments required by the format string. Raises IncompleteFormatString or UnsupportedFormatCharacter if a parse error occurs. rirRrtuple[int, str]cV|dz }|tkrt||fS)Nr)rrM)r[rXs r next_charz&parse_format_string..next_char+s5 Q M"" " "( (=#$$r%N(r)z#0- +r%.hlLzdiouxXeEfFgGcrs%a)r[rRrr\)setrstringdigitsrPaddappend) rXr2 key_types pos_typesnum_argsr^r[charkeydepth key_startkey_endflagss ` rparse_format_stringrrs 55DIIH%%%%%% A c-  Q 3;;illGAtCs{{#)A,,4 qjjs{{  'illGAt qjj a%#Ig$56'//#)A,,4'//s{{A #)A,,44fm++'illGAtfm++s{{#)A,,43;;MH'illGAtt&-//"+)A,,4&-//u}}#)A,,4'E5  0333 ' !% #A   &&& Qg c-  h 9i //r&tuple[str, Iterable[tuple[bool, str]]]cn tj|S#t$r}t|d}~wwxYwr)_stringformatter_field_name_split ValueErrorrM)rXes rsplit_format_field_namesryisE.1-@@@ ...$&&A-.s 4/4Iterable[str | None]c#Ktj} ||}|D]O}td|ddDr$|d}|d}|V|rt |Ed{VPdS#t $rC}|jddrdVdVYd}~dSt||d}~wwxYw) zyGiven a format string, return an iterator of all the valid format fields. It handles nested fields as well. c3K|]}|duV dSrr)ritems rrz(collect_string_fields..}s&77D44<777777rrNrrzcannot switch from manual1) re Formatterparseallcollect_string_fieldsrwr startswithrM)rX formatter parseiteratorresultrnestedexcs rrrrs"  ""I=! 66 # 9 9F77F122J77777 !9DAYFJJJ 90888888888 9 9  = = = 8A; ! !"= > > HHHIII FFFFF$]33< =sA'B C  (C8CC 9tuple[list[tuple[str, list[tuple[bool, str]]]], int, int]c2g}d}t}t|D]}|rDt|r#|t|H|rt |\}}t |tjr"|t| | |t|f#t$r}t|d}~wwxYw|dz }||t|fS)agParses a PEP 3101 format string, returning a tuple of (keyword_arguments, implicit_pos_args_cnt, explicit_pos_args). keyword_arguments is the set of mapping keys in the format string, implicit_pos_args_cnt is the number of arguments required by the format string and explicit_pos_args is the number of arguments passed with the position. rNr)rdrrisdigitrgryrnumbersNumberrhlistrwrMr)rXkeyword_argumentsimplicit_pos_args_cntexplicit_pos_argsrkeyname fielditeratorrxs rparse_format_method_stringrs4%m44 ' '  'CII%%'' '  ! !#d)) , , , ,  '%=d%C%C "G]'7>22 4!%%c'll333 6!(('4 3F3F)GHHHH 6 6 6,..A5 6 "Q & ! ! 3S9J5K5K KKs;$C  C>*C99C>attrnamec||ddko0|dko*|do|d S)zkReturn True if attribute name is protected (start with _ and some other details), False otherwise. r___)rendswith)rs ris_attr_protectedrsO  s H O H$$T**Fx/@/@/F/F Grnodes.ClassDef | Nonecp|d}tjtjtjf}|rzt ||rjt |tjsP|jdS|jd}|r*t ||rt |tjP|S)zReturn the class that is wrapping the given node. The function returns a class for a method node (or a staticmethod or a classmethod), otherwise it returns `None`. TrN) r.rNodeNGr UnboundMethod BaseInstancerr3r)rklassnodes_to_checks rnode_frame_classrs JJdJ # #E N 0 un - -05%.110 < 4 ""$"// 0 un - -05%.110 Lrastroid.ClassDefastroid.ClassDef | Nonect|jd}t|tjr|ndS)zFReturn the class that is the outer class of given (nested) class_node.TrN)rr.rrr3)r< parent_klasss rget_outer_classrs7$**$*77L%lG4DEE O<<4OrMatch[str] | NonecTtjd}||S)zrCheck that attribute name is private (at least two leading underscores, at most one trailing underscore). z^_{2,10}.*[^_]+_?$)recompilematch)rregexs ris_attr_privaters& J+ , ,E ;;x  r call_node nodes.Callposition int | Nonekeyword str | Nonec||td| |j|S#t$rYnwxYw|r%|jr|jD]}|j|kr |jcSt )aReturns the specified argument from a function call. :param nodes.Call call_node: Node representing a function call to check. :param int position: position of the argument. :param str keyword: the keyword of the argument. :returns: The node representing the argument, None if the argument is not found. :rtype: nodes.Name :raises ValueError: if both position and keyword are None. :raises NoSuchArgumentError: if no argument at the provided position or with the provided keyword. Nz2Must specify at least one of: position or keyword.)rwr IndexErrorkeywordsargvaluer)rrrrs rget_argument_from_callrsGOMNNN >(+ +    D !9%!% ! !Cw'!!y   " s $ 11nodes.NodeNG | astroid.Instancect|dr|ng}tdtj|g|DS)zQReturn whether the given class node is subclass of exceptions.Exception. r?c3lK|]/}|jdvo!|jtkV0dS)> Exception BaseExceptionN)rrEXCEPTIONS_MODULE)rr@s rrz&inherit_from_std_ex..sY   77 6 MMOO $5 5r)hasattrr?rr!r")rr?s rinherit_from_std_exrse%,D+$>$>F   BI " ::  rhandlernodes.ExceptHandler error_type9str | type[Exception] | tuple[str | type[Exception], ...]cddt|ts|f}fd|D}|jsdS||S) amCheck if the given exception handler catches the given error_type. The *handler* parameter is a node, representing an ExceptHandler node. The *error_type* can be an exception, such as AttributeError, the name of an exception, or it can be a tuple of errors. The function will return True if the handler catches any of the given errors. errorstr | type[Exception]rrc>t|ts|jS|Sr)rrr)rs rstringify_errorz&error_of_type..stringify_errors!%%% "> ! rc&h|] }|Srr)rrrs r z error_of_type..#s#FFF%u--FFFrF)rrrr)rtupletypecatch)rrexpected_errorsrs @r error_of_typersl j% ( (# ] FFFF:FFFO <u == ) ))rc|jsdS|jjD]*} t|rdS#tj$rY'wxYwdS)z?Detect if the given function node is decorated with a property.FT) decoratorsr_is_property_decoratorrInferenceError)r decorators rdecorated_with_propertyr)sn ?u_*  %i00 tt %    D  5s ,>>kindsct|tjtjfsdS|jr5|jjD](}t|tjr |j|vrdS)dS)NFT)rrrrrr Attributer)rrrs r_is_property_kindr6sq dW2E4EF G Gu .  I)U_55 ):LPU:U:Utt 5rc"t|dS)z-Check if the given node is a property setter.setterrrs ris_property_setterr@s T8 , ,,rc"t|dS)z.Check if the given node is a property deleter.deleterrrs ris_property_deleterrEs T9 - --rc$t|ddS)zACheck if the given node is either a property setter or a deleter.rrrrs ris_property_setter_or_deleterrJs T8Y 7 77rrc|D]i}t|tjr]|dvrdS|D].}|jdkr!|jdkrdS/zt|tjrt| }t|dkrt|dj tj tjfrpt|dj }|rTt|t jjr5t|jtjrt)|jcSkdS)N>builtins.propertyfunctools.cached_propertyTpropertyrrrF)inferrrr3qnamer?rrrr _get_return_nodes_skip_functionsrrrr safe_inferrobjectsPropertyfunctionr)rinferredr@returnss rrrOs{OO%%FF h / / F~~#UUUtt$..00  =J..8==??3G:3U3U444 %"3 4 4 F+/99;;++G7||q  Z  5:u"?&& &gaj&677F"8W_-EFFF#8#4e6GHHF 383DEEEEE 5rr8Pnodes.ClassDef | nodes.FunctionDef | astroid.BoundMethod | astroid.UnboundMethodqnames Iterable[str]c |jr |jjng}|D]i}t|tjr|j} t fd|DrdSU#tj$rYfwxYwdS)zMDetermine if the `func` node has a decorator with the qualified name `qname`.c3K|]?}|t|tj|jvp|vV@dSr)rrUninferableBaserr)rr[rs rrz!decorated_with..ws[=At7K)L)L=& 7AGGII$7 ===rTF) rrrr7r8rrrr)r8rrdecorator_nodes ` rdecorated_withrjs+//A&&rJ$   nej 1 1 1+0N '--//  tt   %    H  5s-A..B?Bnodes.Decorators)list[nodes.Attribute | nodes.Name | None]cg}t|dgD]v}d}t|tjrnt |j}t|tjr?|dkr'|j|jj \}}n7t|tj r||j \}}|s|d}t|tj tj fst|j}d|vo |jdk}d|vot|dddk} |s| r@t |}|t|t"jr||x|S)aReturn a list of uninferable `typing.final` decorators in `node`. This function is used to determine if the `typing.final` decorator is used with an unsupported Python version; the decorator cannot be inferred when using a Python version lower than 3.8. rNtypingrfinalr)rrrrrrModulerlookuprrrrrdictrmodnamerrrh) rrr import_nodesrr import_node import_namesis_from_import is_imports runinferable_final_decoratorsr sJT7B//$-$- FJ  i 1 1 ?!).11H(EL11 Mhnn6F6F(6R6R"+."7"7 8K"L"L< 5: . . ?'..y~>>OA|   "1o +8J'KLL  K-.. "\1V{7Jh7V-7 z44 4 4   -Y -!),,H:h8L#M#M!!),,, ri)maxsizeis_abstract_cbdict[str, nodes.FunctionDef]cN|ttt}i} t|}n#t j$ricYSwxYw|D]}|D]}|}t|tj rNt|}|s|j |vr||j =At|tj s|j |vr||j =t|tj r+||}|r |||j <|s|j |vr||j =|S)aXGet the unimplemented abstract methods for the given *node*. A method can be considered abstract if the callback *is_abstract_cb* returns a ``True`` value. The check defaults to verifying that a method is decorated with abstract methods. It will return a dictionary of abstract method names and their inferred objects. N)r)rr ABC_METHODSreversedmror ResolveErrorvaluesrrrrrr)rr visitedrr@objrabstracts runimplemented_abstract_methodsrsk  DDD,.Gtxxzz""   **??$$ * *CH#u/00 .%c?? x7**#CH-!(E,=>>.x7**#CH-(E$566 **>(33*(0GCH%%!*ch'&9&9)9 *: Ns!AAA,nodes.ExceptHandler | nodes.TryExcept | Nonec|}tjtjf}|r3t|j|s|j}|rt|j||rt|j|r|jSdS)zDReturn the ExceptHandler or the TryExcept node in which the node is.N)rrr rr)rcurrentignoress rfind_try_except_wrapper_nodersG"EO4G !*W^W==!. !*W^W==!:gng66~ 4rc|D]B}t|tjjrdSt|t jr|cSCdS)zJReturn the ExceptHandler in which the node is, without going out of scope.N)rrr scoped_nodesLocalsDictNodeNGrr)rrs r!find_except_wrapper_node_in_scoper sh&&(( gw3D E E  44 gu2 3 3 NNN  4rcjt|}|sdSt|tjr|jj}|jj}n5tj d|jD}|j}td|D}t|ttf}|p|S)z8Check if the given node is from a fallback import block.Fc3$K|] }|jV dSr)r)rrs rrz)is_from_fallback_block..s53 3 $GL3 3 3 3 3 3 rc3bK|]*}t|tjtjfV+dSr)rrrr)rrs rrz)is_from_fallback_block..sJ  ;!15< @AAr)rrrrrrhandlersr!r" from_iterabler#_except_handlers_ignores_exceptions ImportErrorModuleNotFoundError)rcontext other_bodyr$has_fallback_importsignores_import_errors ris_from_fallback_blockr-s*400G u'5.//$^( >*_223 3 (/(83 3 3   #%?; 34 7#77rr$ exceptions3tuple[type[ImportError], type[ModuleNotFoundError]]cftt|tfd|DS)N)rc3.K|]}|VdSrr)rrr8s rrz6_except_handlers_ignores_exceptions..%s+55ttG}}555555r)rrr)r$r.r8s @rr&r& s: =Z 8 8 8D 5555H555 5 55r exceptiontype[Exception] | str list[nodes.ExceptHandler] | Nonect|}t|tjrfd|jDSgS)aZReturn the collections of handlers handling the exception in arguments. Args: node (nodes.NodeNG): A node that is potentially wrapped in a try except. exception (builtin.Exception or str): exception or name of the exception. Returns: list: the collection of handlers that are handling the exception or None. c4g|]}t||Sr)r)rrr2s rrz*get_exception_handlers..6s8   }Wi7X7X    r)rrrr r$)rr2r)s ` rget_exception_handlersr7(s[+400G'5?++     #*#3     IrIterator[nodes.With]c#tK|D] }t|tjr|V!dS)zFGet all contextlib.with statements in the ancestors of the given node.N)rrrr)r with_nodes rget_contextlib_with_statementsr;<sI((** i , , OOOrcallczt|ts|j}|jD]}t |}t|t jr|j|krdS:t|t jrB|j D]:}t |}t|t jr|j|krdS;dS)z7Check if the given node suppresses the given exception.TF) rrrrrrr3rrr)r<r2rrelt inferred_elts r_suppresses_exceptionr@Cs i % %'& y   c?? h / / } ))tt* %+ . . }  )# |U^<< $)Y66444 5rc#0Kt|D]}|jD]y\}}t|tjrZt |j}t|tjr,|dkrt||r|VzdS)a>Return the contextlib suppressors handling the exception. Args: node (nodes.NodeNG): A node that is potentially wrapped in a contextlib.suppress. exception (builtin.Exception): exception or name of the exception. Yields: nodes.With: A with node that is suppressing the exception. zcontextlib.suppressN) r;rrrr7rr8r3rr@)rr2r:r}rrs rget_contextlib_suppressorsrBYs4D99 ( (   ( (GD!$ ++ (%di00x88( ((,AAA,T9==(' ( ( (r nodes.RaisecTt|}t|tjS)a Check if the node is directly under a Try/Except statement (but not under an ExceptHandler!). Args: node (nodes.Raise): the node raising the exception. Returns: bool: True if the node is inside a try/except statement, False otherwise. )rrrr )rr)s ris_node_inside_try_exceptrEqs#+400G gu / //rcdt||}|rdStt||S)zCheck if the node is in a TryExcept which handles the given exception. If the exception is not given, the function is going to look for bare excepts. T)r7rrB)rr2managing_handlerss rnode_ignores_exceptionrHs:/tY??t )$ :: ; ;;rct|rdS|}|-|jdkr"|jtvrdS|D]0}|jdkr#|jtvrdS1|D]8}|jd|ur| drdS9dS)zWReturn true if the given class node should be considered as an abstract class. TNABCMetaABCrF)pass_is_abstract) is_protocol_classdeclared_metaclassrr ABC_MODULESr?rrr. is_abstract)rmetar@methods rclass_is_abstractrSs t  " " $ $D  9 ! !diikk&6+&E&E4NN$$ =E ! !hmmoo&:k&I&I44,,.. =  d  + +t 3 3!!5!99 tt 5rrattrc ||}n#tj$rYdSwxYw|d}t|tjrt |tjtjf}|dSt|j tj r%td|j j DrdSt|j tj rdSdS)NFrTc3JK|]}t|tjVdSr)rrConst)rns rrz,_supports_protocol_method..s.UU!:a--UUUUUUr)rr NotFoundErrorrrrget_node_first_ancestor_of_typer NamedExprr BaseContainerrrrW)rrT attributesfirstthis_assign_parents r_supports_protocol_methodr`s]]4((  uu qME%)** < EL%/2    %4 (.0C D D UU7I7O7TUUUUU u (. < < 5 4s ++c~tjtjtjtjf}t ||Sr)rr+SetCompDictComp GeneratorExpr)rcomprehensionss ris_comprehensionrfs0     N dN + ++rcVt|tot|tSr)r`GETITEM_METHOD KEYS_METHODrs r_supports_mapping_protocolrks+ $ ~   8 #E; 7 78rc,t|tSr)r`CONTAINS_METHODrjs r"_supports_membership_test_protocolrns $UO < <t|tjr4t|sdS|}| ||rdSt|t jr4t|sdS|rdS||rdSt|tjrdSt|t j j rEt|j t jr&t|j r|j }||SdSNTF) rrr3has_known_bases metaclassrrhas_dynamic_getattrr*r4Proxy_proxied)rrrQs r_supports_protocolrs2%((u%% 4      && t%-..u%% 4  $ $ & & 4  U # # 4%122t 5'--..( u~w'; < <( EN + +(   ''' 5rF check_asynccD|rt}nt}t||Sr)rtrqr)rrprotocol_checks r is_iterablers&6;5 e^ 4 44rc,t|tSr)rrkrjs r is_mappingr& e%? @ @@rcNt|t}|pt|Sr)rrnr)r supporteds rsupports_membership_testr*s%"5*LMMI  * E***rct|tjr7t|trdSt |rt |rdSt|tS)NT) rrr3r`CLASS_GETITEM_METHODis_postponed_evaluation_enabled"is_node_in_type_annotation_contextrrvrrs rsupports_getitemr/sk%(( $U,@ A A 4 *4 0 0 5W 6 6  4 e%? @ @@rrc,t|tSr)rrzrrs rsupports_setitemr:rrc,t|tSr)rr}rs rsupports_delitemr>rrcZt|dd}t|r |SdS)Npytype)rcallable)rrs r_get_python_type_of_noderBs3'.tXt'D'DFvxx 4r)compare_constantsr)InferenceContext | NonerInferenceResult | Nonect} ||}t|}n+#tj$rYdSt $r }t |d}~wwxYwt|tj s"| t| |D]}t|}||vrdS|rGt|tj r-t|tj r|j|jkrdSt|tjri|jj]t|tjrC|jj7t#|jjt#|jjkrdSn8#tj$rYdSt$$r|cYSt $r }t |d}~wwxYwt#|dkr|ndS)aIReturn the inferred value for the given node. Return None if inference failed or if there is some ambiguity (more than one node has been inferred of different types). If compare_constants is True and if multiple constants are inferred, unequal inferred values are also considered ambiguous and return None. r)Nr)rdrnextrrrrrrrrgrrrWrrrr StopIteration) rr)rinferred_types infer_genrrxr inferred_types rrrIs'*eeN"JJwJ// Y  !tt """!" eT1 2 2<3E::;;;"!  H4X>>MN22tt! x55 uek22 Nek11tt8U%677 M&2ue&7883JO/ *++s5:?/C/CCCtt% &  !tt  """!"''1,,55$6sS%6A AAAF8AFBFFF; F;% F;.F66F;ilist[InferenceResult]c t||S#tj$rgcYSt$r }t |d}~wwxYw)Nr)rrrrrr)rr)rxs r infer_allrsh"DJJwJ//000  ! """!"s"%A AA  Arc |jS#t$rYnwxYw|jD]L}t||}t |t jr||ust||s d|_dSMd|_dS)z=Return true if all base classes of a class could be inferred.rFT)_all_bases_knownAttributeErrorr4rrrr3r)rr)r2rs rrrs %%       D'22265>22 "67;;;&+E "55  "E 4s  c|dupGt|tjo|jdup$t|tjo |jdkS)NrS)rrrWrrrrs ris_nonersP   B tU[ ) ) @djD.@ B tUZ ( ( @TY&-@r SuccessfulInferenceResult | NonecVt} |D]W}t|tjst |r,||t|dkrdSXn#tj $rYdSwxYw|r| ndS)zReturn the inferred type for `node`. If there is more than one possible type, or if inferred type is Uninferable or None, return None rN) rdrrrrrrgrrrpop)rtypesvar_types r node_typers-0EEE   H(D$899 WX=N=N  IIh   5zzA~~tt    !tt )599;;;T)sA)A=;A==BBcd}t|tjsdS|jr |jjng}|D]}t|tjr|j}nt|tjr|}nBt|tjr |jdkrh t|j }n#tj $rYwxYwt|tjrt||cSdS)z>Check if the given function node is a singledispatch function.)zfunctools.singledispatchzsingledispatch.singledispatchFregister)rrrrr7r8rrrrrrrr)rsingledispatch_qnamesrrr8func_defs r(is_registered_in_singledispatch_functionrs, dE- . .u*./A&&rJCC  i , , >DD  5? 3 3 DD $00 DMZ4O4O  DIOO--..HH%    H  h 1 2 2 C!(,ABB B B B C 5s&CCCnodes.FunctionDef | Nonec6t|tjr|j}nt|tjr|}ndSt|tjr |jdkrdSt |j}t|tjsdS|S)Nr) rrr7r8rrrrr)rr8rs rfind_inferred_fn_from_registerrs$ ##y D%/ * *t dEO , , 0K0Kt$)$$H h 1 2 2t Orcd}|jr |jjng}|D]%}t|}|rt||cS&dS)zDCheck if the given function node is a singledispatchmethod function.)zfunctools.singledispatchmethodz#singledispatch.singledispatchmethodF)rrrr)rsingledispatchmethod_qnamesrrrs r.is_registered_in_singledispatchmethod_functionrsm# +//A&&rJII 1)<<  I!(,GHH H H H I 5rrRcht|ddrt|jdSt|ddrt|jdSt|ddrt|jdSt|ddrt|jdS|jS)zGet the last lineno of the given node. For a simple statement this will just be node.lineno, but for a node that has child statements (e.g. a method) this will be the lineno of the last child statement recursively. finalbodyForelser$r)rget_node_last_linenorrr$rrrs rrr st[%((8#DN2$6777tXu%%5#DKO444tZ''7#DM"$5666tVU##3#DIbM222 ;rc<|}d|jvS)z.as.LLDz$//LLLLLLrFT)rr?rhelpers is_subtyper._NonDeducibleTypeHierarchy)rrr@s ris_subclass_ofrZs LLUFOLLL L LuOO%% ))(F;; tt !<    H  5s AA0/A0cft|dd}t|ot|ddgS)zCheck if a node is a function stub decorated with typing.overload. :param node: Node to check. :returns: True if node is an overload function stub. False otherwise. rNztyping.overloadoverload)rrr)rrs ris_overload_stubrms8|T22J  T~d5F 4STT U UUrclsc$t|tjsdS|tvrdS|jD]N} |D]!}|tvrdS":#tj$rYKwxYwdS)zCheck if the given node represents a protocol class. :param cls: The node to check :returns: True if the node is or inherits from typing.Protocol directly, false otherwise. FT) rrr3rTYPING_PROTOCOLSr4rrr)rr2inf_bases rrMrMxs c5> * *u yy{{&&&t   JJLL  >>##'7774448 %    H  5s2A;9A;;B  B ct|tjo.t|jtjo|jj|kS)z6Checks if node is a function call with the given name.)rrr7r8rrrs ris_call_of_namers? 4$$ # ty%* - - # INd "rcb|p|j}t|tjtjtjtjfr#||jup|j|St|tj r ||j vSt|do||S)z>Returns true if the given node is being tested for truthiness.r) rrrr rIfExpAsserttestr Comprehensionifsrr,s ris_test_conditionrs  "t{F&5;%+u|LMMBv{"Afk&;&;D&A&AA&%-.."vz!! 66 * * Ev/?/?/E/EErcX|jdkrdStd|jDS)zTest if ClassDef node is Type.rTc3`K|])}t|tjo |jdkV*dS)rN)rrrr)rbs rrz#is_classdef_type..s:RR!z!UZ((=QVv-=RRRRRRr)rrr4rs ris_classdef_typers3 yFt RRtzRRR R RRr!nodes.ClassDef | astroid.Instance attr_namecT|j|dgd}|r;t|tjr!t|jtjrdS|jD]@}t|}|r-t|tj rt||rdSAdS)zQTest if attribute is typed annotation in current node or any base nodes. NrTF) localsgetrrrrrr4rr3is_attribute_typed_annotation)rr attributer2rs rrrs   D62215I y%"2 3 3 y' 9 9 t d##  8U^44 .h BB  44 5rcR|jdko|jdkS)NEnumenum)rrrs ris_enumrs$ 9  =499;;#3v#==rnodes.AssignName typing_namec:t|jtjsdS|jj}t|tjr|j}t|tjr |j|ks%t|tj r |j |krdSdS)zTest if AssignName node has `typing_name` annotation. Especially useful to check for `typing._SpecialForm` instances like: `Union`, `Optional`, `Literal`, `ClassVar`, `Final`. FT) rrrrr Subscriptrrrrr)rr rs ris_assign_name_annotated_withr s dk5? 3 3u'J*eo..&% :uz** O{ * * j%/ 2 2 +  ; . .t 5rnodes.For | nodes.Comprehensionclt|jtjrt|jjtjr||jjjdkrgt|jj}t|tj sdS|j ddSt|jtj tjfrIt|j}t|tj sdS|j SdS)zGet the name of the dictionary which keys are being iterated over on a ``nodes.For`` or ``nodes.Comprehension`` node. If the iterating object is not either the keys method of a dictionary or a dictionary itself, this returns None. r2Nz.keysr)riterrr7r8rrrr BoundMethod as_string rpartitionrDictrrs rget_iterating_dictionary_namers 49ej))< ty~u 7 7< IN #v - -din--(G$788 4y""$$//88;;$)ej%/:;;%di(((EJ// 4y""$$$ 4rnodes.Subscript nodes.Constct|j}t|tjst d|S)zReturns the value 'subscript.slice' of a Subscript node. :param node: Subscript Node to extract value from :returns: Const Node containing subscript value :raises InferredTypeError: if the subscript node cannot be inferred as a Const z3Subscript.slice cannot be inferred as a nodes.Const)rslicerrrWrrs rget_subscript_const_valuers<$*%%H h , ,W UVVV Or importnoderrct|tjrd|jr]|}t|tjr/ |||jS#t$r|cYSwxYw|S)aGet a prepared module name from the given import node. In the case of relative imports, this will return the absolute qualified module name, which might be useful for debugging. Otherwise, the initial module name is returned unchanged. :param importnode: node representing import statement. :param modname: module name from import statement. :returns: absolute qualified module name of the module used in import. )level)rrrrrrrelative_to_absolute_namer)rrrs rget_import_namers*e.//J4D   dEL ) )  55:#36&     NsA-- A<;A<nodes.Ifct|jtjra|jj}t|tjr|j}t|tjr|dkrdSdS)zReturn True if IF stmt is a sys.version_info guard. >>> import sys >>> if sys.version_info > (3, 8): >>> from typing import Literal >>> else: >>> from typing_extensions import Literal zsys.version_infoTF) rrrCompareleftr rrr)rrs r is_sys_guardr$ sr$)U]++  eU_ - - KE ueo . . !!%7774 5rctjdtdt|jt jt jfo+|j dS)zReturn True if IF stmt is a typing guard. >>> from typing import TYPE_CHECKING >>> if TYPE_CHECKING: >>> from xyz import a PThis method will be removed in pylint 3.0; use in_type_checking_block() instead.rrr ) rrrrrrrrrrrs ris_typing_guardr'6sn MZ  EJ0   : )     ( ( 9 9:rctjdtdt|jt jot|jS)zHReturn True if node is part for guarded `typing.TYPE_CHECKING` if block.r&rr)rrrrrrrr'rs r&is_node_in_typing_guarded_import_blockr)GsI MZ dk58 , , M1M1MMrctjdtdt|jt jo't|jpt|jS)zmReturn True if node is part for guarded if block. I.e. `sys.version_info` or `typing.TYPE_CHECKING` r&rr) rrrrrrrr$r'rs ris_node_in_guarded_import_blockr+Qs_  MZ dk58 , , T[!!A_T[%A%ArctfdtjtjtjfDS)zaCheck if the given variable name is reassigned in the same scope after the current node. c3NK|]}|jko|jjkV dSr)rr)rarrs rrz.is_reassigned_after_current..dsL  '4ah4r)rrrrrr3rrrs``ris_reassigned_after_currentr0`sm ,,  u~u/@ A    rctfdtjDS)z^Check if the given variable name is deleted in the same scope after the current node. c3vK|]3}|jD])}t|ddko|jjkV*4dS)rN)rrr)rdel_noderrrs rrz+is_deleted_after_current..psp &  %%0PV]T[5Pr)rrrrDeleter/s``ris_deleted_after_currentr5ls[  33ELAA  rct|jdkont|jdtjoIt|jdjtjo|jdjjtkS)zBChecks whether a function body only consists of a single Ellipsis.rr)rrrrExprrrWEllipsisrs ris_function_body_ellipsisr9wsk DI! 1 ty|UZ 0 0 1 ty|)5; 7 7 1 IaL  $ 0 rcFt|tjo|j Sr)rrr\rrs ris_base_containerr;s dE/ 0 0 B]BrcFt|tjo|j Sr)rrrrrs ris_empty_dict_literalr=s dEJ ' ' : N:rczt|tjo!t|jto|j Sr)rrrWrrrs ris_empty_str_literalr?s04%%X*TZ*E*EXdj.rct|tjo=t|jtjot|jjt S)zIReturns true if a node is a nodes.Return that returns a constant boolean.)rrReturnrrWrrs r returns_boolrBE 4&& / tz5; / / / tz' . .rct|tjo=t|jtjot|jjt S)zIReturns true if a node is a nodes.Assign that returns a constant boolean.)rrrrrWrrs r assigned_boolrErCr ancestor_type'type[_NodeT] | tuple[type[_NodeT], ...] _NodeT | Nonec\|D]}t||r|cSdS)zIReturn the first parent node that is any of the provided types (or None).Nrr)rrFr@s rrZrZsD'')) h . . OOO  4r/tuple[None, None] | tuple[_NodeT, nodes.NodeNG]ch|}|D]}t||r||fcS|}dS)aModified version of get_node_first_ancestor_of_type to also return the descendant visited directly before reaching the sought ancestor. Useful for extracting whether a statement is guarded by a try, except, or finally when searching for a TryFinally ancestor. NNrJ)rrFrr@s r-get_node_first_ancestor_of_type_and_its_childrNsS E'')) h . . %e$ $ $ $ :rc|D]Z}t|tjst|jtjr|jjdkrN|j|jjd}|sdS|d}t|tjr|j dkrdSt|j}t|tj r |j durdSt|jtj rS|jjdkrt|jj}t|tjr|jdkrdS\dS)z4Check if a node is guarded by a TYPE_CHECKING guard.r rFrrT)rrrrrrrrrrrrWrrrrr)rr@ lookup_resultmaybe_import_fromrinferred_modules rin_type_checking_blockrSsb''))(EH--   hmUZ 0 0 }!_44$M001CDDQGM  uu -a 0 ,e.>?? %-99tt!(-00H(EK00 X^u5L5Ltt  u 7 7 }%88();<.sL11;D D!!6Y$%6111111r)rrrrr)rrs `rin_for_else_branchr^sR fei ( ( S1111HN 111..rr&nodes.AssignName | nodes.BaseContainer Iterator[str]c#Kt|tjr|j |jVdSdSt|tjr|jD]}t |Ed{VdSdS)zBYield the names of assignment targets, accounting for nested ones.N)rrrrr\rfind_assigned_names_recursive)rr>s rrbrbs&%*++: ; "+      # " FE/ 0 0:; : :C4S99 9 9 9 9 9 9 9 9:: : :r+nodes.For | nodes.Comprehension | nodes.SetIterator[bool]c#XKt|tjrdVdSt|tjr!|jD]}t |Ed{VdSt|tjtjfr$|jjD]}t |Ed{VdSdS)z6Yield ``True`` if a Starred node is found recursively.TN) rrStarredSetrhas_starred_node_recursiverrr)rr>s rrhrh s$ &&7 D%) $ $79 7 7C1#66 6 6 6 6 6 6 6 6 7 7 D59e&9: ; ;79> 7 7C1#66 6 6 6 6 6 6 6 677 7 7rc^ |D]}t|tjtjfrdSt |dsdSt|d}|j |urdSt|dddSdS#tj $rYdSwxYw)zgReturn whether any inferred value of `node` is hashable. When finding ambiguity, return True. Tigetattrr;rNF) rrrr3rrrrrjrrrr)rrhash_fns r is_hashablerls   H(U^T5I$JKK tt8Z00 tt8,,Z8899G~))ttw..:tt;u  !tts)=BB,BBBB,+B,#nodes.AssignName | nodes.AssignAttrsidecNt|tjr,t|tjr|j|jkSdSt|tjrDt|tjr*||kSdS)zKDetermine whether the target name-like node is referenced in the side node.F)rrrrrr AssignAttrr)rrns r_is_target_name_in_binop_siderq.s$ ## fe. / / ,;$)+ +u$((6Z@P-Q-Q6!!T^^%5%555 5r nodes.Assigntuple[bool, str]ct|jtjsdS|j}|jd}t|tjtjfsdSt|jtjr(t|jjttfrdSt|jtj st|j tj rdSt||jr d|jfS|jtvrht||j rSt!|j}t|tjr#t|jt"r d|jfSdSdS)zjDetermine if the node is assigning itself (with modifications) to itself. For example: x = 1 + x )Fr~rT)rrrBinOprrrpr#rWrbytesr7rightrqopCOMMUTATIVE_OPERATORSrrR)rbinopr inferred_lefts ris_augmented_assignr|;s] dj%+ . .y JE \!_F fu/1AB C Cy%*ek**z 3,00y%*ej))Z UZ-P-Py$VUZ88UX~ ))) )&%+ > > *#5:.. mU[ 1 1 "j  7 7  "> !y 9rr nodes.Moduleignored_modulescJt|}|j}|}|D]u}||vs||vrdStj||rdSt |d}d}|r*|}|s|}n|d|z }||vrdS|*vdS)NTrbr~F)rdrrfnmatchrsplitpopleft)rr~ module_name module_qnameignorepartscurrent_moduleparts ris_module_ignoredrcs/**O+K<<>>L! ? * *k_.L.L44 ?< 0 0 44k'',,-- ==??D! -!%*d**,00tt  5rcxttjotfdtDS)Nc3*K|] }j|uVdSrrj)rrrs rrz%is_singleton_const..s;11 % e111111r)rrrWrSINGLETON_VALUESrs`ris_singleton_constrsN dEK ( ( S1111)9111..rct|jtjst|jtjrt|jtjrdS |jD]0}t|dr| tvrdS1n#ttj f$rYnwxYwdS)z9Detect call to exit(), quit(), os._exit(), or sys.exit().FrT)rr8rrrrrrrrTERMINATING_FUNCS_QNAMESrrrrs ris_terminating_funcrs ty%/ 2 2DIuz22 dk5< 0 0 u  ))  H'** NN$$(@@@tt   71 2      5s!AB,*B,,CCc^ ||dS#tj$rYdSwxYwr)rrrY)rrs r is_class_attrrsC dt  uus ,,c0d}t|tjr|jjk}t|tjtjfr tfd|jD}t|tj r tfd|j D}t|tj tj fr |jk}t|tj r6|jo.t|jtjo|jjk}t|tjr tfd|jD}|p,tfd|DS)z>Searches for a tree node that defines the given variable name.Fc30K|]}|dkVdS)rNr)r node_namers rrzis_defined..s,QQ !  4QQQQQQrc3zK|]5}t|dtjo|djkV6dS)rN)rrrr)rr}rs rrzis_defined..sX   tAw 0 1 1 Jd1gld6J      rc3hK|],}tfdt|DV-dS)c3K|]r}t|tjo.t|jtjo|jjkp$t|tjo |jkVsdSr)rrrfrrr)rr>rs rrz'is_defined...s   #3 663&sy%2BCC3INd2P #3(899Nch$>N      rN)rr)rrrs rrzis_defined..ss      ,F33      rc38K|]}t|VdSr) is_defined)rrrs rrzis_defined..s>$$$) 4$$$$$$r)rrr[rrrrrrrrr3rrrrrr get_children)rris_defined_so_fars` rrrs$((5 K,4$u'7899RQQQQdjQQQQQ$ ##            $):;<<. I-$(( J )4;(899 )  D(  $ %%  ,     $$$$-1->->-@-@$$$!!rrxc (ddddddddd d d |S) a Returns the inverse comparator given a comparator. E.g. when given "==", returns "!=" :param str op: the comparator to look up. :returns: The inverse of the comparator in string format :raises KeyError: if input is not recognized as a comparator !===>=<=><not ininis notis) rrrrrrrrrrr)rxs rget_inverse_comparatorrs;       r test_nodeGnodes.Compare | nodes.Name | nodes.UnaryOp | nodes.BoolOp | nodes.BinOpcd|}t|tjr|j}n,t|tjrd|d}nt|tjr|j}|jd\}}tj tjtjtj tj f}t||rd|dn|}t||rd|dn|}|dt|d|}|S)Nznot znot (rarr` ) rrrUnaryOpoperandBoolOpr"r#opsrrr[r)rmsglhsrrhslower_priority_expressionss rnot_condition_as_stringrsl )$$&& ( (C)U]++;))++ Iu| , ,;.i))++... Iu} - -;n=#S L M L K O & "#9:: ! "  " " " " #9:: ! "  " " " " ::-c22::S:: JrrScddlm}ttt|t t g}|D]}|dS)z-Clear caches holding references to AST nodes.r)overridden_methodN)pylint.checkers.variablesrr^rrrr cache_clear)rcaches_holding_node_referenceslrus rclear_lru_cachesr sa<;;;;; & E". r)rrrr)rrrr)rrrr)rrrr)rrrrrrrr)rrrrrrrr)rrrrr)rrrrrr)r.r/rrrr)rrrr)r<r/rrrr)rBrrrC)rXrrrY)rXrrrs)rXrrrz)rXrrr)rrrr)rrrr)r<rrr)rrrrrM)rrrrrrrr)rrrr)rrrrrr)rrrrrr)rrrr)r8rrrrr)rrrr)rr/r rrr )rrrr)r$rr.r/rr)rrr2r3rr4)rrrr8)r<rr2r3rr)rrr2r3rr8)rrCrr)rrr2r3rr)rr/rr)rrrTrrr)rrrr)rrrrrr)F)rrrrrr)rrrrrr)rrrrrr)rrrr)rrr)rrrrr)rrr)rrr)rr/r)rrr)rrrr)rrrr)rrrrR)rr/rrrr)rr/rr/rr)rrrr)rrrrrr)rrrrrr)rrrrrr)rrr rrr)rr rr)rrrr)rrrrrr)rr rr)rrrrrr)rrrr)rrrFrGrrH)rrrFrGrrK)rrrTrUrr)rrrrZrr)rr_rr`)rrcrrd)rrmrnrrr)rrrrrs)rr}r~rrr)rrrr)rrrr/rr)rrrrrr)rxrrr)rrrr)rrS)rN __future__rrrr!rrrer collectionsrcollections.abcrr functoolsrrr rr r r r ruastroid.objectsrrrrastroid.contextrastroid.exceptionsrastroid.nodes._base_nodesrastroid.typingrrrpylint.checkersrrrrAstCallbackMethodr+rbrcrdrrrOr frozensetrryrprs NEXT_METHODrhrryr|rmri_SPECIAL_METHODS_PARAMSrSPECIAL_METHODS_PARAMSrd PYMETHODSrrrrrrrrrr__dict__copyrrrrrrr&r-r5r9r;rArIrKrMrPrrryrrrrrrrrrrrrrrrrr rrr r-r&r7r;r@rBrErHrSr`rfrkrnrqrtrvrzr}rrrrrrrrrrrrrrrrrrrrrrrrrMrrrrrr rrrr$r'r)r+r0r5r9r;r=r?rBrErZrNrSrYr^rbrhrlrqr|rrrrrrrrrrrrs >="""""" ........((((((((8888888888883333333333,,,,,,++++++000000EEEEEEEE,,,,,,,++++++  . . . GK} 5 5 5 i0$67 N M N   i  9BBB" ";";";<<   *   C%L?@L  Wll\288:: C& ' ' (y') ) V'&&$9DDD      )           UUUUIIII   ! ! # #$3333 8888 BBBB----`7777t&"PPPPLLLL     01111&EEEEEYEEEI0I0I0I0X....====DLLLL:2PPPP!!!!OS<    ****6    ---- .... 8888 60////d 4>B11111h         888826666>>>*8    2,::::"NNNN        CCCC;;;; "B2   : : : : 7 7 7 7,    %%%%PD ,,,,,^    0@r