class_docstr: Env presenting ConvertedEnvironment as multiple single player streams.
class_docstr_tok: ["Env","presenting","ConvertedEnvironment","as","multiple","single","player","streams","."]
code: def __init__(self, underlying_env: ConvertedEnvironment):
      if not 1 <= underlying_env.num_players() <= 2:
          raise ValueError(
              f"Unsupported number of players: {underlying_env.num_players()}"
          )
  
      self._underlying_env = underlying_env
      self._num_players = underlying_env.num_players()
      self._barrier = threading.Barrier(parties=2)
      self._lock = threading.Lock()
      self._timestep = None
      self._actions = [None] * self._num_players
      self._closed = [False] * self._num_players
      self._closed_lock = threading.Lock()
  
imports: import functools
  import threading
  from typing import Any, Mapping, NamedTuple, Sequence
  import dm_env
  import numpy
  from pysc2.env.converter import converter
  from pysc2.env.converter.proto import converter_pb2
  from pysc2.lib import actions
  import tree
  import typing_extensions
  from s2clientprotocol import common_pb2
  from s2clientprotocol import raw_pb2
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 1 to create a new _StreamedEnvironment object  with example: obj = _StreamedEnvironment(underlying_env)