Make super() calls Python 2 compatible. (#1312)

This commit is contained in:
Robert Nishihara
2019-02-07 11:29:04 -08:00
committed by pzhokhov
parent a6ac120175
commit f1f884898d
6 changed files with 6 additions and 6 deletions

View File

@@ -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):

View File

@@ -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()]

View File

@@ -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):

View File

@@ -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):

View File

@@ -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):

View File

@@ -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]