Resolve platform-specific/installation-specific mypy issues

by adding ignores and ignoring unused ignores locally
This commit is contained in:
Dominik Jain 2024-02-15 11:26:54 +01:00
parent f2e0fd165d
commit 08728ad35e
2 changed files with 9 additions and 3 deletions

View File

@ -12,6 +12,9 @@ with contextlib.suppress(ImportError):
import ray
# mypy: disable-error-code="unused-ignore"
class _SetAttrWrapper(gym.Wrapper):
def set_env_attr(self, key: str, value: Any) -> None:
setattr(self.env.unwrapped, key, value)

View File

@ -12,6 +12,9 @@ import numpy as np
from tianshou.env.utils import CloudpickleWrapper, gym_new_venv_step_type
from tianshou.env.worker import EnvWorker
# mypy: disable-error-code="unused-ignore"
_NP_TO_CT = {
np.bool_: ctypes.c_bool,
np.uint8: ctypes.c_uint8,
@ -179,10 +182,10 @@ class SubprocEnvWorker(EnvWorker):
if remain_time <= 0:
break
# connection.wait hangs if the list is empty
new_ready_conns = connection.wait(remain_conns, timeout=remain_time)
new_ready_conns = connection.wait(remain_conns, timeout=remain_time) # type: ignore
ready_conns.extend(new_ready_conns) # type: ignore
remain_conns = [conn for conn in remain_conns if conn not in ready_conns]
return [workers[conns.index(con)] for con in ready_conns]
remain_conns = [conn for conn in remain_conns if conn not in ready_conns] # type: ignore
return [workers[conns.index(con)] for con in ready_conns] # type: ignore
def send(self, action: np.ndarray | None, **kwargs: Any) -> None:
if action is None: