Skip to content

Commit 6017b82

Browse files
committed
Rename to from_annot.
1 parent 4d9c4ac commit 6017b82

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/_pytask/collect_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,5 +589,5 @@ def _evolve_instance(x: Any, instance_from_annot: Node | None) -> Any:
589589
if not instance_from_annot:
590590
return x
591591

592-
instance_from_annot.set_value(x)
592+
instance_from_annot.from_annot(x)
593593
return instance_from_annot

src/_pytask/node_protocols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def load(self) -> Any:
3131
def save(self, value: Any) -> Any:
3232
...
3333

34-
def set_value(self, value: Any) -> Any:
34+
def from_annot(self, value: Any) -> Any:
3535
...
3636

3737

src/_pytask/nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class PathNode(Node):
111111
def path(self) -> Path:
112112
return self.value
113113

114-
def set_value(self, value: Path) -> None:
114+
def from_annot(self, value: Path) -> None:
115115
"""Set path and if other attributes are not set, set sensible defaults."""
116116
if not isinstance(value, Path):
117117
raise TypeError("'value' must be a 'pathlib.Path'.")
@@ -173,7 +173,7 @@ def load(self) -> Any:
173173
def save(self, value: Any) -> NoReturn:
174174
raise NotImplementedError
175175

176-
def set_value(self, value: Any) -> None:
176+
def from_annot(self, value: Any) -> None:
177177
self.value = value
178178

179179
def state(self) -> str | None:

tests/test_collect_command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def state(self):
531531
532532
def load(self): ...
533533
def save(self, value): ...
534-
def set_value(self, value): ...
534+
def from_annot(self, value): ...
535535
536536
def task_example(
537537
data = CustomNode("custom", "text"),
@@ -572,7 +572,7 @@ def save(self, value):
572572
with self.path.open("wb") as f:
573573
pickle.dump(value, f)
574574
575-
def set_value(self, value): ...
575+
def from_annot(self, value): ...
576576
577577
578578
_PATH = Path(__file__).parent.joinpath("in.pkl")

tests/test_execute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def load(self) -> Any:
594594
def save(self, value: Any) -> None:
595595
self.path.write_bytes(pickle.dumps(value))
596596
597-
def set_value(self, value: Any) -> None: ...
597+
def from_annot(self, value: Any) -> None: ...
598598
599599
node = PickleNode("pickled_data", Path(__file__).parent.joinpath("data.pkl"))
600600

tests/test_node_protocols.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def load(self):
2828
def save(self, value):
2929
self.value = value
3030
31-
def set_value(self, value): ...
31+
def from_annot(self, value): ...
3232
3333
3434
def task_example(
@@ -70,7 +70,7 @@ def save(self, value):
7070
with self.path.open("wb") as f:
7171
pickle.dump(value, f)
7272
73-
def set_value(self, value): ...
73+
def from_annot(self, value): ...
7474
7575
7676
_PATH = Path(__file__).parent.joinpath("in.pkl")

0 commit comments

Comments
 (0)