class_docstr: View on a sub-region of a DataBuffer.
  
  Parameters
  ----------
  base : DataBuffer
      The buffer accessed by this view.
  key : str, int, slice, or Ellpsis
      The index into the base buffer that defines a sub-region of the buffer
      to view. String arguments select a single field from multi-field
      dtypes, and other allowed types select a subset of rows.
  
  Notes
  -----
  It is generally not necessary to instantiate this class manually; use
  ``base_buffer[key]`` instead.
class_docstr_tok: ["View","on","a","sub-region","of","a","DataBuffer",".","Parameters","--","--","--","--","--","base",":","DataBuffer","The","buffer","accessed","by","this","view",".","key",":","str",",","int",",","slice",",","or","Ellpsis","The","index","into","the","base","buffer","that","defines","a","sub-region","of","the","buffer","to","view",".","String","arguments","select","a","single","field","from","multi-field","dtypes",",","and","other","allowed","types","select","a","subset","of","rows",".","Notes","--","--","-","It","is","generally","not","necessary","to","instantiate","this","class","manually",";","use","``","base_buffer","[","key","]","``","instead","."]
code: def __init__(self, base, key):
      # Note how this never runs the super's __init__,
      # all attributes must thus be set here ...
  
      self._base = base
      self._key = key
      self._stride = base.stride
  
      if isinstance(key, str):
          self._dtype = base.dtype[key]
          self._offset = base.dtype.fields[key][1]
          self._nbytes = base.size * self._dtype.itemsize
          self._size = base.size
          self._itemsize = self._dtype.itemsize
          return
  
      if isinstance(key, int):
          if key < 0:
              key += base.size
          if key < 0 or key > base.size:
              raise IndexError("Buffer assignment index out of range")
          start, stop, step = key, key + 1, 1
      elif isinstance(key, slice):
          start, stop, step = key.indices(base.size)
          if stop < start:
              start, stop = stop, start
      elif key == Ellipsis:
          start, stop, step = 0, base.size, 1
      else:
          raise TypeError("Buffer indices must be integers or strings")
  
      if step != 1:
          raise ValueError("Cannot access non-contiguous data")
  
      self._itemsize = base.itemsize
      self._offset = start * self.itemsize
      self._size = stop - start
      self._dtype = base.dtype
      self._nbytes = self.size * self.itemsize
  
imports: import numpy
  from os import path
  from traceback import extract_stack, format_list
  import weakref
  from .globject import GLObject
  from ..util import logger
label_desc: Use image node_id 1 to create a new DataBufferView object from inherited base classes: DataBuffer with example: obj = DataBufferView(base, key)