docstr: x.__setitem__(i, y) <==> x[i]=y
docstr_tok: ["x.__setitem__","(","i",",","y",")","<","==",">","x","[","i","]","=y"]
code: def __setitem__(self, key, data):
      """x.__setitem__(i, y) <==> x[i]=y"""
      # if len(self._programs):
      # found = False
      # for program in self._programs:
      #     if key in program.hooks:
      #         program[key] = data
      #         found = True
      # if found: return
  
      # WARNING
      # Here we want to make sure to use buffers and texture (instead of
      # lists) since only them are aware of any external modification.
      if self._need_update:
          self._update()
  
      V = self._vertices_buffer
      # I = None
      U = None
      # if self._indices_list is not None:
      #     I = self._indices_buffer  # noqa
      if self._uniforms_list is not None:
          U = self._uniforms_texture.data.ravel().view(self.utype)
  
      # Setting a whole field
      if isinstance(key, str):
          # Setting a named field in vertices
          if key in self.vtype.names:
              V[key] = data
          # Setting a named field in uniforms
          elif self.utype and key in self.utype.names:
              # Careful, U is the whole texture that can be bigger than list
              # U[key] = data
              U[key][: len(self._uniforms_list)] = data
          else:
              raise IndexError("Unknown field name ('%s')" % key)
  
      # # Setting individual item
      # elif isinstance(key, int):
      #     #vstart, vend = self._vertices_list._items[key]
      #     #istart, iend = self._indices_list._items[key]
      #     #ustart, uend = self._uniforms_list._items[key]
      #     vertices, indices, uniforms = data
      #     del self[key]
      #     self.insert(key, vertices, indices, uniforms)
  
      else:
          raise IndexError("Cannot set more than one item")
  
imports: from __future__ import division
  import math
  import numpy
  from ...gloo import Texture2D, VertexBuffer, IndexBuffer
  from .util import dtype_reduce
  from .array_list import ArrayList
label_desc: Use image node_id 9 for calling the BaseCollection obj's underlying member method code with example usage: obj.__setitem__(key, data) without return types