Skip to content

NoCast

faststream.utils.NoCast #

NoCast()

Bases: CustomField

A class that represents a custom field without casting.

METHOD DESCRIPTION
__init__

Initializes the NoCast object.

use

Returns the provided keyword arguments as a dictionary.

Initialize the NoCast object.

Source code in faststream/utils/no_cast.py
def __init__(self) -> None:
    """Initialize the NoCast object."""
    super().__init__(cast=False)

cast instance-attribute #

cast: bool = cast

field instance-attribute #

field = False

param_name instance-attribute #

param_name: Optional[str] = None

required instance-attribute #

required: bool = required

set_param_name #

set_param_name(name: str) -> Cls
Source code in fast_depends/library/model.py
def set_param_name(self: Cls, name: str) -> Cls:
    self.param_name = name
    return self

use #

use(**kwargs: Any) -> AnyDict

Return a dictionary containing the keyword arguments passed to the function.

PARAMETER DESCRIPTION
**kwargs

Keyword arguments

TYPE: Any DEFAULT: {}

RETURNS DESCRIPTION
AnyDict

Dictionary containing the keyword arguments

Source code in faststream/utils/no_cast.py
def use(self, **kwargs: Any) -> AnyDict:
    """Return a dictionary containing the keyword arguments passed to the function.

    Args:
        **kwargs: Keyword arguments

    Returns:
        Dictionary containing the keyword arguments
    """
    return kwargs

use_field #

use_field(kwargs: Dict[str, Any]) -> None
Source code in fast_depends/library/model.py
def use_field(self, kwargs: Dict[str, Any]) -> None:
    raise NotImplementedError("You should implement `use_field` method.")