Skip to content

extend_dependencies

faststream.broker.core.abc.extend_dependencies #

extend_dependencies(
    extra: Sequence[CallModel[Any, Any]],
    dependant: CallModel[Any, Any],
) -> CallModel[Any, Any]

Extends the dependencies of a function or FastAPI dependency.

PARAMETER DESCRIPTION
extra

Additional dependencies to be added.

TYPE: Sequence[CallModel[Any, Any]]

dependant

The function or FastAPI dependency whose dependencies will be extended.

TYPE: CallModel[Any, Any]

RETURNS DESCRIPTION
CallModel[Any, Any]

The updated function or FastAPI dependency.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Source code in faststream/broker/core/abc.py
def extend_dependencies(
    extra: Sequence[CallModel[Any, Any]], dependant: CallModel[Any, Any]
) -> CallModel[Any, Any]:
    """Extends the dependencies of a function or FastAPI dependency.

    Args:
        extra: Additional dependencies to be added.
        dependant: The function or FastAPI dependency whose dependencies will be extended.

    Returns:
        The updated function or FastAPI dependency.
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    if isinstance(dependant, CallModel):
        dependant.extra_dependencies = (*dependant.extra_dependencies, *extra)
    else:  # FastAPI dependencies
        dependant.dependencies.extend(extra)
    return dependant

Last update: 2023-11-13