astropy 5.0

make_function_with_signature(func, args=(), kwargs={}, varargs=None, varkwargs=None, name=None)

The desired signature must of course be compatible with the arguments actually accepted by the input function.

The args are strings that should be the names of the positional arguments. kwargs can map names of keyword arguments to their default values. It may be either a dict or a list of (keyword, default) tuples.

If varargs is a string it is added to the positional arguments as *<varargs> . Likewise varkwargs can be the name for a variable keyword argument placeholder like **<varkwargs> .

If not specified the name of the new function is taken from the original function. Otherwise, the name argument can be used to specify a new name.

Note, the names may only be valid Python variable names.

Make a new function from an existing function but with the desired signature.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /astropy/utils/codegen.py#27
type: <class 'function'>
Commit: