Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type for register(kwargs) #788

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading