mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-28 09:17:18 +00:00
Pre commit autoupdate (#1082)
This commit is contained in:
1
.github/workflows/pre-commit.yml
vendored
1
.github/workflows/pre-commit.yml
vendored
@@ -17,5 +17,4 @@ jobs:
|
|||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
- run: python -m pip install pre-commit
|
- run: python -m pip install pre-commit
|
||||||
- run: python -m pre_commit --version
|
- run: python -m pre_commit --version
|
||||||
- run: python -m pre_commit install
|
|
||||||
- run: python -m pre_commit run --all-files
|
- run: python -m pre_commit run --all-files
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
# See https://pre-commit.com/hooks.html for more hooks
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.5.0
|
rev: v4.6.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-symlinks
|
- id: check-symlinks
|
||||||
- id: destroyed-symlinks
|
- id: destroyed-symlinks
|
||||||
@@ -18,7 +18,7 @@ repos:
|
|||||||
- id: detect-private-key
|
- id: detect-private-key
|
||||||
- id: debug-statements
|
- id: debug-statements
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: v2.2.6
|
rev: v2.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
args:
|
args:
|
||||||
@@ -35,7 +35,7 @@ repos:
|
|||||||
- --show-source
|
- --show-source
|
||||||
- --statistics
|
- --statistics
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.15.0
|
rev: v3.16.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: ["--py38-plus"]
|
args: ["--py38-plus"]
|
||||||
@@ -44,7 +44,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
- repo: https://github.com/python/black
|
- repo: https://github.com/python/black
|
||||||
rev: 23.12.1
|
rev: 24.4.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/pycqa/pydocstyle
|
- repo: https://github.com/pycqa/pydocstyle
|
||||||
|
@@ -41,8 +41,9 @@ Instructions for installing the MuJoCo engine can be found on their [website](ht
|
|||||||
For MuJoCo `v3` environments and older the `mujoco-py` framework is required (`pip install gymnasium[mujoco-py]`) which can be found in the [GitHub repository](https://github.com/openai/mujoco-py/tree/master/mujoco_py).
|
For MuJoCo `v3` environments and older the `mujoco-py` framework is required (`pip install gymnasium[mujoco-py]`) which can be found in the [GitHub repository](https://github.com/openai/mujoco-py/tree/master/mujoco_py).
|
||||||
|
|
||||||
There are eleven MuJoCo environments (in roughly increasing complexity):
|
There are eleven MuJoCo environments (in roughly increasing complexity):
|
||||||
|
|
||||||
| Robot | Short Description |
|
| Robot | Short Description |
|
||||||
| ---------------------- | -------------------------------------------------------------------- |
|
|------------------------|----------------------------------------------------------------------|
|
||||||
| **CartPoles** | |
|
| **CartPoles** | |
|
||||||
| InvertedPendulum | MuJoCo version of the CartPole Environment (with Continuous actions) |
|
| InvertedPendulum | MuJoCo version of the CartPole Environment (with Continuous actions) |
|
||||||
| InvertedDoublePendulum | 2 Pole variation of the CartPole Environment |
|
| InvertedDoublePendulum | 2 Pole variation of the CartPole Environment |
|
||||||
@@ -76,7 +77,7 @@ Environments can be configured by changing the `xml_file` argument and/or by twe
|
|||||||
Gymnasium includes the following versions of the environments:
|
Gymnasium includes the following versions of the environments:
|
||||||
|
|
||||||
| Version | Simulator | Notes |
|
| Version | Simulator | Notes |
|
||||||
| ------- | --------------- | ------------------------------------------------ |
|
|---------|-----------------|--------------------------------------------------------|
|
||||||
| `v5` | `mujoco=>2.3.3` | Recommended (most features, the least bugs) |
|
| `v5` | `mujoco=>2.3.3` | Recommended (most features, the least bugs) |
|
||||||
| `v4` | `mujoco=>2.1.3` | Maintained for reproducibility |
|
| `v4` | `mujoco=>2.1.3` | Maintained for reproducibility |
|
||||||
| `v3` | `mujoco-py` | Deprecated, Kept for reproducibility (limited support) |
|
| `v3` | `mujoco-py` | Deprecated, Kept for reproducibility (limited support) |
|
||||||
@@ -104,17 +105,15 @@ env = gymnasium.make("Ant-v5", render_mode="rgb_array", width=1280, height=720)
|
|||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default | Description |
|
| Parameter | Type | Default | Description |
|
||||||
| --------------------------- | ------------- | ------------ | ----------------------------------------- |
|
|-------------------------|-------------------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `width` | **int** | `480` | The width of the render window |
|
| `width` | **int** | `480` | The width of the render window |
|
||||||
| `height` | **int** | `480` | The height of the render window |
|
| `height` | **int** | `480` | The height of the render window |
|
||||||
| `camera_id` | **int \| None** | `None` | The camera ID used for the render window |
|
| `camera_id` | **int \| None** | `None` | The camera ID used for the render window |
|
||||||
| `camera_name` |**str \| None** | `None` | The name of the camera used for the render window (mutally exclusive option with `camera_id`) |
|
| `camera_name` | **str \| None** | `None` | The name of the camera used for the render window (mutually exclusive option with `camera_id`) |
|
||||||
| `default_camera_config` | **dict[str, float \| int] \| None** | `None` | The [mjvCamera](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html#mjvcamera) properties |
|
| `default_camera_config` | **dict[str, float \| int] \| None** | `None` | The [mjvCamera](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html#mjvcamera) properties |
|
||||||
| `max_geom` | **int** | `1000` | Max number of geometrical objects to render (useful for 3rd-party environments) |
|
| `max_geom` | **int** | `1000` | Max number of geometrical objects to render (useful for 3rd-party environments) |
|
||||||
| `visual_options` | **Dict[int, bool]** | `{}` | A dictionary with [mjVisual](https://mujoco.readthedocs.io/en/stable/overview.html#mjvisual) flags and value pairs, example `{mujoco.mjtVisFlag.mjVIS_CONTACTPOINT: True, mujoco.mjtVisFlag.mjVIS_CONTACTFORCE: True}` (show contact points and forces). |
|
| `visual_options` | **Dict[int, bool]** | `{}` | A dictionary with [mjVisual](https://mujoco.readthedocs.io/en/stable/overview.html#mjvisual) flags and value pairs, example `{mujoco.mjtVisFlag.mjVIS_CONTACTPOINT: True, mujoco.mjtVisFlag.mjVIS_CONTACTFORCE: True}` (show contact points and forces). |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
## Custom Models
|
## Custom Models
|
||||||
For more complex locomotion robot environments you can use third party models with the environments.
|
For more complex locomotion robot environments you can use third party models with the environments.
|
||||||
|
@@ -3,6 +3,7 @@ Training A2C with Vector Envs and Domain Randomization
|
|||||||
======================================================
|
======================================================
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# %%
|
# %%
|
||||||
# Notice
|
# Notice
|
||||||
# ------
|
# ------
|
||||||
|
@@ -4,7 +4,6 @@ Frozenlake benchmark
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# %%
|
# %%
|
||||||
# In this post we'll compare a bunch of different map sizes on the
|
# In this post we'll compare a bunch of different map sizes on the
|
||||||
# `FrozenLake <https://gymnasium.farama.org/environments/toy_text/frozen_lake/>`__
|
# `FrozenLake <https://gymnasium.farama.org/environments/toy_text/frozen_lake/>`__
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Root `__init__` of the gymnasium module setting the `__all__` of gymnasium modules."""
|
"""Root `__init__` of the gymnasium module setting the `__all__` of gymnasium modules."""
|
||||||
|
|
||||||
# isort: skip_file
|
# isort: skip_file
|
||||||
|
|
||||||
from gymnasium.core import (
|
from gymnasium.core import (
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Core API for Environment, Wrapper, ActionWrapper, RewardWrapper and ObservationWrapper."""
|
"""Core API for Environment, Wrapper, ActionWrapper, RewardWrapper and ObservationWrapper."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Registers the internal gym envs then loads the env plugins for module using the entry point."""
|
"""Registers the internal gym envs then loads the env plugins for module using the entry point."""
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from gymnasium.envs.registration import make, pprint_registry, register, registry, spec
|
from gymnasium.envs.registration import make, pprint_registry, register, registry, spec
|
||||||
|
@@ -250,7 +250,7 @@ class BipedalWalker(gym.Env, EzPickle):
|
|||||||
# 0.3 * vel.y * (VIEWPORT_H / SCALE) / FPS,
|
# 0.3 * vel.y * (VIEWPORT_H / SCALE) / FPS,
|
||||||
# self.joints[
|
# self.joints[
|
||||||
# 0
|
# 0
|
||||||
# ].angle, # This will give 1.1 on high up, but it's still OK (and there should be spikes on hiting the ground, that's normal too)
|
# ].angle, # This will give 1.1 on high up, but it's still OK (and there should be spikes on hitting the ground, that's normal too)
|
||||||
# self.joints[0].speed / SPEED_HIP,
|
# self.joints[0].speed / SPEED_HIP,
|
||||||
# self.joints[1].angle + 1.0,
|
# self.joints[1].angle + 1.0,
|
||||||
# self.joints[1].speed / SPEED_KNEE,
|
# self.joints[1].speed / SPEED_KNEE,
|
||||||
@@ -569,7 +569,7 @@ class BipedalWalker(gym.Env, EzPickle):
|
|||||||
0.3 * vel.x * (VIEWPORT_W / SCALE) / FPS, # Normalized to get -1..1 range
|
0.3 * vel.x * (VIEWPORT_W / SCALE) / FPS, # Normalized to get -1..1 range
|
||||||
0.3 * vel.y * (VIEWPORT_H / SCALE) / FPS,
|
0.3 * vel.y * (VIEWPORT_H / SCALE) / FPS,
|
||||||
self.joints[0].angle,
|
self.joints[0].angle,
|
||||||
# This will give 1.1 on high up, but it's still OK (and there should be spikes on hiting the ground, that's normal too)
|
# This will give 1.1 on high up, but it's still OK (and there should be spikes on hitting the ground, that's normal too)
|
||||||
self.joints[0].speed / SPEED_HIP,
|
self.joints[0].speed / SPEED_HIP,
|
||||||
self.joints[1].angle + 1.0,
|
self.joints[1].angle + 1.0,
|
||||||
self.joints[1].speed / SPEED_KNEE,
|
self.joints[1].speed / SPEED_KNEE,
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""classic Acrobot task"""
|
"""classic Acrobot task"""
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -256,12 +257,7 @@ class AcrobotEnv(Env):
|
|||||||
theta2 = s[1]
|
theta2 = s[1]
|
||||||
dtheta1 = s[2]
|
dtheta1 = s[2]
|
||||||
dtheta2 = s[3]
|
dtheta2 = s[3]
|
||||||
d1 = (
|
d1 = m1 * lc1**2 + m2 * (l1**2 + lc2**2 + 2 * l1 * lc2 * cos(theta2)) + I1 + I2
|
||||||
m1 * lc1**2
|
|
||||||
+ m2 * (l1**2 + lc2**2 + 2 * l1 * lc2 * cos(theta2))
|
|
||||||
+ I1
|
|
||||||
+ I2
|
|
||||||
)
|
|
||||||
d2 = m2 * (lc2**2 + l1 * lc2 * cos(theta2)) + I2
|
d2 = m2 * (lc2**2 + l1 * lc2 * cos(theta2)) + I2
|
||||||
phi2 = m2 * lc2 * g * cos(theta1 + theta2 - pi / 2.0)
|
phi2 = m2 * lc2 * g * cos(theta1 + theta2 - pi / 2.0)
|
||||||
phi1 = (
|
phi1 = (
|
||||||
|
@@ -3,6 +3,7 @@ Classic cart-pole system implemented by Rich Sutton et al.
|
|||||||
Copied from http://incompleteideas.net/sutton/book/code/pole.c
|
Copied from http://incompleteideas.net/sutton/book/code/pole.c
|
||||||
permalink: https://perma.cc/C9ZM-652R
|
permalink: https://perma.cc/C9ZM-652R
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from typing import Optional, Tuple, Union
|
from typing import Optional, Tuple, Union
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
http://incompleteideas.net/MountainCar/MountainCar1.cp
|
http://incompleteideas.net/MountainCar/MountainCar1.cp
|
||||||
permalink: https://perma.cc/6Z2N-PFWC
|
permalink: https://perma.cc/6Z2N-PFWC
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Functional to Environment compatibility."""
|
"""Functional to Environment compatibility."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
"""Module for 2d physics environments with functional and environment implementations."""
|
"""Module for 2d physics environments with functional and environment implementations."""
|
||||||
|
|
||||||
from gymnasium.envs.phys2d.cartpole import CartPoleFunctional, CartPoleJaxEnv
|
from gymnasium.envs.phys2d.cartpole import CartPoleFunctional, CartPoleJaxEnv
|
||||||
from gymnasium.envs.phys2d.pendulum import PendulumFunctional, PendulumJaxEnv
|
from gymnasium.envs.phys2d.pendulum import PendulumFunctional, PendulumJaxEnv
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a Jax-accelerated cartpole environment."""
|
"""Implementation of a Jax-accelerated cartpole environment."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Tuple
|
from typing import Any, Tuple
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a Jax-accelerated pendulum environment."""
|
"""Implementation of a Jax-accelerated pendulum environment."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Functions for registering environments within gymnasium using public functions ``make``, ``register`` and ``spec``."""
|
"""Functions for registering environments within gymnasium using public functions ``make``, ``register`` and ``spec``."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
@@ -52,15 +53,13 @@ __all__ = [
|
|||||||
class EnvCreator(Protocol):
|
class EnvCreator(Protocol):
|
||||||
"""Function type expected for an environment."""
|
"""Function type expected for an environment."""
|
||||||
|
|
||||||
def __call__(self, **kwargs: Any) -> Env:
|
def __call__(self, **kwargs: Any) -> Env: ...
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
class VectorEnvCreator(Protocol):
|
class VectorEnvCreator(Protocol):
|
||||||
"""Function type expected for an environment."""
|
"""Function type expected for an environment."""
|
||||||
|
|
||||||
def __call__(self, **kwargs: Any) -> gym.vector.VectorEnv:
|
def __call__(self, **kwargs: Any) -> gym.vector.VectorEnv: ...
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
"""This module provides a Blackjack functional environment and Gymnasium environment wrapper BlackJackJaxEnv."""
|
"""This module provides a Blackjack functional environment and Gymnasium environment wrapper BlackJackJaxEnv."""
|
||||||
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
from typing import NamedTuple, Optional, Tuple, Union
|
from typing import NamedTuple, Optional, Tuple, Union
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
"""This module provides a CliffWalking functional environment and Gymnasium environment wrapper CliffWalkingJaxEnv."""
|
"""This module provides a CliffWalking functional environment and Gymnasium environment wrapper CliffWalkingJaxEnv."""
|
||||||
|
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
|
@@ -253,12 +253,12 @@ class FrozenLakeEnv(Env):
|
|||||||
return (row, col)
|
return (row, col)
|
||||||
|
|
||||||
def update_probability_matrix(row, col, action):
|
def update_probability_matrix(row, col, action):
|
||||||
newrow, newcol = inc(row, col, action)
|
new_row, new_col = inc(row, col, action)
|
||||||
newstate = to_s(newrow, newcol)
|
new_state = to_s(new_row, new_col)
|
||||||
newletter = desc[newrow, newcol]
|
new_letter = desc[new_row, new_col]
|
||||||
terminated = bytes(newletter) in b"GH"
|
terminated = bytes(new_letter) in b"GH"
|
||||||
reward = float(newletter == b"G")
|
reward = float(new_letter == b"G")
|
||||||
return newstate, reward, terminated
|
return new_state, reward, terminated
|
||||||
|
|
||||||
for row in range(nrow):
|
for row in range(nrow):
|
||||||
for col in range(ncol):
|
for col in range(ncol):
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Base class and definitions for an alternative, functional backend for gym envs, particularly suitable for hardware accelerated and otherwise transformed environments."""
|
"""Base class and definitions for an alternative, functional backend for gym envs, particularly suitable for hardware accelerated and otherwise transformed environments."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Callable, Generic, TypeVar
|
from typing import Any, Callable, Generic, TypeVar
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Set of functions for logging messages."""
|
"""Set of functions for logging messages."""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Optional, Type
|
from typing import Optional, Type
|
||||||
|
@@ -10,6 +10,7 @@ are vectors in the two-dimensional unit cube, the environment code may contain t
|
|||||||
|
|
||||||
All spaces inherit from the :class:`Space` superclass.
|
All spaces inherit from the :class:`Space` superclass.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from gymnasium.spaces.box import Box
|
from gymnasium.spaces.box import Box
|
||||||
from gymnasium.spaces.dict import Dict
|
from gymnasium.spaces.dict import Dict
|
||||||
from gymnasium.spaces.discrete import Discrete
|
from gymnasium.spaces.discrete import Discrete
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents closed boxes in euclidean space."""
|
"""Implementation of a space that represents closed boxes in euclidean space."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Iterable, Mapping, Sequence, SupportsFloat
|
from typing import Any, Iterable, Mapping, Sequence, SupportsFloat
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents the cartesian product of other spaces as a dictionary."""
|
"""Implementation of a space that represents the cartesian product of other spaces as a dictionary."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import collections.abc
|
import collections.abc
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space consisting of finitely many elements."""
|
"""Implementation of a space consisting of finitely many elements."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Iterable, Mapping, Sequence
|
from typing import Any, Iterable, Mapping, Sequence
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents graph information where nodes and edges can be represented with euclidean space."""
|
"""Implementation of a space that represents graph information where nodes and edges can be represented with euclidean space."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, NamedTuple, Sequence
|
from typing import Any, NamedTuple, Sequence
|
||||||
@@ -176,8 +177,7 @@ class Graph(Space[GraphInstance]):
|
|||||||
|
|
||||||
def sample(
|
def sample(
|
||||||
self,
|
self,
|
||||||
mask: None
|
mask: None | (
|
||||||
| (
|
|
||||||
tuple[
|
tuple[
|
||||||
NDArray[Any] | tuple[Any, ...] | None,
|
NDArray[Any] | tuple[Any, ...] | None,
|
||||||
NDArray[Any] | tuple[Any, ...] | None,
|
NDArray[Any] | tuple[Any, ...] | None,
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that consists of binary np.ndarrays of a fixed shape."""
|
"""Implementation of a space that consists of binary np.ndarrays of a fixed shape."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Sequence
|
from typing import Any, Sequence
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents the cartesian product of `Discrete` spaces."""
|
"""Implementation of a space that represents the cartesian product of `Discrete` spaces."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Iterable, Mapping, Sequence
|
from typing import Any, Iterable, Mapping, Sequence
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents the cartesian product of other spaces."""
|
"""Implementation of a space that represents the cartesian product of other spaces."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents finite-length sequences."""
|
"""Implementation of a space that represents finite-length sequences."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
@@ -100,8 +101,7 @@ class Sequence(Space[Union[typing.Tuple[Any, ...], Any]]):
|
|||||||
|
|
||||||
def sample(
|
def sample(
|
||||||
self,
|
self,
|
||||||
mask: None
|
mask: None | (
|
||||||
| (
|
|
||||||
tuple[
|
tuple[
|
||||||
None | np.integer | NDArray[np.integer],
|
None | np.integer | NDArray[np.integer],
|
||||||
Any,
|
Any,
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of the `Space` metaclass."""
|
"""Implementation of the `Space` metaclass."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Generic, Iterable, Mapping, Sequence, TypeVar
|
from typing import Any, Generic, Iterable, Mapping, Sequence, TypeVar
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents textual strings."""
|
"""Implementation of a space that represents textual strings."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a space that represents the cartesian product of other spaces."""
|
"""Implementation of a space that represents the cartesian product of other spaces."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
These functions mostly take care of flattening and unflattening elements of spaces
|
These functions mostly take care of flattening and unflattening elements of spaces
|
||||||
to facilitate their usage in learning code.
|
to facilitate their usage in learning code.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import operator as op
|
import operator as op
|
||||||
@@ -538,9 +539,9 @@ def _flatten_space_dict(space: Dict) -> Box | Dict:
|
|||||||
def _flatten_space_graph(space: Graph) -> Graph:
|
def _flatten_space_graph(space: Graph) -> Graph:
|
||||||
return Graph(
|
return Graph(
|
||||||
node_space=flatten_space(space.node_space),
|
node_space=flatten_space(space.node_space),
|
||||||
edge_space=flatten_space(space.edge_space)
|
edge_space=(
|
||||||
if space.edge_space is not None
|
flatten_space(space.edge_space) if space.edge_space is not None else None
|
||||||
else None,
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Class for pickling and unpickling objects via their constructor arguments."""
|
"""Class for pickling and unpickling objects via their constructor arguments."""
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""A set of functions for passively checking environment implementations."""
|
"""A set of functions for passively checking environment implementations."""
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Utilities of visualising an environment."""
|
"""Utilities of visualising an environment."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Allows attributes passed to `RecordConstructorArgs` to be saved. This is used by the `Wrapper.spec` to know the constructor arguments of implemented wrappers."""
|
"""Allows attributes passed to `RecordConstructorArgs` to be saved. This is used by the `Wrapper.spec` to know the constructor arguments of implemented wrappers."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Utility functions to save rendering videos."""
|
"""Utility functions to save rendering videos."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Set of random number generator functions: seeding, generator, hashing seeds."""
|
"""Set of random number generator functions: seeding, generator, hashing seeds."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Contains methods for step compatibility, from old-to-new and new-to-old API."""
|
"""Contains methods for step compatibility, from old-to-new and new-to-old API."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import SupportsFloat, Tuple, Union
|
from typing import SupportsFloat, Tuple, Union
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Experimental vector env API."""
|
"""Experimental vector env API."""
|
||||||
|
|
||||||
from gymnasium.vector import utils
|
from gymnasium.vector import utils
|
||||||
from gymnasium.vector.async_vector_env import AsyncVectorEnv
|
from gymnasium.vector.async_vector_env import AsyncVectorEnv
|
||||||
from gymnasium.vector.sync_vector_env import SyncVectorEnv
|
from gymnasium.vector.sync_vector_env import SyncVectorEnv
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""An async vector environment."""
|
"""An async vector environment."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
@@ -90,10 +91,12 @@ class AsyncVectorEnv(VectorEnv):
|
|||||||
copy: bool = True,
|
copy: bool = True,
|
||||||
context: str | None = None,
|
context: str | None = None,
|
||||||
daemon: bool = True,
|
daemon: bool = True,
|
||||||
worker: Callable[
|
worker: (
|
||||||
|
Callable[
|
||||||
[int, Callable[[], Env], Connection, Connection, bool, Queue], None
|
[int, Callable[[], Env], Connection, Connection, bool, Queue], None
|
||||||
]
|
]
|
||||||
| None = None,
|
| None
|
||||||
|
) = None,
|
||||||
):
|
):
|
||||||
"""Vectorized environment that runs multiple environments in parallel.
|
"""Vectorized environment that runs multiple environments in parallel.
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of a synchronous (for loop) vectorization method of any environment."""
|
"""Implementation of a synchronous (for loop) vectorization method of any environment."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Miscellaneous utilities."""
|
"""Miscellaneous utilities."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Utility functions for vector environments to share memory between processes."""
|
"""Utility functions for vector environments to share memory between processes."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
- ``Iterate``: Iterate over the elements of a (batched) space and items.
|
- ``Iterate``: Iterate over the elements of a (batched) space and items.
|
||||||
- ``create_empty_array``: Create an empty (possibly nested) (normally numpy-based) array, used in conjunction with ``concatenate(..., out=array)``
|
- ``create_empty_array``: Create an empty (possibly nested) (normally numpy-based) array, used in conjunction with ``concatenate(..., out=array)``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Base class for vectorized environments."""
|
"""Base class for vectorized environments."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
||||||
@@ -95,8 +96,9 @@ class VectorEnv(Generic[ObsType, ActType, ArrayType]):
|
|||||||
|
|
||||||
To avoid having to wait for all sub-environments to terminated before resetting, implementations will autoreset
|
To avoid having to wait for all sub-environments to terminated before resetting, implementations will autoreset
|
||||||
sub-environments on episode end (`terminated or truncated is True`). As a result, when adding observations
|
sub-environments on episode end (`terminated or truncated is True`). As a result, when adding observations
|
||||||
to a replay buffer, this requires a knowning where the observation (and info) for each sub-environment are the first
|
to a replay buffer, this requires knowing when an observation (and info) for each sub-environment are the first
|
||||||
observation from an autoreset. We recommend using an additional variable to store this information.
|
observation from an autoreset. We recommend using an additional variable to store this information such as
|
||||||
|
``has_autoreset = np.logical_or(terminated, truncated)``.
|
||||||
|
|
||||||
The Vector Environments have the additional attributes for users to understand the implementation
|
The Vector Environments have the additional attributes for users to understand the implementation
|
||||||
|
|
||||||
|
@@ -45,6 +45,7 @@ If you need a wrapper to do more complicated tasks, you can inherit from the :cl
|
|||||||
|
|
||||||
If you'd like to implement your own custom wrapper, check out `the corresponding tutorial <../../tutorials/implementing_custom_wrappers>`_.
|
If you'd like to implement your own custom wrapper, check out `the corresponding tutorial <../../tutorials/implementing_custom_wrappers>`_.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pyright: reportUnsupportedDunderAll=false
|
# pyright: reportUnsupportedDunderAll=false
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Implementation of Atari 2600 Preprocessing following the guidelines of Machado et al., 2018."""
|
"""Implementation of Atari 2600 Preprocessing following the guidelines of Machado et al., 2018."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, SupportsFloat
|
from typing import Any, SupportsFloat
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
* ``OrderEnforcing`` - Enforces the order of function calls to environments
|
* ``OrderEnforcing`` - Enforces the order of function calls to environments
|
||||||
* ``RecordEpisodeStatistics`` - Records the episode statistics
|
* ``RecordEpisodeStatistics`` - Records the episode statistics
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Helper functions and wrapper class for converting between numpy and Jax."""
|
"""Helper functions and wrapper class for converting between numpy and Jax."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Helper functions and wrapper class for converting between PyTorch and NumPy."""
|
"""Helper functions and wrapper class for converting between PyTorch and NumPy."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
* ``RecordVideo`` - Records a video of the environments
|
* ``RecordVideo`` - Records a video of the environments
|
||||||
* ``HumanRendering`` - Provides human rendering of environments with ``"rgb_array"``
|
* ``HumanRendering`` - Provides human rendering of environments with ``"rgb_array"``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""``StickyAction`` wrapper - There is a probability that the action is taken again."""
|
"""``StickyAction`` wrapper - There is a probability that the action is taken again."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
* ``NormalizeObservation`` - Normalized the observations to have unit variance with a moving mean
|
* ``NormalizeObservation`` - Normalized the observations to have unit variance with a moving mean
|
||||||
* ``MaxAndSkipObservation`` - Return only every ``skip``-th frame (frameskipping) and return the max between the two last frames.
|
* ``MaxAndSkipObservation`` - Return only every ``skip``-th frame (frameskipping) and return the max between the two last frames.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
* ``NormalizeReward`` - Normalizes the rewards to a mean and standard deviation
|
* ``NormalizeReward`` - Normalizes the rewards to a mean and standard deviation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, SupportsFloat
|
from typing import Any, SupportsFloat
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
* ``ClipAction`` - Clips the action within a bounds
|
* ``ClipAction`` - Clips the action within a bounds
|
||||||
* ``RescaleAction`` - Rescales the action within a minimum and maximum actions
|
* ``RescaleAction`` - Rescales the action within a minimum and maximum actions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
* ``DtypeObservation`` - Convert an observation to a dtype
|
* ``DtypeObservation`` - Convert an observation to a dtype
|
||||||
* ``RenderObservation`` - Allows the observation to the rendered frame
|
* ``RenderObservation`` - Allows the observation to the rendered frame
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Callable, Final, Sequence
|
from typing import Any, Callable, Final, Sequence
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
* ``TransformReward`` - Transforms the reward by a function
|
* ``TransformReward`` - Transforms the reward by a function
|
||||||
* ``ClipReward`` - Clips the reward between a minimum and maximum value
|
* ``ClipReward`` - Clips the reward between a minimum and maximum value
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Callable, SupportsFloat
|
from typing import Callable, SupportsFloat
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Utility functions for the wrappers."""
|
"""Utility functions for the wrappers."""
|
||||||
|
|
||||||
from functools import singledispatch
|
from functools import singledispatch
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Wrappers for vector environments."""
|
"""Wrappers for vector environments."""
|
||||||
|
|
||||||
# pyright: reportUnsupportedDunderAll=false
|
# pyright: reportUnsupportedDunderAll=false
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Wrapper that tracks the cumulative rewards and episode lengths."""
|
"""Wrapper that tracks the cumulative rewards and episode lengths."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Wrapper that converts the info format for vec envs into the list format."""
|
"""Wrapper that converts the info format for vec envs into the list format."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Vector wrapper for converting between NumPy and Jax."""
|
"""Vector wrapper for converting between NumPy and Jax."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Vector wrapper class for converting between PyTorch and Jax."""
|
"""Vector wrapper class for converting between PyTorch and Jax."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Wrapper for converting NumPy environments to PyTorch."""
|
"""Wrapper for converting NumPy environments to PyTorch."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""File for rendering of vector-based environments."""
|
"""File for rendering of vector-based environments."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
* ``NormalizeObservation`` - Normalize the observations
|
* ``NormalizeObservation`` - Normalize the observations
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
* ``NormalizeReward`` - Normalizes the rewards to a mean and standard deviation
|
* ``NormalizeReward`` - Normalizes the rewards to a mean and standard deviation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, SupportsFloat
|
from typing import Any, SupportsFloat
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Vectorizes action wrappers to work for `VectorEnv`."""
|
"""Vectorizes action wrappers to work for `VectorEnv`."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Vectorizes observation wrappers to works for `VectorEnv`."""
|
"""Vectorizes observation wrappers to works for `VectorEnv`."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Vectorizes reward function to work with `VectorEnv`."""
|
"""Vectorizes reward function to work with `VectorEnv`."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test for the `EnvSpec`, in particular, a full integration with `EnvSpec`."""
|
"""Test for the `EnvSpec`, in particular, a full integration with `EnvSpec`."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests that `gym.make` works as expected."""
|
"""Tests that `gym.make` works as expected."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Testing of the `gym.make_vec` function."""
|
"""Testing of the `gym.make_vec` function."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests that `gymnasium.register` works as expected."""
|
"""Tests that `gymnasium.register` works as expected."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""This utility file contains an environment that is registered upon loading the file."""
|
"""This utility file contains an environment that is registered upon loading the file."""
|
||||||
|
|
||||||
import gymnasium as gym
|
import gymnasium as gym
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Finds all the specs that we can test with"""
|
"""Finds all the specs that we can test with"""
|
||||||
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import gymnasium as gym
|
import gymnasium as gym
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests the functional api."""
|
"""Tests the functional api."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
"""Tests for Jax Blackjack functional env."""
|
"""Tests for Jax Blackjack functional env."""
|
||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
"""Tests for Jax cliffwalking functional env."""
|
"""Tests for Jax cliffwalking functional env."""
|
||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Checks that the core Gymnasium API is implemented as expected."""
|
"""Checks that the core Gymnasium API is implemented as expected."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Provides a generic testing environment for use in tests with custom reset, step and render functions."""
|
"""Provides a generic testing environment for use in tests with custom reset, step and render functions."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import types
|
import types
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests that the `env_checker` runs as expects and all errors are possible."""
|
"""Tests that the `env_checker` runs as expects and all errors are possible."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Callable, Tuple, Union
|
from typing import Callable, Tuple, Union
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test the vector environment information."""
|
"""Test the vector environment information."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, SupportsFloat
|
from typing import Any, SupportsFloat
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Tests the vector wrappers work as expected."""
|
"""Tests the vector wrappers work as expected."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Testing utilitys for `gymnasium.vector`."""
|
"""Testing utilitys for `gymnasium.vector`."""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Utility functions for testing the vector utility functions."""
|
"""Utility functions for testing the vector utility functions."""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for RenderObservation wrapper."""
|
"""Test suite for RenderObservation wrapper."""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for Autoreset wrapper."""
|
"""Test suite for Autoreset wrapper."""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gymnasium as gym
|
import gymnasium as gym
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for ClipReward wrapper."""
|
"""Test suite for ClipReward wrapper."""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for DelayObservation wrapper."""
|
"""Test suite for DelayObservation wrapper."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for DtypeObservation wrapper."""
|
"""Test suite for DtypeObservation wrapper."""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gymnasium.wrappers import DtypeObservation
|
from gymnasium.wrappers import DtypeObservation
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for FilterObservation wrapper."""
|
"""Test suite for FilterObservation wrapper."""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from gymnasium.spaces import Box, Dict, Tuple
|
from gymnasium.spaces import Box, Dict, Tuple
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for FrameStackObservation wrapper."""
|
"""Test suite for FrameStackObservation wrapper."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for GrayscaleObservation wrapper."""
|
"""Test suite for GrayscaleObservation wrapper."""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gymnasium.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite of HumanRendering wrapper."""
|
"""Test suite of HumanRendering wrapper."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
"""Test suite for import wrappers."""
|
"""Test suite for import wrappers."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user