Context
faststream.utils.context.types.Context #
Context(real_name: str = '', *, default: Any = _empty, initial: Optional[Callable[..., Any]] = 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. |
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/utils/context/types.py
use #
use(**kwargs: Any) -> AnyDict
Use the given keyword arguments.
PARAMETER | DESCRIPTION |
---|---|
**kwargs | Keyword arguments to be used TYPE: |
RETURNS | DESCRIPTION |
---|---|
AnyDict | A dictionary containing the updated keyword arguments |
RAISES | DESCRIPTION |
---|---|
KeyError | If the parameter name is not found in the keyword arguments |
AttributeError | If the parameter name is not a valid attribute |