Skip to content

Commit 2c6ac81

Browse files
committed
Added graph ref to the ParamInfo.
1 parent e05a6d4 commit 2c6ac81

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

taskiq_dependencies/ctx.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ def traverse_deps( # noqa: C901
8989
# If the user want to get ParamInfo,
9090
# we get declaration of the current dependency.
9191
if subdep.dependency == ParamInfo:
92-
kwargs[subdep.param_name] = ParamInfo(dep.param_name, dep.signature)
92+
kwargs[subdep.param_name] = ParamInfo(
93+
dep.param_name,
94+
self.graph,
95+
dep.signature,
96+
)
9397
continue
9498
if subdep.use_cache:
9599
# If this dependency can be calculated, using cache,

taskiq_dependencies/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import inspect
22
import sys
33
from contextlib import _AsyncGeneratorContextManager, _GeneratorContextManager
4-
from typing import Any, AsyncContextManager, ContextManager, Optional
4+
from typing import TYPE_CHECKING, Any, AsyncContextManager, ContextManager, Optional
55

66
if sys.version_info >= (3, 10):
77
from typing import TypeGuard
88
else:
99
from typing_extensions import TypeGuard
1010

11+
if TYPE_CHECKING:
12+
from taskiq_dependencies.graph import DependencyGraph
13+
1114

1215
class ParamInfo:
1316
"""
@@ -23,9 +26,11 @@ class ParamInfo:
2326
def __init__(
2427
self,
2528
name: str,
29+
graph: "DependencyGraph",
2630
signature: Optional[inspect.Parameter] = None,
2731
) -> None:
2832
self.name = name
33+
self.graph = graph
2934
self.definition = signature
3035

3136
def __repr__(self) -> str:

0 commit comments

Comments
 (0)