designspace.Signature#

class designspace.Signature(args: Mapping[str, type | str], returns: type | str)#

Bases: object

The interface a .symbolic() or .code() parameter must satisfy.

For a symbolic parameter the argument names also become the variables usable in the tree. Argument order is meaningful and preserved.

Types may be given as Python types or as bare strings; a type is normalized to its name, so the signature stays serializable.

args#

Argument names to type names, in order.

Type:

MappingProxyType[str, str]

returns#

The return type’s name.

Type:

str

Examples

>>> sig = ds.Signature(args={"x": float, "y": float}, returns=float)
>>> dict(sig.args), sig.returns
({'x': 'float', 'y': 'float'}, 'float')