Skip to content

Commit 0bba185

Browse files
author
Carolin Benjamins
committed
Fix pre-commit
1 parent 9de0e29 commit 0bba185

File tree

7 files changed

+26
-43
lines changed

7 files changed

+26
-43
lines changed

carl/envs/gymnax/__init__.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
1-
from carl.envs.gymnax.carl_jax_acrobot import ( # noqa: F401
2-
CONTEXT_BOUNDS as CARLJaxAcrobotEnv_bounds,
3-
)
4-
from carl.envs.gymnax.carl_jax_acrobot import ( # noqa: F401
1+
# flake8: noqa: F401
2+
from carl.envs.gymnax.carl_jax_acrobot import CONTEXT_BOUNDS as CARLJaxAcrobotEnv_bounds
3+
from carl.envs.gymnax.carl_jax_acrobot import (
54
DEFAULT_CONTEXT as CARLJaxAcrobotEnv_defaults,
65
)
7-
from carl.envs.gymnax.carl_jax_acrobot import CARLJaxAcrobotEnv # noqa: F401
8-
from carl.envs.gymnax.carl_jax_cartpole import ( # noqa: F401
6+
from carl.envs.gymnax.carl_jax_acrobot import CARLJaxAcrobotEnv
7+
from carl.envs.gymnax.carl_jax_cartpole import (
98
CONTEXT_BOUNDS as CARLJaxCartPoleEnv_bounds,
109
)
11-
from carl.envs.gymnax.carl_jax_cartpole import ( # noqa: F401
10+
from carl.envs.gymnax.carl_jax_cartpole import (
1211
DEFAULT_CONTEXT as CARLJaxCartPoleEnv_defaults,
1312
)
14-
from carl.envs.gymnax.carl_jax_cartpole import CARLJaxCartPoleEnv # noqa: F401
15-
from carl.envs.gymnax.carl_jax_mountaincar import ( # noqa: F401
13+
from carl.envs.gymnax.carl_jax_cartpole import CARLJaxCartPoleEnv
14+
from carl.envs.gymnax.carl_jax_mountaincar import (
1615
CONTEXT_BOUNDS as CARLJaxMountainCarContinuousEnv_bounds,
1716
)
1817
from carl.envs.gymnax.carl_jax_mountaincar import (
1918
CONTEXT_BOUNDS as CARLJaxMountainCarEnv_bounds,
2019
)
21-
from carl.envs.gymnax.carl_jax_mountaincar import ( # noqa: F401
20+
from carl.envs.gymnax.carl_jax_mountaincar import (
2221
DEFAULT_CONTEXT as CARLJaxMountainCarContinuousEnv_defaults,
2322
)
2423
from carl.envs.gymnax.carl_jax_mountaincar import (
2524
DEFAULT_CONTEXT as CARLJaxMountainCarEnv_defaults,
2625
)
27-
from carl.envs.gymnax.carl_jax_mountaincar import CARLJaxMountainCarEnv # noqa: F401
28-
from carl.envs.gymnax.carl_jax_mountaincar import ( # noqa: F401
26+
from carl.envs.gymnax.carl_jax_mountaincar import (
2927
CARLJaxMountainCarContinuousEnv,
28+
CARLJaxMountainCarEnv,
3029
)
31-
from carl.envs.gymnax.carl_jax_pendulum import ( # noqa: F401
30+
from carl.envs.gymnax.carl_jax_pendulum import (
3231
CONTEXT_BOUNDS as CARLJaxPendulumEnv_bounds,
3332
)
34-
from carl.envs.gymnax.carl_jax_pendulum import ( # noqa: F401
33+
from carl.envs.gymnax.carl_jax_pendulum import (
3534
DEFAULT_CONTEXT as CARLJaxPendulumEnv_defaults,
3635
)
37-
from carl.envs.gymnax.carl_jax_pendulum import CARLJaxPendulumEnv # noqa: F401
36+
from carl.envs.gymnax.carl_jax_pendulum import CARLJaxPendulumEnv

carl/envs/gymnax/carl_gymnax_env.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
from __future__ import annotations
2+
13
from typing import Any, Dict, List, Optional, Union
24

35
import gymnasium
46

7+
from CARL.carl.envs.gymnax.utils import make_gymnax_env
58
from carl.context.selection import AbstractSelector
69
from carl.envs.carl_env import CARLEnv
7-
from carl.envs.gymnax.wrappers import make_gymnax_env
810
from carl.utils.trial_logger import TrialLogger
911
from carl.utils.types import Context, Contexts
1012

carl/envs/gymnax/carl_jax_acrobot.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Optional, Union
4-
5-
import gymnasium
63
import gymnax
74
import jax.numpy as jnp
85
import numpy as np
9-
from gymnax.environments.classic_control.acrobot import Acrobot
106

11-
from carl.context.selection import AbstractSelector
12-
from carl.envs.carl_env import CARLEnv
137
from carl.envs.gymnax.carl_gymnax_env import CARLGymnaxEnv
14-
from carl.utils.trial_logger import TrialLogger
15-
from carl.utils.types import Context, Contexts
8+
from carl.utils.types import Context
169

1710
DEFAULT_CONTEXT = {
1811
"link_length_1": 1,
@@ -69,7 +62,7 @@
6962

7063
class CARLJaxAcrobotEnv(CARLGymnaxEnv):
7164
env_name: str = "Acrobot-v1"
72-
max_episode_steps: int = DEFAULT_CONTEXT["max_steps_in_episode"]
65+
max_episode_steps: int = int(DEFAULT_CONTEXT["max_steps_in_episode"])
7366
DEFAULT_CONTEXT: Context = DEFAULT_CONTEXT
7467

7568
def _update_context(self) -> None:

carl/envs/gymnax/carl_jax_cartpole.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
import gymnax
44
import jax.numpy as jnp
5-
from gymnax.environments.classic_control.cartpole import CartPole
65

76
from carl.envs.gymnax.carl_gymnax_env import CARLGymnaxEnv
8-
from carl.utils.types import Context, Contexts
7+
from carl.utils.types import Context
98

109
DEFAULT_CONTEXT = {
1110
"gravity": 9.8,
@@ -34,7 +33,7 @@
3433

3534
class CARLJaxCartPoleEnv(CARLGymnaxEnv):
3635
env_name: str = "CartPole-v1"
37-
max_episode_steps: int = DEFAULT_CONTEXT["max_steps_in_episode"]
36+
max_episode_steps: int = int(DEFAULT_CONTEXT["max_steps_in_episode"]) # type: ignore[arg-type]
3837
DEFAULT_CONTEXT: Context = DEFAULT_CONTEXT
3938

4039
def _update_context(self) -> None:

carl/envs/gymnax/carl_jax_mountaincar.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Optional, Union
4-
53
import gymnax
64
import jax.numpy as jnp
7-
from gymnax.environments.classic_control.mountain_car import MountainCar
85

9-
from carl.context.selection import AbstractSelector
10-
from carl.envs.carl_env import CARLEnv
116
from carl.envs.gymnax.carl_gymnax_env import CARLGymnaxEnv
12-
from carl.envs.gymnax.wrappers import CustomGymnaxToGymWrapper
13-
from carl.utils.trial_logger import TrialLogger
14-
from carl.utils.types import Context, Contexts
7+
from carl.utils.types import Context
158

169
DEFAULT_CONTEXT = {
1710
"min_position": -1.2,
@@ -38,7 +31,7 @@
3831

3932
class CARLJaxMountainCarEnv(CARLGymnaxEnv):
4033
env_name: str = "MountainCar-v0"
41-
max_episode_steps: int = DEFAULT_CONTEXT["max_steps_in_episode"]
34+
max_episode_steps: int = int(DEFAULT_CONTEXT["max_steps_in_episode"])
4235
DEFAULT_CONTEXT: Context = DEFAULT_CONTEXT
4336

4437
def _update_context(self) -> None:

carl/envs/gymnax/carl_jax_pendulum.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Optional, Union
4-
53
import jax.numpy as jnp
6-
from gymnax.environments.classic_control.pendulum import EnvParams, Pendulum
4+
from gymnax.environments.classic_control.pendulum import EnvParams
75

86
from carl.envs.gymnax.carl_gymnax_env import CARLGymnaxEnv
9-
from carl.utils.types import Context, Contexts
7+
from carl.utils.types import Context
108

119
DEFAULT_CONTEXT = {
1210
"max_speed": 8.0,
@@ -31,7 +29,7 @@
3129

3230
class CARLJaxPendulumEnv(CARLGymnaxEnv):
3331
env_name: str = "Pendulum-v1"
34-
max_episode_steps: int = DEFAULT_CONTEXT["max_steps_in_episode"]
32+
max_episode_steps: int = int(DEFAULT_CONTEXT["max_steps_in_episode"])
3533
DEFAULT_CONTEXT: Context = DEFAULT_CONTEXT
3634

3735
def _update_context(self) -> None:

carl/envs/gymnax/wrappers.py renamed to carl/envs/gymnax/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import gym
43
import gymnasium
54
import gymnax
65
from gymnasium.wrappers import EnvCompatibility

0 commit comments

Comments
 (0)