class_docstr: The main OpenAI Gym class.
  
  It encapsulates an environment with arbitrary behind-the-scenes dynamics.
  An environment can be partially or fully observed.
  
  The main API methods that users of this class need to know are:
  
  - :meth:`step` - Takes a step in the environment using an action returning the next observation, reward,
    if the environment terminated and observation information.
  - :meth:`reset` - Resets the environment to an initial state, returning the initial observation and observation information.
  - :meth:`render` - Renders the environment observation with modes depending on the output
  - :meth:`close` - Closes the environment, important for rendering where pygame is imported
  
  And set the following attributes:
  
  - :attr:`action_space` - The Space object corresponding to valid actions
  - :attr:`observation_space` - The Space object corresponding to valid observations
  - :attr:`reward_range` - A tuple corresponding to the minimum and maximum possible rewards
  - :attr:`spec` - An environment spec that contains the information used to initialise the environment from `gym.make`
  - :attr:`metadata` - The metadata of the environment, i.e. render modes
  - :attr:`np_random` - The random number generator for the environment
  
  Note: a default reward range set to :math:`(-\infty,+\infty)` already exists. Set it if you want a narrower range.
class_docstr_tok: ["The","main","OpenAI","Gym","class",".","It","encapsulates","an","environment","with","arbitrary","behind-the-scenes","dynamics",".","An","environment","can","be","partially","or","fully","observed",".","The","main","API","methods","that","users","of","this","class","need","to","know","are",":","-",":","meth",":","`","step","`","-","Takes","a","step","in","the","environment","using","an","action","returning","the","next","observation",",","reward",",","if","the","environment","terminated","and","observation","information",".","-",":","meth",":","`","reset","`","-","Resets","the","environment","to","an","initial","state",",","returning","the","initial","observation","and","observation","information",".","-",":","meth",":","`","render","`","-","Renders","the","environment","observation","with","modes","depending","on","the","output","-",":","meth",":","`","close","`","-","Closes","the","environment",",","important","for","rendering","where","pygame","is","imported","And","set","the","following","attributes",":","-",":","attr",":","`","action_space","`","-","The","Space","object","corresponding","to","valid","actions","-",":","attr",":","`","observation_space","`","-","The","Space","object","corresponding","to","valid","observations","-",":","attr",":","`","reward_range","`","-","A","tuple","corresponding","to","the","minimum","and","maximum","possible","rewards","-",":","attr",":","`","spec","`","-","An","environment","spec","that","contains","the","information","used","to","initialise","the","environment","from","`","gym.make","`","-",":","attr",":","`","metadata","`","-","The","metadata","of","the","environment",",","i.e",".","render","modes","-",":","attr",":","`","np_random","`","-","The","random","number","generator","for","the","environment","Note",":","a","default","reward","range","set","to",":","math",":","`","(","-\\infty",",","+\\infty",")","`","already","exists",".","Set","it","if","you","want","a","narrower","range","."]
docstr: Run one timestep of the environment's dynamics.
  
  When end of episode is reached, you are responsible for calling :meth:`reset` to reset this environment's state.
  Accepts an action and returns either a tuple `(observation, reward, terminated, truncated, info)`.
  
  Args:
      action (ActType): an action provided by the agent
  
  Returns:
      observation (object): this will be an element of the environment's :attr:`observation_space`.
          This may, for instance, be a numpy array containing the positions and velocities of certain objects.
      reward (float): The amount of reward returned as a result of taking the action.
      terminated (bool): whether a `terminal state` (as defined under the MDP of the task) is reached.
          In this case further step() calls could return undefined results.
      truncated (bool): whether a truncation condition outside the scope of the MDP is satisfied.
          Typically a timelimit, but could also be used to indicate agent physically going out of bounds.
          Can be used to end the episode prematurely before a `terminal state` is reached.
      info (dictionary): `info` contains auxiliary diagnostic information (helpful for debugging, learning, and logging).
          This might, for instance, contain: metrics that describe the agent's performance state, variables that are
          hidden from observations, or individual reward terms that are combined to produce the total reward.
          It also can contain information that distinguishes truncation and termination, however this is deprecated in favour
          of returning two booleans, and will be removed in a future version.
  
      (deprecated)
      done (bool): A boolean value for if the episode has ended, in which case further :meth:`step` calls will return undefined results.
          A done signal may be emitted for different reasons: Maybe the task underlying the environment was solved successfully,
          a certain timelimit was exceeded, or the physics simulation has entered an invalid state.
docstr_tok: ["Run","one","timestep","of","the","environment","'s","dynamics",".","When","end","of","episode","is","reached",",","you","are","responsible","for","calling",":","meth",":","`","reset","`","to","reset","this","environment","'s","state",".","Accepts","an","action","and","returns","either","a","tuple","`","(","observation",",","reward",",","terminated",",","truncated",",","info",")","`",".","Args",":","action","(","ActType",")",":","an","action","provided","by","the","agent","Returns",":","observation","(","object",")",":","this","will","be","an","element","of","the","environment","'s",":","attr",":","`","observation_space","`",".","This","may",",","for","instance",",","be","a","numpy","array","containing","the","positions","and","velocities","of","certain","objects",".","reward","(","float",")",":","The","amount","of","reward","returned","as","a","result","of","taking","the","action",".","terminated","(","bool",")",":","whether","a","`","terminal","state","`","(","as","defined","under","the","MDP","of","the","task",")","is","reached",".","In","this","case","further","step","(",")","calls","could","return","undefined","results",".","truncated","(","bool",")",":","whether","a","truncation","condition","outside","the","scope","of","the","MDP","is","satisfied",".","Typically","a","timelimit",",","but","could","also","be","used","to","indicate","agent","physically","going","out","of","bounds",".","Can","be","used","to","end","the","episode","prematurely","before","a","`","terminal","state","`","is","reached",".","info","(","dictionary",")",":","`","info","`","contains","auxiliary","diagnostic","information","(","helpful","for","debugging",",","learning",",","and","logging",")",".","This","might",",","for","instance",",","contain",":","metrics","that","describe","the","agent","'s","performance","state",",","variables","that","are","hidden","from","observations",",","or","individual","reward","terms","that","are","combined","to","produce","the","total","reward",".","It","also","can","contain","information","that","distinguishes","truncation","and","termination",",","however","this","is","deprecated","in","favour","of","returning","two","booleans",",","and","will","be","removed","in","a","future","version",".","(","deprecated",")","done","(","bool",")",":","A","boolean","value","for","if","the","episode","has","ended",",","in","which","case","further",":","meth",":","`","step","`","calls","will","return","undefined","results",".","A","done","signal","may","be","emitted","for","different","reasons",":","Maybe","the","task","underlying","the","environment","was","solved","successfully",",","a","certain","timelimit","was","exceeded",",","or","the","physics","simulation","has","entered","an","invalid","state","."]
code: def step(
      self, action: ActType
  ) -> Tuple[ObsType, float, bool, bool, dict]:
      """Run one timestep of the environment's dynamics.
  
      When end of episode is reached, you are responsible for calling :meth:`reset` to reset this environment's state.
      Accepts an action and returns either a tuple `(observation, reward, terminated, truncated, info)`.
  
      Args:
          action (ActType): an action provided by the agent
  
      Returns:
          observation (object): this will be an element of the environment's :attr:`observation_space`.
              This may, for instance, be a numpy array containing the positions and velocities of certain objects.
          reward (float): The amount of reward returned as a result of taking the action.
          terminated (bool): whether a `terminal state` (as defined under the MDP of the task) is reached.
              In this case further step() calls could return undefined results.
          truncated (bool): whether a truncation condition outside the scope of the MDP is satisfied.
              Typically a timelimit, but could also be used to indicate agent physically going out of bounds.
              Can be used to end the episode prematurely before a `terminal state` is reached.
          info (dictionary): `info` contains auxiliary diagnostic information (helpful for debugging, learning, and logging).
              This might, for instance, contain: metrics that describe the agent's performance state, variables that are
              hidden from observations, or individual reward terms that are combined to produce the total reward.
              It also can contain information that distinguishes truncation and termination, however this is deprecated in favour
              of returning two booleans, and will be removed in a future version.
  
          (deprecated)
          done (bool): A boolean value for if the episode has ended, in which case further :meth:`step` calls will return undefined results.
              A done signal may be emitted for different reasons: Maybe the task underlying the environment was solved successfully,
              a certain timelimit was exceeded, or the physics simulation has entered an invalid state.
      """
      raise NotImplementedError
  
imports: import sys
  from typing import TYPE_CHECKING, Any, Dict, Generic, List, Optional, SupportsFloat, Tuple, TypeVar, Union
  import numpy
  from gym import spaces
  from gym.logger import warn
  from gym.utils import seeding
label_desc: Use image node_id 3 for calling the Env obj's underlying member method code with example usage: obj.step(action) without return types