class_docstr: A registry for plugins.
  
  This is a plugin registry that allows plugins to be loaded/registered
  in two ways:
  
  1. Through an explicit call to ``.register(name, value)``.
  2. By looking for other Python packages that are installed and provide
     a setuptools entry point group.
  
  When you create an instance of this class, provide the name of the
  entry point group to use::
  
      reg = PluginRegister('my_entrypoint_group')
class_docstr_tok: ["A","registry","for","plugins",".","This","is","a","plugin","registry","that","allows","plugins","to","be","loaded\/registered","in","two","ways",":","1",".","Through","an","explicit","call","to","``",".register","(","name",",","value",")","``",".","2",".","By","looking","for","other","Python","packages","that","are","installed","and","provide","a","setuptools","entry","point","group",".","When","you","create","an","instance","of","this","class",",","provide","the","name","of","the","entry","point","group","to","use",":",":","reg","=","PluginRegister","(","'my_entrypoint_group","'",")"]
docstr: Register a plugin by name and value.
  
  This method is used for explicit registration of a plugin and shouldn't be
  used to manage entry point managed plugins, which are auto-loaded.
  
  Parameters
  ==========
  name: str
      The name of the plugin.
  value: PluginType or None
      The actual plugin object to register or None to unregister that plugin.
  
  Returns
  =======
  plugin: PluginType or None
      The plugin that was registered or unregistered.
docstr_tok: ["Register","a","plugin","by","name","and","value",".","This","method","is","used","for","explicit","registration","of","a","plugin","and","should","n't","be","used","to","manage","entry","point","managed","plugins",",","which","are","auto-loaded",".","Parameters","==========","name",":","str","The","name","of","the","plugin",".","value",":","PluginType","or","None","The","actual","plugin","object","to","register","or","None","to","unregister","that","plugin",".","Returns","=======","plugin",":","PluginType","or","None","The","plugin","that","was","registered","or","unregistered","."]
code: def register(
      self, name: str, value: Optional[PluginType]
  ) -> Optional[PluginType]:
      """Register a plugin by name and value.
  
      This method is used for explicit registration of a plugin and shouldn't be
      used to manage entry point managed plugins, which are auto-loaded.
  
      Parameters
      ==========
      name: str
          The name of the plugin.
      value: PluginType or None
          The actual plugin object to register or None to unregister that plugin.
  
      Returns
      =======
      plugin: PluginType or None
          The plugin that was registered or unregistered.
      """
      if value is None:
          return self._plugins.pop(name, None)
      else:
          assert isinstance(value, self.plugin_type)  # type: ignore[arg-type]  # Should ideally be fixed by better annotating plugin_type
          self._plugins[name] = value
          return value
  
imports: from typing import Any, Dict, List, Optional, Generic, TypeVar, cast
  from types import TracebackType
  from importlib.metadata import entry_points
  from toolz import curry
label_desc: Use image node_id 2 for calling the PluginRegistry obj's underlying member method code with example usage: obj.register(name, value) and returns: self, value