code: def __iter__(self):
      if not self._in_context:
          raise ValueError("Use ParallelSampler as context manager.")
      self._make_active()
  
      if self._active and self._progress:
          self._progress.update(self._total_draws)
  
      while self._active:
          draw = ProcessAdapter.recv_draw(self._active)
          proc, is_last, draw, tuning, stats = draw
          self._total_draws += 1
          if not tuning and stats and stats[0].get("diverging"):
              self._divergences += 1
              if self._progress:
                  self._progress.comment = self._desc.format(self)
          if self._progress:
              self._progress.update(self._total_draws)
  
          if is_last:
              proc.join()
              self._active.remove(proc)
              self._finished.append(proc)
              self._make_active()
  
          # We could also yield proc.shared_point_view directly,
          # and only call proc.write_next() after the yield returns.
          # This seems to be faster overally though, as the worker
          # loses less time waiting.
          point = {
              name: val.copy()
              for name, val in proc.shared_point_view.items()
          }
  
          # Already called for new proc in _make_active
          if not is_last:
              proc.write_next()
  
          yield Draw(proc.chain, is_last, draw, tuning, stats, point)
  
imports: import ctypes
  import logging
  import multiprocessing
  import multiprocessing.sharedctypes
  import platform
  import time
  import traceback
  from collections import namedtuple
  from typing import Dict, List, Sequence
  import cloudpickle
  import numpy
  from fastprogress.fastprogress import progress_bar
  from pymc.blocking import DictToArrayBijection
  from pymc.exceptions import SamplingError
  from pymc.util import RandomSeed
label_desc: Use image node_id 3 for calling the ParallelSampler obj's underlying member method code with example usage: obj.__iter__() without return types