Skip to content

Commit 897270a

Browse files
authored
Fix type annotations of task.depends_on and task.produces. (#427)
1 parent e466806 commit 897270a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/_pytask/node_protocols.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class PTask(MetaNode, Protocol):
6464
"""Protocol for nodes."""
6565

6666
name: str
67-
depends_on: PyTree[PNode]
68-
produces: PyTree[PNode]
67+
depends_on: dict[str, PyTree[PNode]]
68+
produces: dict[str, PyTree[PNode]]
6969
markers: list[Mark]
7070
report_sections: list[tuple[str, str, str]]
7171
attributes: dict[Any, Any]

src/_pytask/nodes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class TaskWithoutPath(PTask):
3939
"""The base name of the task."""
4040
function: Callable[..., Any]
4141
"""The task function."""
42-
depends_on: PyTree[PNode] = field(factory=dict)
42+
depends_on: dict[str, PyTree[PNode]] = field(factory=dict)
4343
"""A list of dependencies of task."""
44-
produces: PyTree[PNode] = field(factory=dict)
44+
produces: dict[str, PyTree[PNode]] = field(factory=dict)
4545
"""A list of products of task."""
4646
markers: list[Mark] = field(factory=list)
4747
"""A list of markers attached to the task function."""
@@ -78,9 +78,9 @@ class Task(PTaskWithPath):
7878
"""The name of the task."""
7979
display_name: str | None = field(default=None, init=False)
8080
"""The shortest uniquely identifiable name for task for display."""
81-
depends_on: PyTree[PNode] = field(factory=dict)
81+
depends_on: dict[str, PyTree[PNode]] = field(factory=dict)
8282
"""A list of dependencies of task."""
83-
produces: PyTree[PNode] = field(factory=dict)
83+
produces: dict[str, PyTree[PNode]] = field(factory=dict)
8484
"""A list of products of task."""
8585
markers: list[Mark] = field(factory=list)
8686
"""A list of markers attached to the task function."""

0 commit comments

Comments
 (0)