class_docstr: Base class for all plugins.
docstr: Attach this plugin to a `Pluggable`.
docstr_tok: ["Attach","this","plugin","to","a","`","Pluggable","`","."]
code: def attach_to(self, pluggable: Pluggable):
      """Attach this plugin to a `Pluggable`."""
      assert self._pluggable is None
      assert len(self._hook_handles) == 0
  
      self._pluggable = pluggable
  
      pluggable.append_plugin(self)
  
      # go through all attributes
      for name in dir(self):
          try:
              func = getattr(self, name)
  
              # get attribute hook events (may raise an AttributeError)
              events = func._plugin_hook_events
  
              # register function as a hook
              handle = pluggable.register_hook(func, *events)
              self._hook_handles.append(handle)
  
          except AttributeError:
              continue
  
imports: import logging
  from collections import defaultdict
  from inspect import isclass, signature
  from itertools import count
  from queue import Queue
  from typing import Any, Callable, Dict, Iterator, List, NewType, Optional, Sequence, Set, Type, Union, cast
label_desc: Use image node_id 2 for calling the BasePlugin obj's underlying member method code with example usage: obj.attach_to(pluggable) without return types