14
14
from _pytask .mark import Mark
15
15
16
16
17
- __all__ = ["MetaNode" , " PNode" , "PPathNode" , "PTask" , "PTaskWithPath" ]
17
+ __all__ = ["PNode" , "PPathNode" , "PTask" , "PTaskWithPath" ]
18
18
19
19
20
20
@runtime_checkable
21
- class MetaNode (Protocol ):
22
- """Protocol for an intersection between nodes and tasks ."""
21
+ class PNode (Protocol ):
22
+ """Protocol for nodes."""
23
23
24
24
name : str
25
25
26
26
@property
27
27
def signature (self ) -> str :
28
28
"""Return the signature of the node."""
29
- ...
30
29
31
30
@abstractmethod
32
31
def state (self ) -> str | None :
@@ -36,12 +35,6 @@ def state(self) -> str | None:
36
35
does not exist, you can also return ``None``.
37
36
38
37
"""
39
- ...
40
-
41
-
42
- @runtime_checkable
43
- class PNode (MetaNode , Protocol ):
44
- """Protocol for nodes."""
45
38
46
39
def load (self , is_product : bool ) -> Any :
47
40
"""Return the value of the node that will be injected into the task.
@@ -55,11 +48,9 @@ def load(self, is_product: bool) -> Any:
55
48
user calling :meth:`PNode.load`.
56
49
57
50
"""
58
- ...
59
51
60
52
def save (self , value : Any ) -> Any :
61
53
"""Save the value that was returned from a task."""
62
- ...
63
54
64
55
65
56
@runtime_checkable
@@ -74,19 +65,32 @@ class PPathNode(PNode, Protocol):
74
65
75
66
76
67
@runtime_checkable
77
- class PTask (MetaNode , Protocol ):
68
+ class PTask (Protocol ):
78
69
"""Protocol for nodes."""
79
70
71
+ name : str
80
72
depends_on : dict [str , PyTree [PNode ]]
81
73
produces : dict [str , PyTree [PNode ]]
74
+ function : Callable [..., Any ]
82
75
markers : list [Mark ]
83
76
report_sections : list [tuple [str , str , str ]]
84
77
attributes : dict [Any , Any ]
85
- function : Callable [..., Any ]
78
+
79
+ @property
80
+ def signature (self ) -> str :
81
+ """Return the signature of the node."""
82
+
83
+ @abstractmethod
84
+ def state (self ) -> str | None :
85
+ """Return the state of the node.
86
+
87
+ The state can be something like a hash or a last modified timestamp. If the node
88
+ does not exist, you can also return ``None``.
89
+
90
+ """
86
91
87
92
def execute (self , ** kwargs : Any ) -> Any :
88
93
"""Return the value of the node that will be injected into the task."""
89
- ...
90
94
91
95
92
96
@runtime_checkable
0 commit comments