Skip to content

Commit 10e6e98

Browse files
generatedunixname1401739305002972meta-codesync[bot]
authored andcommitted
Fix PYRE_MISSING_ANNOTATIONS issues in fbcode/pearl/user_envs/wrappers/sparse_reward.py
Differential Revision: D101152148 fbshipit-source-id: d67681f8008cc74a99c5f3eea9ab47fda1ac37f0
1 parent 711e4c8 commit 10e6e98

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pearl/user_envs/wrappers/sparse_reward.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#
77
# pyre-ignore-all-errors
88

9+
from typing import Any
10+
911
import numpy as np
1012

1113
try:
@@ -69,7 +71,7 @@ def step(self, action):
6971
sparse_reward = self.sparse_reward()
7072
return obs, sparse_reward, terminated, truncated, info
7173

72-
def sparse_reward(self):
74+
def sparse_reward(self) -> bool:
7375
position, velocity = self.env.state
7476
return bool(
7577
position >= self.env.goal_position and velocity >= self.env.goal_velocity
@@ -82,7 +84,7 @@ class PuckWorldSparseRewardWrapper(gym.Wrapper):
8284
def __init__(self, env):
8385
super().__init__(env)
8486

85-
def step(self, action):
87+
def step(self, action: Any) -> tuple[Any, float, bool, bool, dict[str, Any]]:
8688
obs, reward, terminated, truncated, info = self.env.step(action)
8789
sparse_reward = self.sparse_reward()
8890
return obs, sparse_reward, terminated, truncated, info

0 commit comments

Comments
 (0)