class_docstr: Vectorized environment that runs multiple environments in parallel.
  
  It uses ``multiprocessing`` processes, and pipes for communication.
  
  Example::
  
      >>> import gym
      >>> env = gym.vector.AsyncVectorEnv([
      ...     lambda: gym.make("Pendulum-v0", g=9.81),
      ...     lambda: gym.make("Pendulum-v0", g=1.62)
      ... ])
      >>> env.reset()
      array([[-0.8286432 ,  0.5597771 ,  0.90249056],
             [-0.85009176,  0.5266346 ,  0.60007906]], dtype=float32)
class_docstr_tok: ["Vectorized","environment","that","runs","multiple","environments","in","parallel",".","It","uses","``","multiprocessing","``","processes",",","and","pipes","for","communication",".","Example",":",":",">",">",">","import","gym",">",">",">","env","=","gym.vector.AsyncVectorEnv","(","[","...","lambda",":","gym.make","(","``","Pendulum-v0","''",",","g=9.81",")",",","...","lambda",":","gym.make","(","``","Pendulum-v0","''",",","g=1.62",")","...","]",")",">",">",">","env.reset","(",")","array","(","[","[","-0.8286432",",","0.5597771",",","0.90249056","]",",","[","-0.85009176",",","0.5266346",",","0.60007906","]","]",",","dtype=float32",")"]
docstr: Wait for the calls to :obj:`step` in each sub-environment to finish.
  
  Args:
      timeout: Number of seconds before the call to :meth:`step_wait` times out. If ``None``, the call to :meth:`step_wait` never times out.
  
  Returns:
       The batched environment step information, (obs, reward, terminated, truncated, info)
  
  Raises:
      ClosedEnvironmentError: If the environment was closed (if :meth:`close` was previously called).
      NoAsyncCallError: If :meth:`step_wait` was called without any prior call to :meth:`step_async`.
      TimeoutError: If :meth:`step_wait` timed out.
docstr_tok: ["Wait","for","the","calls","to",":","obj",":","`","step","`","in","each","sub-environment","to","finish",".","Args",":","timeout",":","Number","of","seconds","before","the","call","to",":","meth",":","`","step_wait","`","times","out",".","If","``","None","``",",","the","call","to",":","meth",":","`","step_wait","`","never","times","out",".","Returns",":","The","batched","environment","step","information",",","(","obs",",","reward",",","terminated",",","truncated",",","info",")","Raises",":","ClosedEnvironmentError",":","If","the","environment","was","closed","(","if",":","meth",":","`","close","`","was","previously","called",")",".","NoAsyncCallError",":","If",":","meth",":","`","step_wait","`","was","called","without","any","prior","call","to",":","meth",":","`","step_async","`",".","TimeoutError",":","If",":","meth",":","`","step_wait","`","timed","out","."]
code: def step_wait(
      self, timeout: Optional[Union[int, float]] = None
  ) -> Tuple[
      np.ndarray, np.ndarray, np.ndarray, np.ndarray, List[dict]
  ]:
      """Wait for the calls to :obj:`step` in each sub-environment to finish.
  
      Args:
          timeout: Number of seconds before the call to :meth:`step_wait` times out. If ``None``, the call to :meth:`step_wait` never times out.
  
      Returns:
           The batched environment step information, (obs, reward, terminated, truncated, info)
  
      Raises:
          ClosedEnvironmentError: If the environment was closed (if :meth:`close` was previously called).
          NoAsyncCallError: If :meth:`step_wait` was called without any prior call to :meth:`step_async`.
          TimeoutError: If :meth:`step_wait` timed out.
      """
      self._assert_is_running()
      if self._state != AsyncState.WAITING_STEP:
          raise NoAsyncCallError(
              "Calling `step_wait` without any prior call "
              "to `step_async`.",
              AsyncState.WAITING_STEP.value,
          )
  
      if not self._poll(timeout):
          self._state = AsyncState.DEFAULT
          raise mp.TimeoutError(
              f"The call to `step_wait` has timed out after {timeout} second(s)."
          )
  
      observations_list, rewards, terminateds, truncateds, infos = (
          [],
          [],
          [],
          [],
          {},
      )
      successes = []
      for i, pipe in enumerate(self.parent_pipes):
          result, success = pipe.recv()
          obs, rew, terminated, truncated, info = result
  
          successes.append(success)
          observations_list.append(obs)
          rewards.append(rew)
          terminateds.append(terminated)
          truncateds.append(truncated)
          infos = self._add_info(infos, info, i)
  
      self._raise_if_errors(successes)
      self._state = AsyncState.DEFAULT
  
      if not self.shared_memory:
          self.observations = concatenate(
              self.single_observation_space,
              observations_list,
              self.observations,
          )
  
      return (
          deepcopy(self.observations)
          if self.copy
          else self.observations,
          np.array(rewards),
          np.array(terminateds, dtype=np.bool_),
          np.array(truncateds, dtype=np.bool_),
          infos,
      )
  
imports: import multiprocessing
  import sys
  import time
  from copy import deepcopy
  from enum import Enum
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import gym
  from gym import logger
  from gym.core import ObsType
  from gym.error import AlreadyPendingCallError, ClosedEnvironmentError, CustomSpaceError, NoAsyncCallError
  from gym.vector.utils import CloudpickleWrapper, clear_mpi_env_vars, concatenate, create_empty_array, create_shared_memory, iterate, read_from_shared_memory, write_to_shared_memory
  from gym.vector.vector_env import VectorEnv
label_desc: Use image node_id 5 for calling the AsyncVectorEnv obj's underlying member method code with example usage: obj.step_wait(timeout) and returns: unknown,  np,  np,  np,  infos