module documentation

Transform utilities (filters and decorator)

Function clear_inference_tip_cache Clear the inference tips cache.
Function inference_tip Given an instance specific inference function, return a function to be given to AstroidManager().register_transform to set this inference function.
Type Alias InferFn Undocumented
Function _inference_tip_cached Cache decorator used for inference tips
Variable _cache Undocumented
def clear_inference_tip_cache(): (source)

Clear the inference tips cache.

def inference_tip(infer_function: InferFn, raise_on_overwrite: bool = False) -> InferFn: (source)

Given an instance specific inference function, return a function to be given to AstroidManager().register_transform to set this inference function.

Typical usage

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.

Parameters
infer_function:InferFnUndocumented
raise_on_overwrite:boolUndocumented
bool raise_on_overwriteRaise an InferenceOverwriteError if the inference tip will overwrite another. Used for debugging
Returns
InferFnUndocumented

Undocumented

Value
typing.Callable[..., typing.Any]
@wrapt.decorator
def _inference_tip_cached(func, instance, args, kwargs): (source)

Cache decorator used for inference tips

_cache: dict[tuple[InferFn, NodeNG], typing.Any] = (source)

Undocumented