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 kwargs parameters={(ParameterDescriptor | ParameterMarker | string)[]} returnType={Children} typeParameters={string[]} />import { CallSignature } from "@alloy-js/python/stc";
CallSignature({ args: boolean, kwargs: boolean, parameters: (ParameterDescriptor | ParameterMarker | string)[], returnType: Children, typeParameters: string[],}).children(children)| args | optional boolean | Indicates if there are positional arguments (*args) in the function |
| kwargs | optional boolean | Indicates if there are keyword arguments (**kwargs) in the function |
| parameters | optional (ParameterDescriptor | ParameterMarker | string)[] | The parameters to the call signature. Can be an array of strings (for simple parameter names), ParameterDescriptors, or special markers (”*” for keyword-only, ”/” for positional-only). |
| returnType | optional Children | The return type of the function. |
| typeParameters | optional string[] | The type parameters of the call signature, e.g. for a generic function. This is only supported in Python 3.12+. |
Remarks
Section titled “Remarks”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.
Example
Section titled “Example”<CallSignature
parameters={[{ name: "a", type: "int" }, { name: "b", type: "str" }]}
returnType="int"
/>
renders to
(a: int, b: str) -> int