code: def _check_returned_values(
      env: gym.Env,
      observation_space: spaces.Space,
      action_space: spaces.Space,
  ) -> None:
      """
      Check the returned values by the env when calling `.reset()` or `.step()` methods.
      """
      # because env inherits from gym.Env, we assume that `reset()` and `step()` methods exists
      obs = env.reset()
  
      _check_obs(obs, observation_space, "reset")
  
      # Sample a random action
      action = action_space.sample()
      data = env.step(action)
  
      assert (
          len(data) == 4
      ), "The `step()` method must return four values: obs, reward, done, info"
  
      # Unpack
      obs, reward, done, info = data
  
      _check_obs(obs, observation_space, "step")
  
      # We also allow int because the reward will be cast to float
      assert isinstance(
          reward, (float, int)
      ), "The reward returned by `step()` must be a float"
      assert isinstance(
          done, bool
      ), "The `done` signal must be a boolean"
      assert isinstance(
          info, dict
      ), "The `info` returned by `step()` must be a python dictionary"
  
      if isinstance(env, gym.GoalEnv):
          # For a GoalEnv, the keys are checked at reset
          assert reward == env.compute_reward(
              obs["achieved_goal"], obs["desired_goal"], info
          )
  
file_path: stable-baselines/stable_baselines/common/env_checker.py
imports: import warnings
  from typing import Union
  import gym
  from gym import spaces
  import numpy
  from stable_baselines.common.vec_env import DummyVecEnv, VecCheckNan
label_desc: Use image node_id 6 for calling a global function with example usage: _check_returned_values(env, observation_space, action_space) without return types