Skip to content

Commit e057864

Browse files
committed
Adjust docs.
1 parent 5b91510 commit e057864

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

docs_src/how_to_guides/writing_custom_nodes_example_3_py310.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ class PickleNode:
1515
Name of the node which makes it identifiable in the DAG.
1616
path
1717
The path to the file.
18+
attributes
19+
Additional attributes that are stored in the node.
1820
1921
"""
2022

21-
def __init__(self, name: str = "", path: Path | None = None) -> None:
23+
def __init__(
24+
self,
25+
name: str = "",
26+
path: Path | None = None,
27+
attributes: dict[Any, Any] | None = None,
28+
) -> None:
2229
self.name = name
2330
self.path = path
31+
self.attributes = attributes or {}
2432

2533
@property
2634
def signature(self) -> str:

docs_src/how_to_guides/writing_custom_nodes_example_3_py38.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,20 @@ class PickleNode:
1616
Name of the node which makes it identifiable in the DAG.
1717
path
1818
The path to the file.
19+
attributes
20+
Additional attributes that are stored in the node.
1921
2022
"""
2123

22-
def __init__(self, name: str = "", path: Optional[Path] = None) -> None:
24+
def __init__(
25+
self,
26+
name: str = "",
27+
path: Optional[Path] = None,
28+
attributes: Optional[dict[Any, Any]] = None,
29+
) -> None:
2330
self.name = name
2431
self.path = path
32+
self.attributes = attributes or {}
2533

2634
@property
2735
def signature(self) -> str:

tests/test_collect_command.py

+2
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def task_example(
517517
def test_node_protocol_for_custom_nodes_with_paths(runner, tmp_path):
518518
source = """
519519
from typing import Annotated
520+
from typing import Any
520521
from pytask import Product
521522
from pathlib import Path
522523
from attrs import define
@@ -527,6 +528,7 @@ class PickleFile:
527528
name: str
528529
path: Path
529530
signature: str = "id"
531+
attributes: dict[Any, Any] = {}
530532
531533
def state(self):
532534
return str(self.path.stat().st_mtime)

0 commit comments

Comments
 (0)