@@ -20,14 +20,12 @@ def __init__(
2020 self ,
2121 graph : "DependencyGraph" ,
2222 initial_cache : Optional [Dict [Any , Any ]] = None ,
23- replaced_deps : Optional [Dict [Any , Any ]] = None ,
2423 exception_propagation : bool = True ,
2524 ) -> None :
2625 self .graph = graph
2726 self .opened_dependencies : List [Any ] = []
2827 self .sub_contexts : "List[Any]" = []
2928 self .initial_cache = initial_cache or {}
30- self .replaced_deps = replaced_deps or {}
3129 self .propagate_excs = exception_propagation
3230
3331 def traverse_deps ( # noqa: C901, WPS210
@@ -58,7 +56,7 @@ def traverse_deps( # noqa: C901, WPS210
5856 # later.
5957 if not dep .use_cache :
6058 continue
61- # If somehow we have dependency with unknown function.
59+ # If somehow we have dependency with unknwon function.
6260 if dep .dependency is None :
6361 continue
6462 # If dependency is already calculated.
@@ -91,13 +89,7 @@ def traverse_deps( # noqa: C901, WPS210
9189 continue
9290 if subdep .kwargs :
9391 resolved_kwargs .update (subdep .kwargs )
94- # We try to grab possible replacement for
95- # function if any. Otherwise, original subdependency is returned.
96- target_dependency = self .replaced_deps .get (
97- subdep .dependency ,
98- subdep .dependency ,
99- )
100- kwargs [subdep .param_name ] = yield target_dependency (
92+ kwargs [subdep .param_name ] = yield subdep .dependency (
10193 ** resolved_kwargs ,
10294 )
10395
@@ -111,13 +103,7 @@ def traverse_deps( # noqa: C901, WPS210
111103 ):
112104 user_kwargs = dep .kwargs
113105 user_kwargs .update (kwargs )
114- # From dict of replaced functions,
115- # we grab possible replacement or original function.
116- target_dependency = self .replaced_deps .get (
117- dep .dependency ,
118- dep .dependency ,
119- )
120- cache [dep .dependency ] = yield target_dependency (** user_kwargs )
106+ cache [dep .dependency ] = yield dep .dependency (** user_kwargs )
121107 return kwargs
122108
123109
@@ -183,12 +169,7 @@ def resolver(self, executed_func: Any, initial_cache: Dict[Any, Any]) -> Any:
183169 :return: dict with resolved kwargs.
184170 """
185171 if getattr (executed_func , "dep_graph" , False ):
186- ctx = SyncResolveContext (
187- graph = executed_func ,
188- initial_cache = initial_cache ,
189- replaced_deps = self .replaced_deps ,
190- exception_propagation = self .propagate_excs ,
191- )
172+ ctx = SyncResolveContext (executed_func , initial_cache )
192173 self .sub_contexts .append (ctx )
193174 sub_result = ctx .resolve_kwargs ()
194175 elif inspect .isgenerator (executed_func ):
@@ -305,12 +286,7 @@ async def resolver(self, executed_func: Any, initial_cache: Dict[Any, Any]) -> A
305286 :return: dict with resolved kwargs.
306287 """
307288 if getattr (executed_func , "dep_graph" , False ):
308- ctx = AsyncResolveContext (
309- graph = executed_func ,
310- initial_cache = initial_cache ,
311- replaced_deps = self .replaced_deps ,
312- exception_propagation = self .propagate_excs ,
313- ) # type: ignore
289+ ctx = AsyncResolveContext (executed_func , initial_cache ) # type: ignore
314290 self .sub_contexts .append (ctx )
315291 sub_result = await ctx .resolve_kwargs ()
316292 elif inspect .isgenerator (executed_func ):
0 commit comments