Context
faststream._internal.context.context_type.Context #
Context(
real_name: str = "",
*,
default: Any = EMPTY,
initial: Callable[..., Any] | None = None,
cast: bool = False,
prefix: str = "",
)
Bases: CustomField
A class to represent a context.
| METHOD | DESCRIPTION |
|---|---|
__init__ | constructor method |
use | method to use the context |
Initialize the object.
| PARAMETER | DESCRIPTION |
|---|---|
real_name | The real name of the object. TYPE: |
default | The default value of the object. TYPE: |
initial | The initial value builder. TYPE: |
cast | Whether to cast the object. TYPE: |
prefix | The prefix to be added to the name of the object. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If the default value is not provided. |
Source code in faststream/_internal/context/context_type.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
use #
use(**kwargs: Any) -> dict[str, Any]
Use the given keyword arguments.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs | Keyword arguments to be used TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any] | A dictionary containing the updated keyword arguments |
Source code in faststream/_internal/context/context_type.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
set_param_name #
set_param_name(name: str) -> Cls
Source code in fast_depends/library/model.py
30 31 32 | |
use_field #
use_field(kwargs: dict[str, Any]) -> None
Source code in fast_depends/library/model.py
38 39 | |