mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 15:04:20 +00:00
* Moved pygame imports into render * Formatting * Make pygame optional for box2d, try to make formatting work * fix tests, fix pre-commit. * Update ci linter config. * fix type hints for latest pyright version and backward compatibility with numpy <= 1.21.5 * pre-commit. Co-authored-by: Ariel Kwiatkowski <ariel.j.kwiatkowski@gmail.com> Co-authored-by: Gianluca De Cola <gianluca.decola@ags-it.com>
This commit is contained in:
@@ -19,7 +19,7 @@ def flatdim(space: Space) -> int:
|
||||
the space is not defined in ``gym.spaces``.
|
||||
|
||||
Example usage::
|
||||
|
||||
|
||||
>>> s = spaces.Dict({"position": spaces.Discrete(2), "velocity": spaces.Discrete(3)})
|
||||
>>> spaces.flatdim(s)
|
||||
5
|
||||
@@ -134,7 +134,7 @@ def _unflatten_multidiscrete(space: MultiDiscrete, x: np.ndarray) -> np.ndarray:
|
||||
offsets[1:] = np.cumsum(space.nvec.flatten())
|
||||
|
||||
(indices,) = np.nonzero(x)
|
||||
return np.asarray(indices - offsets[:-1], dtype=space.dtype).reshape(space.shape)
|
||||
return np.asarray(indices - offsets[:-1], dtype=space.dtype).reshape(space.shape) # type: ignore
|
||||
|
||||
|
||||
@unflatten.register(Tuple)
|
||||
|
Reference in New Issue
Block a user