Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand call_with_injection() documentation #233

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions injector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,14 @@ def call_with_injection(
) -> T:
"""Call a callable and provide its dependencies if needed.

Dependencies are provided when the callable is decorated with :func:`@inject <inject>`
or some individual parameters are wrapped in :data:`Inject` – otherwise
``call_with_injection()`` is equivalent to just calling the callable directly.

If there is an overlap between arguments provided in ``args`` and ``kwargs``
and injectable dependencies the provided values take precedence and no dependency
injection process will take place for the corresponding parameters.

:param self_: Instance of a class callable belongs to if it's a method,
None otherwise.
:param args: Arguments to pass to callable.
Expand Down