class_docstr: A key/object registry class.
  This class is used in CVNets to do Dependency Injection in configs,
  so when you write "resnet" in a config, it knows which module to load.
  You can potentially provide a `base_class` to ensures that all items
  in the registry are of type `base_class`.
  
  Registry also allows for passing arguments to a registered item:
  For example: "top1" -> "top1(pred=logits)"
  
  Usage:
  >>> my_registry = Registry("registry_name")
  >>> @my_registry.register("awesome_class_or_func")
  ... def my_awesome_class_or_func():
  ...    pass
  >>> assert "awesome_class_or_func" in my_registry
  
  It allows for vanilla key/object definition as well as functional argument injection:
  >>> reg = Registry("registry_name")
  >>> reg.register("awesome_dict")(dict)
  >>> reg["awesome_dict(name=hello, type=fifo)]()
  {'name': 'hello', 'type': 'fifo'}
docstr: Args:
      registry_name: registry name, used for debugging and error messages
      base_class: If provided, will ensure that all items inside the registry
          are of type `base_class`.
      separator: Separator between name and type in `register` function.
      lazy_load_dirs: If provided, will load all directories under these
          directories when inspecting for the modules of the registry.
docstr_tok: ["Args",":","registry_name",":","registry","name",",","used","for","debugging","and","error","messages","base_class",":","If","provided",",","will","ensure","that","all","items","inside","the","registry","are","of","type","`","base_class","`",".","separator",":","Separator","between","name","and","type","in","`","register","`","function",".","lazy_load_dirs",":","If","provided",",","will","load","all","directories","under","these","directories","when","inspecting","for","the","modules","of","the","registry","."]
code: def __init__(
      self,
      registry_name: str,
      base_class: Optional[type] = None,
      separator: Optional[str] = ":",
      lazy_load_dirs: Optional[List[str]] = None,
      internal_dirs: Sequence[str] = (),
  ) -> None:
      """
      Args:
          registry_name: registry name, used for debugging and error messages
          base_class: If provided, will ensure that all items inside the registry
              are of type `base_class`.
          separator: Separator between name and type in `register` function.
          lazy_load_dirs: If provided, will load all directories under these
              directories when inspecting for the modules of the registry.
      """
      self.registry_name = registry_name
      self.base_class = base_class
      self.registry = {}
      # For debugging purposes we want to throw a warning if someone accesses
      # arguments before registering all items.
      self.arguments_accessed = False
      self.separator = separator
      # Lazy loading to get rid of possible cicular dependencies
      self._modules_loaded = False
      self._lazy_load_dirs = lazy_load_dirs
      self.internal_dirs = internal_dirs
      if self._lazy_load_dirs is None:
          self._lazy_load_dirs = []
  
file_path: ml-cvnets/utils/registry.py
imports: import argparse
  from functools import partial
  from typing import Callable, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar, Union
  from utils import logger
  from utils.import_utils import import_modules_from_folder
label_desc: Use image node_id 1 to create a new Registry object  with example: obj = Registry(registry_name, base_class, separator, lazy_load_dirs, internal_dirs)