class_docstr: An ArrayList is a strongly typed list whose type can be anything that can
  be interpreted as a numpy data type.
docstr: Create a new buffer using given data and sizes or dtype
  
  Parameters
  ----------
  data : array_like
      An array, any object exposing the array interface, an object
      whose __array__ method returns an array, or any (nested) sequence.
  
  itemsize:  int or 1-D array
      If `itemsize is an integer, N, the array will be divided
      into elements of size N. If such partition is not possible,
      an error is raised.
  
      If `itemsize` is 1-D array, the array will be divided into
      elements whose successive sizes will be picked from itemsize.
      If the sum of itemsize values is different from array size,
      an error is raised.
  
  dtype: np.dtype
      Any object that can be interpreted as a numpy data type.
  
  sizeable : boolean
      Indicate whether item can be appended/inserted/deleted
  
  writeable : boolean
      Indicate whether content can be changed
docstr_tok: ["Create","a","new","buffer","using","given","data","and","sizes","or","dtype","Parameters","--","--","--","--","--","data",":","array_like","An","array",",","any","object","exposing","the","array","interface",",","an","object","whose","__array__","method","returns","an","array",",","or","any","(","nested",")","sequence",".","itemsize",":","int","or","1-D","array","If","`","itemsize","is","an","integer",",","N",",","the","array","will","be","divided","into","elements","of","size","N.","If","such","partition","is","not","possible",",","an","error","is","raised",".","If","`","itemsize","`","is","1-D","array",",","the","array","will","be","divided","into","elements","whose","successive","sizes","will","be","picked","from","itemsize",".","If","the","sum","of","itemsize","values","is","different","from","array","size",",","an","error","is","raised",".","dtype",":","np.dtype","Any","object","that","can","be","interpreted","as","a","numpy","data","type",".","sizeable",":","boolean","Indicate","whether","item","can","be","appended\/inserted\/deleted","writeable",":","boolean","Indicate","whether","content","can","be","changed"]
code: def __init__(
      self,
      data=None,
      itemsize=None,
      dtype=float,
      sizeable=True,
      writeable=True,
  ):
      """Create a new buffer using given data and sizes or dtype
  
      Parameters
      ----------
      data : array_like
          An array, any object exposing the array interface, an object
          whose __array__ method returns an array, or any (nested) sequence.
  
      itemsize:  int or 1-D array
          If `itemsize is an integer, N, the array will be divided
          into elements of size N. If such partition is not possible,
          an error is raised.
  
          If `itemsize` is 1-D array, the array will be divided into
          elements whose successive sizes will be picked from itemsize.
          If the sum of itemsize values is different from array size,
          an error is raised.
  
      dtype: np.dtype
          Any object that can be interpreted as a numpy data type.
  
      sizeable : boolean
          Indicate whether item can be appended/inserted/deleted
  
      writeable : boolean
          Indicate whether content can be changed
      """
      self._sizeable = sizeable
      self._writeable = writeable
  
      if data is not None:
          if isinstance(data, (list, tuple)):
              if isinstance(data[0], (list, tuple)):
                  itemsize = [len(sublist) for sublist in data]
                  data = [item for sublist in data for item in sublist]
          self._data = np.array(data, copy=False)
          self._size = self._data.size
  
          # Default is one group with all data inside
          _itemsize = np.ones(1) * self._data.size
  
          # Check item sizes and get items count
          if itemsize is not None:
              if isinstance(itemsize, int):
                  if (self._size % itemsize) != 0:
                      raise ValueError(
                          "Cannot partition data as requested"
                      )
                  self._count = self._size // itemsize
                  _itemsize = np.ones(self._count, dtype=int) * (
                      self._size // self._count
                  )
              else:
                  _itemsize = np.array(itemsize, copy=False)
                  self._count = len(itemsize)
                  if _itemsize.sum() != self._size:
                      raise ValueError(
                          "Cannot partition data as requested"
                      )
          else:
              self._count = 1
  
          # Store items
          self._items = np.zeros((self._count, 2), int)
          C = _itemsize.cumsum()
          self._items[1:, 0] += C[:-1]
          self._items[0:, 1] += C
  
      else:
          self._data = np.zeros(1, dtype=dtype)
          self._items = np.zeros((1, 2), dtype=int)
          self._size = 0
          self._count = 0
  
file_path: vispy/vispy/visuals/collections/array_list.py
imports: import numpy
label_desc: Use image node_id 1 to create a new ArrayList object from inherited base classes: object with example: obj = ArrayList(data, itemsize, dtype, sizeable, writeable)