Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/version.py | VERSION = '0.10.5'
| 19 | 9 | 18 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/__init__.py | import distutils.version
import os
import sys
import warnings
from gym import error
from gym.utils import reraise
from gym.version import VERSION as __version__
from gym.core import Env, GoalEnv, Space, Wrapper, ObservationWrapper, ActionWrapper, RewardWrapper
from gym.envs import make, spec
from gym import wrappers,... | 543 | 29.222222 | 113 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/registration.py | import pkg_resources
import re
from gym import error, logger
# This format is true today, but it's *not* an official spec.
# [username/](env-name)-v(version) env-name is group 1, version is group 2
#
# 2016-10-31: We're experimentally expanding the environment ID format
# to include an optional username.
env_id_re ... | 8,100 | 41.192708 | 390 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/__init__.py | from gym.envs.registration import registry, register, make, spec
# Algorithmic
# ----------------------------------------
register(
id='Copy-v0',
entry_point='gym.envs.algorithmic:CopyEnv',
max_episode_steps=200,
reward_threshold=25.0,
)
register(
id='RepeatCopy-v0',
entry_point='gym.envs.alg... | 14,374 | 25.919476 | 151 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/atari/atari_env.py | import numpy as np
import os
import gym
from gym import error, spaces
from gym import utils
from gym.utils import seeding
try:
import atari_py
except ImportError as e:
raise error.DependencyNotInstalled("{}. (HINT: you can install Atari dependencies by running 'pip install gym[atari]'.)".format(e))
def to_ram... | 6,475 | 32.554404 | 143 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/atari/__init__.py | from gym.envs.atari.atari_env import AtariEnv
| 46 | 22.5 | 45 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/inverted_double_pendulum.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class InvertedDoublePendulumEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'inverted_double_pendulum.xml', 5)
utils.EzPickle.__init__(self)
def step(self, action... | 1,531 | 33.818182 | 90 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/pusher.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
import mujoco_py
class PusherEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
utils.EzPickle.__init__(self)
mujoco_env.MujocoEnv.__init__(self, 'pusher.xml', 5)
def step(self, a):
vec_1 = sel... | 1,925 | 32.206897 | 75 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/inverted_pendulum.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class InvertedPendulumEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
utils.EzPickle.__init__(self)
mujoco_env.MujocoEnv.__init__(self, 'inverted_pendulum.xml', 2)
def step(self, a):
reward =... | 1,054 | 33.032258 | 96 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/humanoidstandup.py | from gym.envs.mujoco import mujoco_env
from gym import utils
import numpy as np
class HumanoidStandupEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'humanoidstandup.xml', 5)
utils.EzPickle.__init__(self)
def _get_obs(self):
data = sel... | 1,749 | 37.043478 | 139 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/humanoid.py | import numpy as np
from gym.envs.mujoco import mujoco_env
from gym import utils
def mass_center(model, sim):
mass = np.expand_dims(model.body_mass, 1)
xpos = sim.data.xipos
return (np.sum(mass * xpos, 0) / np.sum(mass))[0]
class HumanoidEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
... | 2,110 | 39.596154 | 170 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/mujoco_env.py | import os
from gym import error, spaces
from gym.utils import seeding
import numpy as np
from os import path
import gym
import six
try:
import mujoco_py
except ImportError as e:
raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://... | 4,093 | 30.015152 | 178 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/ant.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class AntEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'ant.xml', 5)
utils.EzPickle.__init__(self)
def step(self, a):
xposbefore = self.get_body_com("tor... | 1,687 | 35.695652 | 92 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/swimmer.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class SwimmerEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'swimmer.xml', 4)
utils.EzPickle.__init__(self)
def step(self, a):
ctrl_cost_coeff = 0.0001
... | 1,150 | 34.96875 | 90 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/reacher.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class ReacherEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
utils.EzPickle.__init__(self)
mujoco_env.MujocoEnv.__init__(self, 'reacher.xml', 2)
def step(self, a):
vec = self.get_body_com("fi... | 1,562 | 34.522727 | 96 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/walker2d.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class Walker2dEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, "walker2d.xml", 4)
utils.EzPickle.__init__(self)
def step(self, a):
posbefore = self.sim.dat... | 1,412 | 33.463415 | 94 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/__init__.py | from gym.envs.mujoco.mujoco_env import MujocoEnv
# ^^^^^ so that user gets the correct error
# message if mujoco is not installed correctly
from gym.envs.mujoco.ant import AntEnv
from gym.envs.mujoco.half_cheetah import HalfCheetahEnv
from gym.envs.mujoco.hopper import HopperEnv
from gym.envs.mujoco.walker2d import Wal... | 819 | 47.235294 | 78 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/thrower.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class ThrowerEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
utils.EzPickle.__init__(self)
self._ball_hit_ground = False
self._ball_hit_location = None
mujoco_env.MujocoEnv.__init__(self, ... | 2,076 | 33.04918 | 78 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/half_cheetah.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class HalfCheetahEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'half_cheetah.xml', 5)
utils.EzPickle.__init__(self)
def step(self, action):
xposbefore = ... | 1,221 | 33.914286 | 92 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/hopper.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class HopperEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'hopper.xml', 4)
utils.EzPickle.__init__(self)
def step(self, a):
posbefore = self.sim.data.qpo... | 1,472 | 34.926829 | 96 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/mujoco/striker.py | import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class StrikerEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
utils.EzPickle.__init__(self)
self._striked = False
self._min_strike_dist = np.inf
self.strike_threshold = 0.1
mujoco_e... | 2,640 | 33.75 | 81 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/unittest/memorize_digits.py | import numpy as np
import gym
from gym import spaces
from gym.utils import seeding
# Unit test environment for CNNs.
# Looks like this (RGB observations):
#
# ---------------------------
# | |
# | ****** |
# | ****** |
# | ** ** |
# |... | 4,647 | 22.714286 | 93 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/unittest/__init__.py | from gym.envs.unittest.cube_crash import CubeCrash
from gym.envs.unittest.cube_crash import CubeCrashSparse
from gym.envs.unittest.cube_crash import CubeCrashScreenBecomesBlack
from gym.envs.unittest.memorize_digits import MemorizeDigits
| 239 | 39 | 68 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/unittest/cube_crash.py | import numpy as np
import gym
from gym import spaces
from gym.utils import seeding
# Unit test environment for CNNs and CNN+RNN algorithms.
# Looks like this (RGB observations):
#
# ---------------------------
# | |
# | |
# | |
# | ... | 5,007 | 32.386667 | 133 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/tests/test_registration.py | # -*- coding: utf-8 -*-
from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env.unwrapped, cartpole.CartPoleEnv)
def test_make_deprecated():
try... | 1,374 | 25.960784 | 95 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/tests/test_envs.py | import numpy as np
import pytest
from gym import envs
from gym.envs.tests.spec_list import spec_list
# This runs a smoketest on each official registered env. We may want
# to try also running environments which are not officially registered
# envs.
@pytest.mark.parametrize("spec", spec_list)
def test_env(spec):
en... | 1,572 | 34.75 | 100 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/tests/test_determinism.py | import numpy as np
import pytest
from gym import spaces
from gym.envs.tests.spec_list import spec_list
@pytest.mark.parametrize("spec", spec_list)
def test_env(spec):
# Note that this precludes running this test in multiple
# threads. However, we probably already can't do multithreading
# due to some envi... | 2,746 | 35.626667 | 106 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/tests/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/tests/spec_list.py | from gym import envs, logger
import os
def should_skip_env_spec_for_tests(spec):
# We skip tests for envs that require dependencies or are otherwise
# troublesome to run frequently
ep = spec._entry_point
# Skip mujoco tests for pull request CI
skip_mujoco = not (os.environ.get('MUJOCO_KEY_BUNDLE') ... | 987 | 41.956522 | 156 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/tests/test_envs_semantics.py | """
Currently disabled since this was done in a very poor way
Hashed str representation of objects
"""
from __future__ import unicode_literals
import json
import hashlib
import os
import pytest
from gym import spaces, logger
from gym.envs.tests.spec_list import spec_list
DATA_DIR = os.path.dirname(__file__)
ROLLOUT... | 3,016 | 30.427083 | 147 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/repeat_copy.py | """
Task is to copy content multiple times from the input tape to
the output tape. http://arxiv.org/abs/1511.07275
"""
from gym.envs.algorithmic import algorithmic_env
class RepeatCopyEnv(algorithmic_env.TapeAlgorithmicEnv):
MIN_REWARD_SHORTFALL_FOR_PROMOTION = -.1
def __init__(self, base=5):
super(Rep... | 513 | 31.125 | 67 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/duplicated_input.py | """
Task is to return every nth character from the input tape.
http://arxiv.org/abs/1511.07275
"""
from __future__ import division
from gym.envs.algorithmic import algorithmic_env
class DuplicatedInputEnv(algorithmic_env.TapeAlgorithmicEnv):
def __init__(self, duplication=2, base=5):
self.duplication = dup... | 866 | 33.68 | 83 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/algorithmic_env.py | """
Algorithmic environments have the following traits in common:
- A 1-d "input tape" or 2-d "input grid" of characters
- A target string which is a deterministic function of the input characters
Agents control a read head that moves over the input tape. Observations consist
of the single character currently under t... | 12,505 | 37.244648 | 100 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/reverse.py | """
Task is to reverse content over the input tape.
http://arxiv.org/abs/1511.07275
"""
from gym.envs.algorithmic import algorithmic_env
class ReverseEnv(algorithmic_env.TapeAlgorithmicEnv):
MIN_REWARD_SHORTFALL_FOR_PROMOTION = -.1
def __init__(self, base=2):
super(ReverseEnv, self).__init__(base=base... | 471 | 28.5 | 86 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/reversed_addition.py | from __future__ import division
import numpy as np
from gym.envs.algorithmic import algorithmic_env
class ReversedAdditionEnv(algorithmic_env.GridAlgorithmicEnv):
def __init__(self, rows=2, base=3):
super(ReversedAdditionEnv, self).__init__(rows=rows, base=base, chars=False)
def target_from_input_data... | 1,172 | 36.83871 | 84 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/copy_.py | """
Task is to copy content from the input tape to
the output tape. http://arxiv.org/abs/1511.07275
"""
from gym.envs.algorithmic import algorithmic_env
class CopyEnv(algorithmic_env.TapeAlgorithmicEnv):
def __init__(self, base=5, chars=True):
super(CopyEnv, self).__init__(base=base, chars=chars)
def ... | 389 | 26.857143 | 61 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/__init__.py | from gym.envs.algorithmic.copy_ import CopyEnv
from gym.envs.algorithmic.repeat_copy import RepeatCopyEnv
from gym.envs.algorithmic.duplicated_input import DuplicatedInputEnv
from gym.envs.algorithmic.reverse import ReverseEnv
from gym.envs.algorithmic.reversed_addition import ReversedAdditionEnv
| 298 | 48.833333 | 70 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/tests/test_algorithmic.py | from gym.envs import algorithmic as alg
import unittest
# All concrete subclasses of AlgorithmicEnv
ALL_ENVS = [
alg.copy_.CopyEnv,
alg.duplicated_input.DuplicatedInputEnv,
alg.repeat_copy.RepeatCopyEnv,
alg.reverse.ReverseEnv,
alg.reversed_addition.ReversedAdditionEnv,
]
ALL_TAPE_ENVS = [env for ... | 9,853 | 40.058333 | 97 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/algorithmic/tests/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/blackjack.py | import gym
from gym import spaces
from gym.utils import seeding
def cmp(a, b):
return float(a > b) - float(a < b)
# 1 = Ace, 2-10 = Number cards, Jack/Queen/King = 10
deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
def draw_card(np_random):
return int(np_random.choice(deck))
def draw_hand(np_random):
... | 3,930 | 32.598291 | 79 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/nchain.py | import gym
from gym import spaces
from gym.utils import seeding
class NChainEnv(gym.Env):
"""n-Chain environment
This game presents moves along a linear chain of states, with two actions:
0) forward, which moves along the chain but returns no reward
1) backward, which returns to the beginning and ha... | 2,169 | 37.75 | 79 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/frozen_lake.py | import numpy as np
import sys
from six import StringIO, b
from gym import utils
from gym.envs.toy_text import discrete
LEFT = 0
DOWN = 1
RIGHT = 2
UP = 3
MAPS = {
"4x4": [
"SFFF",
"FHFH",
"FFFH",
"HFFG"
],
"8x8": [
"SFFFFFFF",
"FFFFFFFF",
"FFFHFFFF"... | 4,419 | 32.233083 | 95 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/kellycoinflip.py | import gym
from gym import spaces
from gym.utils import seeding
from gym.spaces import prng
# for Generalized Kelly coinflip game distributions:
from scipy.stats import genpareto
import numpy as np
import numpy.random
def flip(edge, np_random):
return np_random.uniform() < edge
class KellyCoinflipEnv(gym.Env):
... | 9,930 | 64.768212 | 1,854 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/discrete.py | import numpy as np
from gym import Env, spaces
from gym.utils import seeding
def categorical_sample(prob_n, np_random):
"""
Sample from categorical distribution
Each row specifies class probabilities
"""
prob_n = np.asarray(prob_n)
csprob_n = np.cumsum(prob_n)
return (csprob_n > np_random.... | 1,510 | 24.183333 | 75 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/guessing_game.py | import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
class GuessingGame(gym.Env):
"""Number guessing game
The object of the game is to guess within 1% of the randomly chosen number
within 200 time steps
After each step the agent is provided with one of four possible obs... | 2,920 | 32.193182 | 99 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/cliffwalking.py | import numpy as np
import sys
from gym.envs.toy_text import discrete
UP = 0
RIGHT = 1
DOWN = 2
LEFT = 3
class CliffWalkingEnv(discrete.DiscreteEnv):
"""
This is a simple implementation of the Gridworld Cliff
reinforcement learning task.
Adapted from Example 6.6 (page 145) from Reinforcement Learning... | 3,892 | 33.149123 | 94 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/__init__.py | from gym.envs.toy_text.blackjack import BlackjackEnv
from gym.envs.toy_text.roulette import RouletteEnv
from gym.envs.toy_text.frozen_lake import FrozenLakeEnv
from gym.envs.toy_text.nchain import NChainEnv
from gym.envs.toy_text.hotter_colder import HotterColder
from gym.envs.toy_text.guessing_game import GuessingGame... | 513 | 50.4 | 71 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/taxi.py | import sys
from six import StringIO
from gym import utils
from gym.envs.toy_text import discrete
import numpy as np
MAP = [
"+---------+",
"|R: | : :G|",
"| : : : : |",
"| : : : : |",
"| | : | : |",
"|Y| : |B: |",
"+---------+",
]
class TaxiEnv(discrete.DiscreteEnv):
"""
The Taxi P... | 4,681 | 34.203008 | 118 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/roulette.py | import gym
from gym import spaces
from gym.utils import seeding
class RouletteEnv(gym.Env):
"""Simple roulette environment
The roulette wheel has 37 spots. If the bet is 0 and a 0 comes up,
you win a reward of 35. If the parity of your bet matches the parity
of the spin, you win 1. Otherwise you rece... | 1,392 | 29.955556 | 88 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/toy_text/hotter_colder.py | import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
class HotterColder(gym.Env):
"""Hotter Colder
The goal of hotter colder is to guess closer to a randomly selected number
After each step the agent receives an observation of:
0 - No guess yet submitted (only after rese... | 2,083 | 30.104478 | 107 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/classic_control/cartpole.py | """
Classic cart-pole system implemented by Rich Sutton et al.
Copied from http://incompleteideas.net/sutton/book/code/pole.c
permalink: https://perma.cc/C9ZM-652R
"""
import math
import gym
from gym import spaces, logger
from gym.utils import seeding
import numpy as np
class CartPoleEnv(gym.Env):
metadata = {
... | 5,351 | 36.957447 | 227 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/classic_control/continuous_mountain_car.py | # -*- coding: utf-8 -*-
"""
@author: Olivier Sigaud
A merge between two sources:
* Adaptation of the MountainCar Environment from the "FAReinforcement" library
of Jose Antonio Martin H. (version 1.0), adapted by 'Tom Schaul, tom@idsia.ch'
and then modified by Arnaud de Broissia
* the OpenAI/gym MountainCar environm... | 5,013 | 34.062937 | 103 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/classic_control/mountain_car.py | """
http://incompleteideas.net/sutton/MountainCar/MountainCar1.cp
permalink: https://perma.cc/6Z2N-PFWC
"""
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
class MountainCarEnv(gym.Env):
metadata = {
'render.modes': ['human', 'rgb_array'],
'video.fram... | 4,194 | 34.550847 | 103 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/classic_control/pendulum.py | import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from os import path
class PendulumEnv(gym.Env):
metadata = {
'render.modes' : ['human', 'rgb_array'],
'video.frames_per_second' : 30
}
def __init__(self):
self.max_speed=8
self.max_torque=2.
... | 2,856 | 31.101124 | 94 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/classic_control/__init__.py | from gym.envs.classic_control.cartpole import CartPoleEnv
from gym.envs.classic_control.mountain_car import MountainCarEnv
from gym.envs.classic_control.continuous_mountain_car import Continuous_MountainCarEnv
from gym.envs.classic_control.pendulum import PendulumEnv
from gym.envs.classic_control.acrobot import Acrobot... | 325 | 45.571429 | 86 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/classic_control/acrobot.py | """classic Acrobot task"""
from gym import core, spaces
from gym.utils import seeding
import numpy as np
from numpy import sin, cos, pi
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
__credits__ = ["Alborz Geramifard", "Robert H. Klein", "Christoph Dann",
"William Dabney", "Jonathan P. H... | 10,619 | 34.282392 | 100 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py | """
2D rendering framework
"""
from __future__ import division
import os
import six
import sys
if "Apple" in sys.version:
if 'DYLD_FALLBACK_LIBRARY_PATH' in os.environ:
os.environ['DYLD_FALLBACK_LIBRARY_PATH'] += ':/usr/lib'
# (JDS 2016/04/15): avoid bug on Anaconda 2.3.0 / Yosemite
from gym.utils... | 11,065 | 30.798851 | 346 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/utils.py | import numpy as np
from gym import error
try:
import mujoco_py
except ImportError as e:
raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/mujoco-py/.)".format(e))
def robot_get_obs(sim):
"""Returns all joi... | 3,693 | 37.082474 | 178 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/fetch_env.py | import numpy as np
from gym.envs.robotics import rotations, robot_env, utils
def goal_distance(goal_a, goal_b):
assert goal_a.shape == goal_b.shape
return np.linalg.norm(goal_a - goal_b, axis=-1)
class FetchEnv(robot_env.RobotEnv):
"""Superclass for all Fetch environments.
"""
def __init__(
... | 8,250 | 42.888298 | 131 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/__init__.py | from gym.envs.robotics.fetch_env import FetchEnv
from gym.envs.robotics.fetch.slide import FetchSlideEnv
from gym.envs.robotics.fetch.pick_and_place import FetchPickAndPlaceEnv
from gym.envs.robotics.fetch.push import FetchPushEnv
from gym.envs.robotics.fetch.reach import FetchReachEnv
from gym.envs.robotics.hand.reac... | 515 | 45.909091 | 71 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/hand_env.py | import os
import copy
import numpy as np
import gym
from gym import error, spaces
from gym.utils import seeding
from gym.envs.robotics import robot_env
class HandEnv(robot_env.RobotEnv):
def __init__(self, model_path, n_substeps, initial_qpos, relative_control):
self.relative_control = relative_control
... | 1,918 | 37.38 | 93 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/robot_env.py | import os
import copy
import numpy as np
import gym
from gym import error, spaces
from gym.utils import seeding
try:
import mujoco_py
except ImportError as e:
raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai/m... | 5,681 | 33.858896 | 178 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/rotations.py | # Copyright (c) 2009-2017, Matthew Brett and Christoph Gohlke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright... | 13,343 | 35.064865 | 125 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/assets/LICENSE.md | This work contains code used under the following license:
# ShadowHand
The model of the [ShadowHand](https://www.shadowrobot.com/products/dexterous-hand/) is based on [models
provided by Shadow](https://github.com/shadow-robot/sr_common/tree/kinetic-devel/sr_description/hand/model).
It was adapted and refined by Vikas... | 1,142 | 86.923077 | 541 | md |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/hand/manipulate.py | import numpy as np
from gym import utils, error
from gym.envs.robotics import rotations, hand_env
from gym.envs.robotics.utils import robot_get_obs
try:
import mujoco_py
except ImportError as e:
raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructio... | 14,368 | 48.040956 | 178 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/hand/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/hand/reach.py | import numpy as np
from gym import utils
from gym.envs.robotics import hand_env
from gym.envs.robotics.utils import robot_get_obs
FINGERTIP_SITE_NAMES = [
'robot0:S_fftip',
'robot0:S_mftip',
'robot0:S_rftip',
'robot0:S_lftip',
'robot0:S_thtip',
]
DEFAULT_INITIAL_QPOS = {
'robot0:WRJ1': -0.1... | 5,384 | 36.137931 | 99 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/fetch/pick_and_place.py | from gym import utils
from gym.envs.robotics import fetch_env
class FetchPickAndPlaceEnv(fetch_env.FetchEnv, utils.EzPickle):
def __init__(self, reward_type='sparse'):
initial_qpos = {
'robot0:slide0': 0.405,
'robot0:slide1': 0.48,
'robot0:slide2': 0.0,
'obj... | 769 | 39.526316 | 98 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/fetch/push.py | from gym import utils
from gym.envs.robotics import fetch_env
class FetchPushEnv(fetch_env.FetchEnv, utils.EzPickle):
def __init__(self, reward_type='sparse'):
initial_qpos = {
'robot0:slide0': 0.405,
'robot0:slide1': 0.48,
'robot0:slide2': 0.0,
'object0:joi... | 751 | 38.578947 | 87 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/fetch/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/fetch/reach.py | from gym import utils
from gym.envs.robotics import fetch_env
class FetchReachEnv(fetch_env.FetchEnv, utils.EzPickle):
def __init__(self, reward_type='sparse'):
initial_qpos = {
'robot0:slide0': 0.4049,
'robot0:slide1': 0.48,
'robot0:slide2': 0.0,
}
fetc... | 690 | 37.388889 | 89 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/robotics/fetch/slide.py | import numpy as np
from gym import utils
from gym.envs.robotics import fetch_env
class FetchSlideEnv(fetch_env.FetchEnv, utils.EzPickle):
def __init__(self, reward_type='sparse'):
initial_qpos = {
'robot0:slide0': 0.05,
'robot0:slide1': 0.48,
'robot0:slide2': 0.0,
... | 792 | 36.761905 | 105 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/box2d/car_dynamics.py | import numpy as np
import math
import Box2D
from Box2D.b2 import (edgeShape, circleShape, fixtureDef, polygonShape, revoluteJointDef, contactListener, shape)
# Top-down car dynamics simulation.
#
# Some ideas are taken from this great tutorial http://www.iforce2d.net/b2dtut/top-down-car by Chris Campbell.
# This simul... | 9,275 | 36.861224 | 129 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/box2d/car_racing.py | import sys, math
import numpy as np
import Box2D
from Box2D.b2 import (edgeShape, circleShape, fixtureDef, polygonShape, revoluteJointDef, contactListener)
import gym
from gym import spaces
from gym.envs.box2d.car_dynamics import Car
from gym.utils import colorize, seeding
import pyglet
from pyglet import gl
# Easi... | 19,162 | 37.47992 | 126 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/box2d/__init__.py | from gym.envs.box2d.lunar_lander import LunarLander
from gym.envs.box2d.lunar_lander import LunarLanderContinuous
from gym.envs.box2d.bipedal_walker import BipedalWalker, BipedalWalkerHardcore
from gym.envs.box2d.car_racing import CarRacing
| 241 | 47.4 | 78 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/box2d/bipedal_walker.py | import sys, math
import numpy as np
import Box2D
from Box2D.b2 import (edgeShape, circleShape, fixtureDef, polygonShape, revoluteJointDef, contactListener)
import gym
from gym import spaces
from gym.utils import colorize, seeding
# This is simple 4-joints walker robot environment.
#
# There are two versions:
#
# - N... | 22,880 | 39.283451 | 155 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/envs/box2d/lunar_lander.py | import sys, math
import numpy as np
import Box2D
from Box2D.b2 import (edgeShape, circleShape, fixtureDef, polygonShape, revoluteJointDef, contactListener)
import gym
from gym import spaces
from gym.utils import seeding
# Rocket trajectory optimization is a classic topic in Optimal Control.
#
# According to Pontryag... | 16,335 | 39.137592 | 165 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/box.py | import numpy as np
import gym
from gym import logger
class Box(gym.Space):
"""
A box in R^n.
I.e., each coordinate is bounded.
Example usage:
self.action_space = spaces.Box(low=-10, high=10, shape=(1,))
"""
def __init__(self, low=None, high=None, shape=None, dtype=None):
"""
... | 1,874 | 36.5 | 152 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/multi_binary.py | import gym
import numpy as np
class MultiBinary(gym.Space):
def __init__(self, n):
self.n = n
gym.Space.__init__(self, (self.n,), np.int8)
def sample(self):
return gym.spaces.np_random.randint(low=0, high=2, size=self.n).astype(self.dtype)
def contains(self, x):
return ((x==... | 516 | 33.466667 | 90 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/multi_discrete.py | import gym
import numpy as np
class MultiDiscrete(gym.Space):
def __init__(self, nvec):
"""
nvec: vector of counts of each categorical variable
"""
self.nvec = np.asarray(nvec, dtype=np.int32)
assert self.nvec.ndim == 1, 'nvec should be a 1d array (or list) of ints'
... | 741 | 34.333333 | 89 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/tuple_space.py | import gym
class Tuple(gym.Space):
"""
A tuple (i.e., product) of simpler spaces
Example usage:
self.observation_space = spaces.Tuple((spaces.Discrete(2), spaces.Discrete(3)))
"""
def __init__(self, spaces):
self.spaces = spaces
gym.Space.__init__(self, None, None)
def sam... | 1,149 | 33.848485 | 117 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/prng.py | import numpy
np_random = numpy.random.RandomState()
def seed(seed=None):
"""Seed the common numpy.random.RandomState used in spaces
CF
https://github.com/openai/gym/commit/58e6aa95e5af2c738557431f812abb81c505a7cf#commitcomment-17669277
for some details about why we seed the spaces separately from the... | 712 | 32.952381 | 104 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/discrete.py | import numpy as np
import gym
class Discrete(gym.Space):
"""
{0,1,...,n-1}
Example usage:
self.observation_space = spaces.Discrete(2)
"""
def __init__(self, n):
self.n = n
gym.Space.__init__(self, (), np.int64)
def sample(self):
return gym.spaces.np_random.randint(s... | 768 | 26.464286 | 120 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/__init__.py | from gym.spaces.box import Box
from gym.spaces.discrete import Discrete
from gym.spaces.multi_discrete import MultiDiscrete
from gym.spaces.multi_binary import MultiBinary
from gym.spaces.prng import seed, np_random
from gym.spaces.tuple_space import Tuple
from gym.spaces.dict_space import Dict
__all__ = ["Box", "Disc... | 376 | 36.7 | 78 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/dict_space.py | import gym
from collections import OrderedDict
class Dict(gym.Space):
"""
A dictionary of simpler spaces.
Example usage:
self.observation_space = spaces.Dict({"position": spaces.Discrete(2), "velocity": spaces.Discrete(3)})
Example usage [nested]:
self.nested_observation_space = spaces.Dict({... | 2,657 | 34.918919 | 109 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/tests/test_spaces.py | import json # note: ujson fails this test due to float equality
import numpy as np
import pytest
from gym.spaces import Tuple, Box, Discrete, MultiDiscrete, MultiBinary, Dict
@pytest.mark.parametrize("space", [
Discrete(3),
Tuple([Discrete(5), Discrete(10)]),
Tuple([Discrete(... | 1,307 | 38.636364 | 105 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/spaces/tests/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/dict.py | import gym
import numpy as np
__all__ = ['FlattenDictWrapper']
class FlattenDictWrapper(gym.ObservationWrapper):
"""Flattens selected keys of a Dict observation space into
an array.
"""
def __init__(self, env, dict_keys):
super(FlattenDictWrapper, self).__init__(env)
self.dict_keys =... | 848 | 28.275862 | 96 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/monitor.py | import gym
from gym import Wrapper
from gym import error, version, logger
import os, json, numpy as np, six
from gym.wrappers.monitoring import stats_recorder, video_recorder
from gym.utils import atomic_write, closer
from gym.utils.json_utils import json_encode_np
FILE_PREFIX = 'openaigym'
MANIFEST_PREFIX = FILE_PREF... | 15,035 | 38.464567 | 302 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/__init__.py | from gym import error
from gym.wrappers.monitor import Monitor
from gym.wrappers.time_limit import TimeLimit
from gym.wrappers.dict import FlattenDictWrapper
| 158 | 30.8 | 48 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/time_limit.py | import time
from gym import Wrapper, logger
class TimeLimit(Wrapper):
def __init__(self, env, max_episode_seconds=None, max_episode_steps=None):
super(TimeLimit, self).__init__(env)
self._max_episode_seconds = max_episode_seconds
self._max_episode_steps = max_episode_steps
self._el... | 1,579 | 34.111111 | 104 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/monitoring/video_recorder.py | import json
import os
import subprocess
import tempfile
import os.path
import distutils.spawn, distutils.version
import numpy as np
from six import StringIO
import six
from gym import error, logger
def touch(path):
open(path, 'a').close()
class VideoRecorder(object):
"""VideoRecorder renders a nice movie of a... | 12,653 | 39.819355 | 327 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/monitoring/stats_recorder.py | import json
import os
import time
from gym import error
from gym.utils import atomic_write
from gym.utils.json_utils import json_encode_np
class StatsRecorder(object):
def __init__(self, directory, file_prefix, autoreset=False, env_id=None):
self.autoreset = autoreset
self.env_id = env_id
... | 3,584 | 33.471154 | 238 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/monitoring/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/monitoring/tests/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/monitoring/tests/test_video_recorder.py | import json
import os
import shutil
import tempfile
import numpy as np
import gym
from gym.wrappers.monitoring.video_recorder import VideoRecorder
class BrokenRecordableEnv(object):
metadata = {'render.modes': [None, 'rgb_array']}
def render(self, mode=None):
pass
class UnrecordableEnv(object):
... | 1,473 | 21.333333 | 64 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/monitoring/tests/helpers.py | import contextlib
import shutil
import tempfile
@contextlib.contextmanager
def tempdir():
temp = tempfile.mkdtemp()
yield temp
shutil.rmtree(temp)
| 160 | 15.1 | 29 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/tests/test_wrappers.py | import gym
from gym import error
from gym import wrappers
import tempfile
import shutil
def test_no_double_wrapping():
temp = tempfile.mkdtemp()
try:
env = gym.make("FrozenLake-v0")
env = wrappers.Monitor(env, temp)
try:
env = wrappers.Monitor(env, temp)
except erro... | 495 | 21.545455 | 60 | py |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/wrappers/tests/__init__.py | 0 | 0 | 0 | py | |
cba-pipeline-public | cba-pipeline-public-master/containernet/ndn-containers/ndn_headless-player/bandits/venv/lib/python3.6/site-packages/gym/utils/json_utils.py | import numpy as np
def json_encode_np(obj):
"""
JSON can't serialize numpy types, so convert to pure python
"""
if isinstance(obj, np.ndarray):
return list(obj)
elif isinstance(obj, np.float32):
return float(obj)
elif isinstance(obj, np.float64):
return float(obj)
el... | 463 | 23.421053 | 63 | py |