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

Class IndexCallable

dask/utils.py:444–461  ·  view source on GitHub ↗

Provide getitem syntax for functions >>> def inc(x): ... return x + 1 >>> I = IndexCallable(inc) >>> I[3] 4

Source from the content-addressed store, hash-verified

442
443
444class IndexCallable:
445 """Provide getitem syntax for functions
446
447 >>> def inc(x):
448 ... return x + 1
449
450 >>> I = IndexCallable(inc)
451 >>> I[3]
452 4
453 """
454
455 __slots__ = ("fn",)
456
457 def __init__(self, fn):
458 self.fn = fn
459
460 def __getitem__(self, key):
461 return self.fn(key)
462
463
464@contextmanager

Callers 2

partitionsMethod · 0.90
vindexMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected