class_docstr: Sequence of ndarrays having variable first dimension sizes.
  
  This is a container that can store multiple ndarrays where each ndarray
  might have a different first dimension size but a *common* size for the
  remaining dimensions.
  
  More generally, an instance of :class:`ArraySequence` of length $N$ is
  composed of $N$ ndarrays of shape $(d_1, d_2, ... d_D)$ where $d_1$
  can vary in length between arrays but $(d_2, ..., d_D)$ have to be the
  same for every ndarray.
class_docstr_tok: ["Sequence","of","ndarrays","having","variable","first","dimension","sizes",".","This","is","a","container","that","can","store","multiple","ndarrays","where","each","ndarray","might","have","a","different","first","dimension","size","but","a","*","common","*","size","for","the","remaining","dimensions",".","More","generally",",","an","instance","of",":","class",":","`","ArraySequence","`","of","length","$","N","$","is","composed","of","$","N","$","ndarrays","of","shape","$","(","d_1",",","d_2",",","...","d_D",")","$","where","$","d_1","$","can","vary","in","length","between","arrays","but","$","(","d_2",",","...",",","d_D",")","$","have","to","be","the","same","for","every","ndarray","."]
docstr: Set sequence(s) through standard or advanced numpy indexing.
  
  Parameters
  ----------
  idx : int or slice or list or ndarray
      If int, index of the element to retrieve.
      If slice, use slicing to retrieve elements.
      If list, indices of the elements to retrieve.
      If ndarray with dtype int, indices of the elements to retrieve.
      If ndarray with dtype bool, only retrieve selected elements.
  elements: ndarray or :class:`ArraySequence`
      Data that will overwrite selected sequences.
      If `idx` is an int, `elements` is expected to be a ndarray.
      Otherwise, `elements` is expected a :class:`ArraySequence` object.
docstr_tok: ["Set","sequence","(","s",")","through","standard","or","advanced","numpy","indexing",".","Parameters","--","--","--","--","--","idx",":","int","or","slice","or","list","or","ndarray","If","int",",","index","of","the","element","to","retrieve",".","If","slice",",","use","slicing","to","retrieve","elements",".","If","list",",","indices","of","the","elements","to","retrieve",".","If","ndarray","with","dtype","int",",","indices","of","the","elements","to","retrieve",".","If","ndarray","with","dtype","bool",",","only","retrieve","selected","elements",".","elements",":","ndarray","or",":","class",":","`","ArraySequence","`","Data","that","will","overwrite","selected","sequences",".","If","`","idx","`","is","an","int",",","`","elements","`","is","expected","to","be","a","ndarray",".","Otherwise",",","`","elements","`","is","expected","a",":","class",":","`","ArraySequence","`","object","."]
code: def __setitem__(self, idx, elements):
      """Set sequence(s) through standard or advanced numpy indexing.
  
      Parameters
      ----------
      idx : int or slice or list or ndarray
          If int, index of the element to retrieve.
          If slice, use slicing to retrieve elements.
          If list, indices of the elements to retrieve.
          If ndarray with dtype int, indices of the elements to retrieve.
          If ndarray with dtype bool, only retrieve selected elements.
      elements: ndarray or :class:`ArraySequence`
          Data that will overwrite selected sequences.
          If `idx` is an int, `elements` is expected to be a ndarray.
          Otherwise, `elements` is expected a :class:`ArraySequence` object.
      """
      if isinstance(idx, (numbers.Integral, np.integer)):
          start = self._offsets[idx]
          self._data[start : start + self._lengths[idx]] = elements
          return
  
      if isinstance(idx, tuple):
          off_idx = idx[0]
          data = self._data.__getitem__((slice(None),) + idx[1:])
      else:
          off_idx = idx
          data = self._data
  
      if isinstance(off_idx, slice):  # Standard list slicing
          offsets = self._offsets[off_idx]
          lengths = self._lengths[off_idx]
  
      elif isinstance(
          off_idx, (list, range)
      ) or is_ndarray_of_int_or_bool(off_idx):
          # Fancy indexing
          offsets = self._offsets[off_idx]
          lengths = self._lengths[off_idx]
  
      else:
          raise TypeError(
              "Index must be either an int, a slice, a list of int"
              " or a ndarray of bool! Not " + str(type(idx))
          )
  
      if is_array_sequence(elements):
          if len(lengths) != len(elements):
              msg = f"Trying to set {len(lengths)} sequences with {len(elements)} sequences."
              raise ValueError(msg)
  
          if sum(lengths) != elements.total_nb_rows:
              msg = f"Trying to set {sum(lengths)} points with {elements.total_nb_rows} points."
              raise ValueError(msg)
  
          for o1, l1, o2, l2 in zip(
              offsets, lengths, elements._offsets, elements._lengths
          ):
              data[o1 : o1 + l1] = elements._data[o2 : o2 + l2]
  
      elif isinstance(elements, numbers.Number):
          for o1, l1 in zip(offsets, lengths):
              data[o1 : o1 + l1] = elements
  
      else:  # Try to iterate over it.
          for o1, l1, element in zip(offsets, lengths, elements):
              data[o1 : o1 + l1] = element
  
imports: import numbers
  from functools import reduce
  from operator import mul
  import numpy
label_desc: Use image node_id 16 for calling the ArraySequence obj's underlying member method code with example usage: obj.__setitem__(idx, elements) without return types