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

Method substitute

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

Source from the content-addressed store, hash-verified

877 return f"{type(self).__name__}({self.args})"
878
879 def substitute(
880 self, subs: dict[KeyType, KeyType | GraphNode], key: KeyType | None = None
881 ) -> NestedContainer:
882 subs_filtered = {
883 k: v for k, v in subs.items() if k in self.dependencies and k != v
884 }
885 if not subs_filtered:
886 return self
887 return type(self)(
888 *(
889 (
890 a.substitute(subs_filtered)
891 if isinstance(a, (GraphNode, TaskRef))
892 else a
893 )
894 for a in self.args
895 )
896 )
897
898 def __dask_tokenize__(self):
899 from dask.tokenize import tokenize

Callers

nothing calls this directly

Calls 2

itemsMethod · 0.45
substituteMethod · 0.45

Tested by

no test coverage detected