class_docstr: This class is used to register function or :class:`functools.partial` class to a registry.
class_docstr_tok: ["This","class","is","used","to","register","function","or",":","class",":","`","functools.partial","`","class","to","a","registry","."]
code: def _register_function(
      self,
      fn: Callable,
      name: Optional[str] = None,
      override: bool = False,
      metadata: Optional[Dict[str, Any]] = None,
  ):
      if not callable(fn):
          raise TypeError(
              f"You can only register a callable, found: {fn}"
          )
  
      if name is None:
          name = (
              fn.func.__name__ if hasattr(fn, "func") else fn.__name__
          )
  
      if self._verbose:
          rank_zero_info(
              f"Registering: {fn.__name__} function with name: {name} and metadata: {metadata}"
          )
  
      if "providers" in metadata:
          providers = metadata["providers"]
          fn = print_provider_info(name, providers, fn)
  
      item = {"fn": fn, "name": name, "metadata": metadata or {}}
  
      matching_index = self._find_matching_index(item)
      if override and matching_index is not None:
          self.functions[matching_index] = item
      else:
          if matching_index is not None:
              raise ValueError(
                  f"Function with name: {name} and metadata: {metadata} is already present within {self}."
                  " HINT: Use `override=True`."
              )
          self.functions.append(item)
  
imports: import functools
  import inspect
  import itertools
  from typing import Any, Callable, Dict, List, Optional, Union
  from pytorch_lightning.utilities import rank_zero_info
  from flash.core.utilities.providers import Provider
label_desc: Use image node_id 8 for calling the FlashRegistry obj's underlying member method code with example usage: obj._register_function(fn, name, override, metadata) without return types