class_docstr: This wrapper will issue a `truncated` signal if a maximum number of timesteps is exceeded.
  
  If a truncation is not defined inside the environment itself, this is the only place that the truncation signal is issued.
  Critically, this is different from the `terminated` signal that originates from the underlying environment as part of the MDP.
  
  Example:
     >>> from gym.envs.classic_control import CartPoleEnv
     >>> from gym.wrappers import TimeLimit
     >>> env = CartPoleEnv()
     >>> env = TimeLimit(env, max_episode_steps=1000)
docstr: Initializes the :class:`TimeLimit` wrapper with an environment and the number of steps after which truncation will occur.
  
  Args:
      env: The environment to apply the wrapper
      max_episode_steps: An optional max episode steps (if ``Ǹone``, ``env.spec.max_episode_steps`` is used)
docstr_tok: ["Initializes","the",":","class",":","`","TimeLimit","`","wrapper","with","an","environment","and","the","number","of","steps","after","which","truncation","will","occur",".","Args",":","env",":","The","environment","to","apply","the","wrapper","max_episode_steps",":","An","optional","max","episode","steps","(","if","``","\u01f8one","``",",","``","env.spec.max_episode_steps","``","is","used",")"]
code: def __init__(
      self,
      env: gym.Env,
      max_episode_steps: Optional[int] = None,
  ):
      """Initializes the :class:`TimeLimit` wrapper with an environment and the number of steps after which truncation will occur.
  
      Args:
          env: The environment to apply the wrapper
          max_episode_steps: An optional max episode steps (if ``Ǹone``, ``env.spec.max_episode_steps`` is used)
      """
      super().__init__(env)
      if max_episode_steps is None and self.env.spec is not None:
          max_episode_steps = env.spec.max_episode_steps
      if self.env.spec is not None:
          self.env.spec.max_episode_steps = max_episode_steps
      self._max_episode_steps = max_episode_steps
      self._elapsed_steps = None
  
imports: from typing import Optional
  import gym
label_desc: Use image node_id 1 to create a new TimeLimit object from inherited base classes: gym with example: obj = TimeLimit(env, max_episode_steps)