def inline(dsk, keys=None, inline_constants=True):
    if keys is None:
        keys = []
    elif not isinstance(keys, (list, set)):
        keys = [keys]
    keys = set(flatten(keys))

    if inline_constants:
        keys.update(k for k, v in dsk.items() if not istask(v))

    # Keys may depend on other keys, so determine replace order with toposort.
    # The values stored in `keysubs` do not include other keys.
    replaceorder = toposort(dict((k, dsk[k]) for k in keys if k in dsk))
    keysubs = {}
    for key in replaceorder:
        val = dsk[key]
        for dep in keys & get_dependencies(dsk, key):
            if dep in keysubs:
                replace = keysubs[dep]
            else:
                replace = dsk[dep]
            val = subs(val, dep, replace)
        keysubs[key] = val

    # Make new dask with substitutions
    rv = {}
    for key, val in dsk.items():
        if key in keys:
            continue
        for item in keys & get_dependencies(dsk, key):
            val = subs(val, item, keysubs[item])
        rv[key] = val
    return rv
Return new dask with the given keys inlined with their values.
dataset/ETHPy150Open dask/dask/dask/optimize.py/inline