Skip to content

Commit c5c3978

Browse files
committed
Make _get_callable_bindings to handle noninjectable parameters
This is needed to extract the function to be a top-level one so that it can be exposes as public API.
1 parent 8e0de69 commit c5c3978

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

injector/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,10 @@ def _get_callable_bindings(callable):
802802

803803
if callable.__bindings__ == 'deferred':
804804
read_and_store_bindings(callable, _infer_injected_bindings(callable))
805-
return callable.__bindings__
805+
noninjectables = getattr(callable, '__noninjectables__', set())
806+
return {k: v for k, v in callable.__bindings__.items() if k not in noninjectables}
806807

807808
bindings = _get_callable_bindings(callable)
808-
noninjectables = getattr(callable, '__noninjectables__', set())
809809
signature = inspect.signature(callable)
810810
full_args = args
811811
if self_ is not None:
@@ -815,7 +815,7 @@ def _get_callable_bindings(callable):
815815
needed = dict(
816816
(k, v)
817817
for (k, v) in bindings.items()
818-
if k not in kwargs and k not in noninjectables and k not in bound_arguments.arguments
818+
if k not in kwargs and k not in bound_arguments.arguments
819819
)
820820

821821
dependencies = self.args_to_inject(

0 commit comments

Comments
 (0)