Skip to content

CallSignature

A Python call signature, e.g. the part after the def keyword and the name in a function expression.

import { CallSignature } from "@alloy-js/python";
<CallSignature
args
classFunction
instanceFunction
kwargs
parameters={ParameterDescriptor[] | string[]}
returnType={Children}
typeParameters={string[]}
/>
argsoptionalboolean

Indicates if there are positional arguments (*args) in the function

classFunctionoptionalboolean

Indicates that this is a class function.

instanceFunctionoptionalboolean

Indicates that this is an instance function.

kwargsoptionalboolean

Indicates if there are keyword arguments (**kwargs) in the function

parametersoptionalParameterDescriptor[] | string[]

The parameters to the call signature. Can be an array of strings for parameters which don’t have a type or a default value. Otherwise, it’s an array of ParameterDescriptors.

returnTypeoptionalChildren

The return type of the function.

typeParametersoptionalstring[]

The type parameters of the call signature, e.g. for a generic function. This is only supported in Python 3.12+.

Any parameters or type parameters declared in this signature will be placed in the current scope. This component does not make a scope to hold its parameters.

<CallSignature
parameters={[{ name: "a", type: "int" }, { name: "b", type: "str" }]}
returnType="int"
/>

renders to

(a: int, b: str) -> int