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

Function safe_wraps

dask/array/utils.py:406–414  ·  view source on GitHub ↗

Like functools.wraps, but safe to use even if wrapped is not a function. Only needed on Python 2.

(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS)

Source from the content-addressed store, hash-verified

404
405
406def safe_wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS):
407 """Like functools.wraps, but safe to use even if wrapped is not a function.
408
409 Only needed on Python 2.
410 """
411 if all(hasattr(wrapped, attr) for attr in assigned):
412 return functools.wraps(wrapped, assigned=assigned)
413 else:
414 return lambda x: x
415
416
417def _dtype_of(a):

Callers

nothing calls this directly

Calls 1

allFunction · 0.85

Tested by

no test coverage detected