(
self, subs: dict[KeyType, KeyType | GraphNode], key: KeyType | None = None
)
| 880 | return f"{type(self).__name__}({self.args})" |
| 881 | |
| 882 | def substitute( |
| 883 | self, subs: dict[KeyType, KeyType | GraphNode], key: KeyType | None = None |
| 884 | ) -> NestedContainer: |
| 885 | subs_filtered = { |
| 886 | # subs can be as large as the whole graph; do not iterate over it! |
| 887 | k: v |
| 888 | for k in (self.dependencies & subs.keys()) |
| 889 | if (v := subs[k]) != k |
| 890 | } |
| 891 | if not subs_filtered: |
| 892 | return self |
| 893 | return type(self)( |
| 894 | *( |
| 895 | ( |
| 896 | a.substitute(subs_filtered) |
| 897 | if isinstance(a, (GraphNode, TaskRef)) |
| 898 | else a |
| 899 | ) |
| 900 | for a in self.args |
| 901 | ) |
| 902 | ) |
| 903 | |
| 904 | def __dask_tokenize__(self): |
| 905 | from dask.tokenize import tokenize |
nothing calls this directly
no test coverage detected