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

Function offset_func

dask/array/core.py:5402–5420  ·  view source on GitHub ↗

Offsets inputs by offset >>> double = lambda x: x * 2 >>> f = offset_func(double, (10,)) >>> f(1) 22 >>> f(300) 620

(func, offset, *args)

Source from the content-addressed store, hash-verified

5400
5401
5402def offset_func(func, offset, *args):
5403 """Offsets inputs by offset
5404
5405 >>> double = lambda x: x * 2
5406 >>> f = offset_func(double, (10,))
5407 >>> f(1)
5408 22
5409 >>> f(300)
5410 620
5411 """
5412
5413 def _offset(*args):
5414 args2 = list(map(add, args, offset))
5415 return func(*args2)
5416
5417 with contextlib.suppress(Exception):
5418 _offset.__name__ = f"offset_{func.__name__}"
5419
5420 return _offset
5421
5422
5423def chunks_from_arrays(arrays):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected