MCPcopy Create free account
hub / github.com/dask/dask / substitute

Method substitute

dask/_task_spec.py:870–887  ·  view source on GitHub ↗
(
        self, subs: dict[KeyType, KeyType | GraphNode], key: KeyType | None = None
    )

Source from the content-addressed store, hash-verified

868 return f"{type(self).__name__}({self.args})"
869
870 def substitute(
871 self, subs: dict[KeyType, KeyType | GraphNode], key: KeyType | None = None
872 ) -> NestedContainer:
873 subs_filtered = {
874 k: v for k, v in subs.items() if k in self.dependencies and k != v
875 }
876 if not subs_filtered:
877 return self
878 return type(self)(
879 *(
880 (
881 a.substitute(subs_filtered)
882 if isinstance(a, (GraphNode, TaskRef))
883 else a
884 )
885 for a in self.args
886 )
887 )
888
889 def __dask_tokenize__(self):
890 from dask.tokenize import tokenize

Callers

nothing calls this directly

Calls 2

itemsMethod · 0.45
substituteMethod · 0.45

Tested by

no test coverage detected