parameters: (self, hookimpl)
docstring: Add an implementation to the callback chain.
docstring_summary: Add an implementation to the callback chain.
docstring_tokens: Add an implementation to the callback chain .
function: def _add_hookimpl(self, hookimpl):
          """Add an implementation to the callback chain."""
          if hookimpl.hookwrapper:
              methods = self._wrappers
          else:
              methods = self._nonwrappers
  
          if hookimpl.trylast:
              methods.insert(0, hookimpl)
          elif hookimpl.tryfirst:
              methods.append(hookimpl)
          else:
              # find last non-tryfirst method
              i = len(methods) - 1
              while i >= 0 and methods[i].tryfirst:
                  i -= 1
              methods.insert(i + 1, hookimpl)
function_tokens: def _add_hookimpl ( self , hookimpl ) : if hookimpl . hookwrapper : methods = self . _wrappers else : methods = self . _nonwrappers if hookimpl . trylast : methods . insert ( 0 , hookimpl ) elif hookimpl . tryfirst : methods . append ( hookimpl ) else : # find last non-tryfirst method i = len ( methods ) - 1 while i >= 0 and methods [ i ] . tryfirst : i -= 1 methods . insert ( i + 1 , hookimpl )