code: def __init__(self, obj):
      from numpy import ascontiguousarray
  
      self.shape = obj.shape
      self.dtype = (
          obj.dtype.descr if obj.dtype.fields else obj.dtype.str
      )
      self.pickled = False
      if sum(obj.shape) == 0:
          self.pickled = True
      elif obj.dtype == "O":
          # can't handle object dtype with buffer approach
          self.pickled = True
      elif obj.dtype.fields and any(
          dt == "O" for dt, sz in obj.dtype.fields.values()
      ):
          self.pickled = True
      if self.pickled:
          # just pickle it
          from . import serialize
  
          self.buffers = [
              serialize.pickle.dumps(obj, serialize.PICKLE_PROTOCOL)
          ]
      else:
          # ensure contiguous
          obj = ascontiguousarray(obj, dtype=None)
          self.buffers = [memoryview(obj)]
  
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 CannedArray object from inherited base classes: CannedObject with example: obj = CannedArray(obj)