code: def __init__(self, f):
      self._check_type(f)
      self.func = can(f.func)
      self.args = [can(a) for a in f.args]
      self.keywords = {k: can(v) for k, v in f.keywords.items()}
      self.buffers = []
      self.arg_buffer_counts = []
      self.keyword_buffer_counts = {}
      # consolidate buffers
      for canned_arg in self.args:
          if not isinstance(canned_arg, CannedObject):
              self.arg_buffer_counts.append(0)
              continue
          self.arg_buffer_counts.append(len(canned_arg.buffers))
          self.buffers.extend(canned_arg.buffers)
          canned_arg.buffers = []
      for key in sorted(self.keywords):
          canned_kwarg = self.keywords[key]
          if not isinstance(canned_kwarg, CannedObject):
              continue
          self.keyword_buffer_counts[key] = len(canned_kwarg.buffers)
          self.buffers.extend(canned_kwarg.buffers)
          canned_kwarg.buffers = []
  
imports: import copy
  import functools
  import sys
  from types import FunctionType
  from traitlets import import_item
  from traitlets.log import get_logger
  from .None import codeutil
label_desc: Use image node_id 1 to create a new CannedPartial object from inherited base classes: CannedObject with example: obj = CannedPartial(f)