Skip to content

Commit 395e7e8

Browse files
authored
Expand call_with_injection() documentation (#233)
I thought it could use some clarifications.
1 parent db332ec commit 395e7e8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

injector/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,14 @@ def call_with_injection(
10071007
) -> T:
10081008
"""Call a callable and provide its dependencies if needed.
10091009
1010+
Dependencies are provided when the callable is decorated with :func:`@inject <inject>`
1011+
or some individual parameters are wrapped in :data:`Inject` – otherwise
1012+
``call_with_injection()`` is equivalent to just calling the callable directly.
1013+
1014+
If there is an overlap between arguments provided in ``args`` and ``kwargs``
1015+
and injectable dependencies the provided values take precedence and no dependency
1016+
injection process will take place for the corresponding parameters.
1017+
10101018
:param self_: Instance of a class callable belongs to if it's a method,
10111019
None otherwise.
10121020
:param args: Arguments to pass to callable.

0 commit comments

Comments
 (0)