mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-31 10:09:53 +00:00
Make super() calls Python 2 compatible. (#1312)
This commit is contained in:
committed by
pzhokhov
parent
a6ac120175
commit
f1f884898d
@@ -34,7 +34,7 @@ class Box(Space):
|
||||
logger.warn("gym.spaces.Box autodetected dtype as {}. Please provide explicit dtype.".format(dtype))
|
||||
self.low = low.astype(dtype)
|
||||
self.high = high.astype(dtype)
|
||||
super().__init__(shape, dtype)
|
||||
super(Box, self).__init__(shape, dtype)
|
||||
self.np_random = np.random.RandomState()
|
||||
|
||||
def seed(self, seed):
|
||||
|
@@ -41,7 +41,7 @@ class Dict(Space):
|
||||
if isinstance(spaces, list):
|
||||
spaces = OrderedDict(spaces)
|
||||
self.spaces = spaces
|
||||
super().__init__(None, None) # None for shape and dtype, since it'll require special handling
|
||||
super(Dict, self).__init__(None, None) # None for shape and dtype, since it'll require special handling
|
||||
|
||||
def seed(self, seed):
|
||||
[space.seed(seed) for space in self.spaces.values()]
|
||||
|
@@ -12,7 +12,7 @@ class Discrete(Space):
|
||||
"""
|
||||
def __init__(self, n):
|
||||
self.n = n
|
||||
super().__init__((), np.int64)
|
||||
super(Discrete, self).__init__((), np.int64)
|
||||
self.np_random = np.random.RandomState()
|
||||
|
||||
def seed(self, seed):
|
||||
|
@@ -6,7 +6,7 @@ from .space import Space
|
||||
class MultiBinary(Space):
|
||||
def __init__(self, n):
|
||||
self.n = n
|
||||
super().__init__((self.n,), np.int8)
|
||||
super(MultiBinary, self).__init__((self.n,), np.int8)
|
||||
self.np_random = np.random.RandomState()
|
||||
|
||||
def seed(self, seed):
|
||||
|
@@ -11,7 +11,7 @@ class MultiDiscrete(Space):
|
||||
assert (np.array(nvec) > 0).all(), 'nvec (counts) have to be positive'
|
||||
self.nvec = np.asarray(nvec, dtype=np.uint32)
|
||||
|
||||
super().__init__(self.nvec.shape, np.uint32)
|
||||
super(MultiDiscrete, self).__init__(self.nvec.shape, np.uint32)
|
||||
self.np_random = np.random.RandomState()
|
||||
|
||||
def seed(self, seed):
|
||||
|
@@ -11,7 +11,7 @@ class Tuple(Space):
|
||||
"""
|
||||
def __init__(self, spaces):
|
||||
self.spaces = spaces
|
||||
super().__init__(None, None)
|
||||
super(Tuple, self).__init__(None, None)
|
||||
|
||||
def seed(self, seed):
|
||||
[space.seed(seed) for space in self.spaces]
|
||||
|
Reference in New Issue
Block a user