class_docstr: A composite class to hold many data sets which can be iterated over.
  
  This wraps/extends the `vtkMultiBlockDataSet
  <https://vtk.org/doc/nightly/html/classvtkMultiBlockDataSet.html>`_ class
  so that we can easily plot these data sets and use the composite in a
  Pythonic manner.
  
  You can think of ``MultiBlock`` like a list as we
  can iterate over this data structure by index.  It has some dictionary
  features as we can also access blocks by their string name.
  
  .. versionchanged:: 0.36.0
     ``MultiBlock`` adheres more closely to being list like, and inherits
     from :class:`collections.abc.MutableSequence`.  Multiple nonconforming
     behaviors were removed or modified.
  
  Parameters
  ----------
  *args : dict, optional
      Data object dictionary.
  
  **kwargs : dict, optional
      See :func:`pyvista.read` for additional options.
  
  Examples
  --------
  >>> import pyvista as pv
  
  Create an empty composite dataset.
  
  >>> blocks = pv.MultiBlock()
  
  Add a dataset to the collection.
  
  >>> sphere = pv.Sphere()
  >>> blocks.append(sphere)
  
  Add a named block.
  
  >>> blocks["cube"] = pv.Cube()
  
  Instantiate from a list of objects.
  
  >>> data = [
  ...     pv.Sphere(center=(2, 0, 0)),
  ...     pv.Cube(center=(0, 2, 0)),
  ...     pv.Cone(),
  ... ]
  >>> blocks = pv.MultiBlock(data)
  >>> blocks.plot()
  
  Instantiate from a dictionary.
  
  >>> data = {
  ...     "cube": pv.Cube(),
  ...     "sphere": pv.Sphere(center=(2, 2, 0)),
  ... }
  >>> blocks = pv.MultiBlock(data)
  >>> blocks.plot()
  
  Iterate over the collection.
  
  >>> for name in blocks.keys():
  ...     block = blocks[name]
  ...
  
  >>> for block in blocks:
  ...     # Do something with each dataset
  ...     surf = block.extract_surface()
  ...
class_docstr_tok: ["A","composite","class","to","hold","many","data","sets","which","can","be","iterated","over",".","This","wraps\/extends","the","`","vtkMultiBlockDataSet","<","https",":","\/\/vtk.org\/doc\/nightly\/html\/classvtkMultiBlockDataSet.html",">","`","_","class","so","that","we","can","easily","plot","these","data","sets","and","use","the","composite","in","a","Pythonic","manner",".","You","can","think","of","``","MultiBlock","``","like","a","list","as","we","can","iterate","over","this","data","structure","by","index",".","It","has","some","dictionary","features","as","we","can","also","access","blocks","by","their","string","name",".","..","versionchanged",":",":","0.36.0","``","MultiBlock","``","adheres","more","closely","to","being","list","like",",","and","inherits","from",":","class",":","`","collections.abc.MutableSequence","`",".","Multiple","nonconforming","behaviors","were","removed","or","modified",".","Parameters","--","--","--","--","--","*","args",":","dict",",","optional","Data","object","dictionary",".","*","*","kwargs",":","dict",",","optional","See",":","func",":","`","pyvista.read","`","for","additional","options",".","Examples","--","--","--","--",">",">",">","import","pyvista","as","pv","Create","an","empty","composite","dataset",".",">",">",">","blocks","=","pv.MultiBlock","(",")","Add","a","dataset","to","the","collection",".",">",">",">","sphere","=","pv.Sphere","(",")",">",">",">","blocks.append","(","sphere",")","Add","a","named","block",".",">",">",">","blocks","[","``","cube","''","]","=","pv.Cube","(",")","Instantiate","from","a","list","of","objects",".",">",">",">","data","=","[","...","pv.Sphere","(","center=","(","2",",","0",",","0",")",")",",","...","pv.Cube","(","center=","(","0",",","2",",","0",")",")",",","...","pv.Cone","(",")",",","...","]",">",">",">","blocks","=","pv.MultiBlock","(","data",")",">",">",">","blocks.plot","(",")","Instantiate","from","a","dictionary",".",">",">",">","data","=","{","...","``","cube","''",":","pv.Cube","(",")",",","...","``","sphere","''",":","pv.Sphere","(","center=","(","2",",","2",",","0",")",")",",","...","}",">",">",">","blocks","=","pv.MultiBlock","(","data",")",">",">",">","blocks.plot","(",")","Iterate","over","the","collection",".",">",">",">","for","name","in","blocks.keys","(",")",":","...","block","=","blocks","[","name","]","...",">",">",">","for","block","in","blocks",":","...","#","Do","something","with","each","dataset","...","surf","=","block.extract_surface","(",")","..."]
docstr: Set a block with a VTK data object.
  
  To set the name simultaneously, pass a string name as the 2nd index.
  
  Examples
  --------
  >>> import pyvista as pv
  >>> multi = pv.MultiBlock()
  >>> multi.append(pv.PolyData())
  >>> multi[0] = pv.UnstructuredGrid()
  >>> multi.append(pv.PolyData(), 'poly')
  >>> multi.keys()
  ['Block-00', 'poly']
  >>> multi['bar'] = pv.PolyData()
  >>> multi.n_blocks
  3
docstr_tok: ["Set","a","block","with","a","VTK","data","object",".","To","set","the","name","simultaneously",",","pass","a","string","name","as","the","2nd","index",".","Examples","--","--","--","--",">",">",">","import","pyvista","as","pv",">",">",">","multi","=","pv.MultiBlock","(",")",">",">",">","multi.append","(","pv.PolyData","(",")",")",">",">",">","multi","[","0","]","=","pv.UnstructuredGrid","(",")",">",">",">","multi.append","(","pv.PolyData","(",")",",","'poly","'",")",">",">",">","multi.keys","(",")","[","'Block-00","'",",","'poly","'","]",">",">",">","multi","[","'bar","'","]","=","pv.PolyData","(",")",">",">",">","multi.n_blocks","3"]
code: def __setitem__(
      self,
      index,
      data,
  ):
      """Set a block with a VTK data object.
  
      To set the name simultaneously, pass a string name as the 2nd index.
  
      Examples
      --------
      >>> import pyvista as pv
      >>> multi = pv.MultiBlock()
      >>> multi.append(pv.PolyData())
      >>> multi[0] = pv.UnstructuredGrid()
      >>> multi.append(pv.PolyData(), 'poly')
      >>> multi.keys()
      ['Block-00', 'poly']
      >>> multi['bar'] = pv.PolyData()
      >>> multi.n_blocks
      3
  
      """
      i: int = 0
      name: Optional[str] = None
      if isinstance(index, str):
          try:
              i = self.get_index_by_name(index)
          except KeyError:
              self.append(data, index)
              return
          name = index
      elif isinstance(index, slice):
          index_iter = range(self.n_blocks)[index]
          for i, (idx, d) in enumerate(zip_longest(index_iter, data)):
              if idx is None:
                  self.insert(
                      index_iter[-1] + 1 + (i - len(index_iter)), d
                  )  # insert after last entry, increasing
              elif d is None:
                  del self[index_iter[-1] + 1]  # delete next entry
              else:
                  self[idx] = d  #
          return
      else:
          i = index
  
      # data, i, and name are a single value now
      data = cast(pyvista.DataSet, wrap(data))
  
      i = range(self.n_blocks)[i]
  
      # this is the only spot in the class where we actually add
      # data to the MultiBlock
  
      # check if we are overwriting a block
      existing_dataset = self.GetBlock(i)
      if existing_dataset is not None:
          self._remove_ref(i)
      self.SetBlock(i, data)
      if data is not None:
          self._refs[data.memory_address] = data
  
      if name is None:
          name = f"Block-{i:02}"
      self.set_block_name(i, name)
  
imports: import collections.abc
  from itertools import zip_longest
  import pathlib
  from typing import Any, Iterable, List, Optional, Set, Tuple, Union, cast, overload
  import numpy
  import pyvista
  from .None import _vtk_core
  from ._typing_core import BoundsLike
  from .dataset import DataObject, DataSet
  from .filters import CompositeFilters
  from .pyvista_ndarray import pyvista_ndarray
  from .utilities.arrays import FieldAssociation
  from .utilities.geometric_objects import Box
  from .utilities.helpers import is_pyvista_dataset, wrap
label_desc: Use image node_id 24 for calling the MultiBlock obj's underlying member method code with example usage: obj.__setitem__(index, data) without return types