docstr: Patch Docstring class to bypass loading already loaded python objects.
docstr_tok: ["Patch","Docstring","class","to","bypass","loading","already","loaded","python","objects","."]
code: def _apply_patches(self):
      """
      Patch Docstring class to bypass loading already loaded python objects.
      """
      orig_load_obj = Docstring._load_obj
      orig_signature = inspect.signature
  
      @staticmethod
      def _load_obj(obj):
          # By default it expects a qualname and import the object, but we
          # have already loaded object after the API traversal.
          if isinstance(obj, str):
              return orig_load_obj(obj)
          else:
              return obj
  
      def signature(obj):
          # inspect.signature tries to parse __text_signature__ if other
          # properties like __signature__ doesn't exists, but cython
          # doesn't set that property despite that embedsignature cython
          # directive is set. The only way to inspect a cython compiled
          # callable's signature to parse it from __doc__ while
          # embedsignature directive is set during the build phase.
          # So path inspect.signature function to attempt to parse the first
          # line of callable.__doc__ as a signature.
          try:
              return orig_signature(obj)
          except Exception as orig_error:
              try:
                  return inspect_signature(obj)
              except Exception:
                  raise orig_error
  
      try:
          Docstring._load_obj = _load_obj
          inspect.signature = signature
          yield
      finally:
          Docstring._load_obj = orig_load_obj
          inspect.signature = orig_signature
  
imports: from contextlib import contextmanager
  from enum import EnumMeta
  import inspect
  import tokenize
  from ..compat import _get_module
  from ..utils.logger import logger
  from ..utils.command import Command, capture_stdout, default_bin
label_desc: Use image node_id 3 for calling the NumpyDoc obj's underlying member method code with example usage: obj._apply_patches() and returns: orig_load_obj, obj, orig_signature, inspect_signature