class_docstr: Simple backend dispatch for collection-creation functions
class_docstr_tok: ["Simple","backend","dispatch","for","collection-creation","functions"]
docstr: Register dispatchable function
docstr_tok: ["Register","dispatchable","function"]
code: def register_inplace(
      self,
      backend: str,
      name: str | None = None,
  ) -> Callable[
      [Callable[BackendFuncParams, BackendFuncReturn]],
      Callable[BackendFuncParams, BackendFuncReturn],
  ]:
      """Register dispatchable function"""
  
      def decorator(
          fn: Callable[BackendFuncParams, BackendFuncReturn]
      ) -> Callable[BackendFuncParams, BackendFuncReturn]:
          dispatch_name = name or fn.__name__
          dispatcher = self.dispatch(backend)
          dispatcher.__setattr__(dispatch_name, fn)
  
          @wraps(fn)
          def wrapper(*args, **kwargs):
              func = getattr(self, dispatch_name)
              try:
                  return func(*args, **kwargs)
              except Exception as e:
                  raise type(e)(
                      f"An error occurred while calling the {funcname(func)} "
                      f"method registered to the {self.backend} backend.\n"
                      f"Original Message: {e}"
                  ) from e
  
          wrapper.__name__ = dispatch_name
          return wrapper
  
      return decorator
  
file_path: dask/dask/backends.py
imports: from __future__ import annotations
  from collections.abc import Callable
  from functools import lru_cache, wraps
  from typing import TYPE_CHECKING, Generic, TypeVar
  import importlib_metadata
  from dask import config
  from dask.utils import funcname
label_desc: Use image node_id 6 for calling the CreationDispatch obj's underlying member method code with example usage: obj.register_inplace(backend, name) and returns: decorator, wrapper, func