Parameter
Parameter ¶
Parameter(name: str, kind: ParameterKind, type: Any = EMPTY, default: Any = EMPTY, description: str | None = None, infer_type: bool = True)
A Parameter instance contains information about a function or method parameter, including its name, type, default
value, and description.
Initialize a Parameter instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the parameter. |
required |
kind
|
_ParameterKind
|
The kind of the parameter, i.e. POSITIONAL_ONLY, POSITIONAL_OR_KEYWORD, VAR_POSITIONAL, KEYWORD_ONLY, or VAR_KEYWORD. |
required |
type
|
Any
|
The type of the parameter. |
EMPTY
|
default
|
Any
|
The default value of the parameter. |
EMPTY
|
description
|
str | None
|
The description of the parameter. |
None
|
infer_type
|
bool
|
Infer the type of the parameter based on its default value. |
True
|
Source code in objinspect/parameter.py
get_infered_type ¶
as_str ¶
Return a string representation of the parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
bool
|
Whether to colorize the output. |
True
|
theme
|
ParameterStrTheme
|
Color theme to use. Default will be used if None. |
None
|