bgH UdZddlmZddlZddlmZddlZddlmZm Z ddl m Z ddl m Z mZiZded <dd ZejddZdddZdS)z,Transform utilities (filters and decorator).) annotationsN)Iterator)InferenceOverwriteErrorUseInferenceDefault)NodeNG)InferenceResultInferFnz:dict[tuple[InferFn, NodeNG], list[InferenceResult] | None]_cachereturnNonec8tdS)zClear the inference tips cache.N)r clearf/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/astroid/inference_tip.pyclear_inference_tip_cachers LLNNNNNrfuncr instanceargs typing.AnykwargsIterator[InferenceResult]c|d} t||f}|tnA#t$r4dt||f<t||i|x}t||f<|sJYnwxYwt |S)z(Cache decorator used for inference tips.rN)r rKeyErrorlistiter)rrrrnoderesults r_inference_tip_cachedrs 7D d # >%'' '  !tTz&*44+@+@+@&A&AAd # v  <<s*;A('A(Finfer_functionraise_on_overwriteboolc|fdfd }|S)aGiven an instance specific inference function, return a function to be given to AstroidManager().register_transform to set this inference function. :param bool raise_on_overwrite: Raise an `InferenceOverwriteError` if the inference tip will overwrite another. Used for debugging Typical usage .. sourcecode:: python AstroidManager().register_transform(Call, inference_tip(infer_named_tuple), predicate) .. Note:: Using an inference tip will override any previously set inference tip for the given node. Use a predicate in the transform to prevent excess overwrites. rrr r r cr:|j3|j|ur*td||j|t||_|S)NzbInference already set to {existing_inference}. Trying to overwrite with {new_inference} for {node})existing_inference new_inferencer)_explicit_inferencerformatr)rr r!s r transformz inference_tip..transformCsu  (4(>>)FFLf'5"&":GMGG $9#H#H  r)rrr r r rr)r r!r)s ` r inference_tipr*-s4,;I$ r)r r ) rr rr rrrrr r)F)r r r!r"r r )__doc__ __future__rtypingcollections.abcrwraptastroid.exceptionsrr astroid.nodesrastroid.typingrr r __annotations__r decoratorrr*rrrr5s 322"""""" $$$$$$ KKKKKKKK 33333333EGGGGG $(((((((r