[WIP] Typing fixes (#2939)

* Update pyproject.toml

* Maybe fix typing for frozen lake and taxi

* Clean up pyproject a bit

* Reenable box2d pyright

* Disable box2d pyright

* Fix typing for toy text envs

* Narrow down pyright excludes for almost everything except mujoco

* Fix a wrapper test typing

* Remove env checker from excludes

* Remove redundant type hints which mess up pyright. And a typo fix.

* Remove test_spaces exclude

* Remove some redundant warnings

* Change pyright ignore to more specific

* Fix a weird private variable which gets explicitly exported for whatever reason. It's still exported for backwards compatibility, but internal code now uses a public variable.

* re-export the private variable

* Fix lunar_lander typing

* Remove lunar lander from excludes

* Small fix
This commit is contained in:
Ariel Kwiatkowski
2022-06-30 18:04:14 +02:00
committed by GitHub
parent 2017f3ed9e
commit 9c1d288a2d
11 changed files with 110 additions and 59 deletions

View File

@@ -5,7 +5,7 @@ import pytest
from gym.spaces import Dict, Tuple
from gym.vector.utils.numpy_utils import concatenate, create_empty_array
from gym.vector.utils.spaces import _BaseGymSpaces
from gym.vector.utils.spaces import BaseGymSpaces
from tests.vector.utils import spaces
@@ -57,7 +57,7 @@ def test_concatenate(space):
)
def test_create_empty_array(space, n):
def assert_nested_type(arr, space, n):
if isinstance(space, _BaseGymSpaces):
if isinstance(space, BaseGymSpaces):
assert isinstance(arr, np.ndarray)
assert arr.dtype == space.dtype
assert arr.shape == (n,) + space.shape
@@ -87,7 +87,7 @@ def test_create_empty_array(space, n):
)
def test_create_empty_array_zeros(space, n):
def assert_nested_type(arr, space, n):
if isinstance(space, _BaseGymSpaces):
if isinstance(space, BaseGymSpaces):
assert isinstance(arr, np.ndarray)
assert arr.dtype == space.dtype
assert arr.shape == (n,) + space.shape
@@ -117,7 +117,7 @@ def test_create_empty_array_zeros(space, n):
)
def test_create_empty_array_none_shape_ones(space):
def assert_nested_type(arr, space):
if isinstance(space, _BaseGymSpaces):
if isinstance(space, BaseGymSpaces):
assert isinstance(arr, np.ndarray)
assert arr.dtype == space.dtype
assert arr.shape == space.shape