Skip to content

Commit

Permalink
Fix type for register(kwargs) (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
younik authored Nov 27, 2023
1 parent 88a2ce6 commit 9c96156
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gymnasium/envs/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ def register(
disable_env_checker: bool = False,
additional_wrappers: tuple[WrapperSpec, ...] = (),
vector_entry_point: VectorEnvCreator | str | None = None,
**kwargs: Any,
kwargs: dict | None = None,
):
"""Registers an environment in gymnasium with an ``id`` to use with :meth:`gymnasium.make` with the ``entry_point`` being a string or callable for creating the environment.
Expand All @@ -587,7 +587,7 @@ def register(
disable_env_checker: If to disable the :class:`gymnasium.wrappers.PassiveEnvChecker` to the environment.
additional_wrappers: Additional wrappers to apply the environment.
vector_entry_point: The entry point for creating the vector environment
**kwargs: arbitrary keyword arguments which are passed to the environment constructor on initialisation.
kwargs: arbitrary keyword arguments which are passed to the environment constructor on initialisation.
Changelogs:
v1.0.0 - `autoreset` and `apply_api_compatibility` parameter was removed
Expand All @@ -598,6 +598,8 @@ def register(
global registry, current_namespace
ns, name, version = parse_env_id(id)

if kwargs is None:
kwargs = dict()
if current_namespace is not None:
if (
kwargs.get("namespace") is not None
Expand All @@ -621,7 +623,7 @@ def register(
max_episode_steps=max_episode_steps,
order_enforce=order_enforce,
disable_env_checker=disable_env_checker,
**kwargs,
kwargs=kwargs,
additional_wrappers=additional_wrappers,
vector_entry_point=vector_entry_point,
)
Expand Down

0 comments on commit 9c96156

Please sign in to comment.