in gym_http_server.py [0:0]
def _get_space_properties(self, space):
info = {}
info['name'] = space.__class__.__name__
if info['name'] == 'Discrete':
info['n'] = space.n
elif info['name'] == 'Box':
info['shape'] = space.shape
# It's not JSON compliant to have Infinity, -Infinity, NaN.
# Many newer JSON parsers allow it, but many don't. Notably python json
# module can read and write such floats. So we only here fix "export version",
# also make it flat.
info['low'] = [(x if x != -np.inf else -1e100) for x in np.array(space.low ).flatten()]
info['high'] = [(x if x != +np.inf else +1e100) for x in np.array(space.high).flatten()]
elif info['name'] == 'HighLow':
info['num_rows'] = space.num_rows
info['matrix'] = [((float(x) if x != -np.inf else -1e100) if x != +np.inf else +1e100) for x in np.array(space.matrix).flatten()]
return info