id
int64
0
458k
file_name
stringlengths
4
119
file_path
stringlengths
14
227
content
stringlengths
24
9.96M
size
int64
24
9.96M
language
stringclasses
1 value
extension
stringclasses
14 values
total_lines
int64
1
219k
avg_line_length
float64
2.52
4.63M
max_line_length
int64
5
9.91M
alphanum_fraction
float64
0
1
repo_name
stringlengths
7
101
repo_stars
int64
100
139k
repo_forks
int64
0
26.4k
repo_open_issues
int64
0
2.27k
repo_license
stringclasses
12 values
repo_extraction_date
stringclasses
433 values
2,289,300
test_envs.py
WindyLab_Gym-PPS/gym/envs/tests/test_envs.py
import pytest import numpy as np from gym import envs from gym.envs.tests.spec_list import spec_list from gym.spaces import Box from gym.utils.env_checker import check_env # This runs a smoketest on each official registered env. We may want # to try also running environments which are not officially registered # env...
2,735
Python
.py
68
33.647059
88
0.656109
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,301
test_envs_semantics.py
WindyLab_Gym-PPS/gym/envs/tests/test_envs_semantics.py
""" Currently disabled since this was done in a very poor way Hashed str representation of objects """ 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_STEPS = 100 episodes = ROLLOUT_STEPS st...
3,577
Python
.py
98
28.479592
111
0.614182
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,302
test_determinism.py
WindyLab_Gym-PPS/gym/envs/tests/test_determinism.py
import numpy as np import pytest 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 environments. env1 = s...
2,863
Python
.py
71
32.338028
87
0.6
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,303
test_registration.py
WindyLab_Gym-PPS/gym/envs/tests/test_registration.py
# -*- coding: utf-8 -*- import gym from gym import error, envs from gym.envs import registration from gym.envs.classic_control import cartpole class ArgumentEnv(gym.Env): def __init__(self, arg1, arg2, arg3): self.arg1 = arg1 self.arg2 = arg2 self.arg3 = arg3 gym.register( id="test.A...
2,244
Python
.py
71
26
86
0.657674
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,304
test_mujoco_v2_to_v3_conversion.py
WindyLab_Gym-PPS/gym/envs/tests/test_mujoco_v2_to_v3_conversion.py
import unittest import numpy as np from gym import envs from gym.envs.tests.spec_list import skip_mujoco, SKIP_MUJOCO_WARNING_MESSAGE def verify_environments_match( old_environment_id, new_environment_id, seed=1, num_actions=1000 ): old_environment = envs.make(old_environment_id) new_environment = envs.ma...
2,439
Python
.py
48
42.979167
86
0.665684
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,305
spec_list.py
WindyLab_Gym-PPS/gym/envs/tests/spec_list.py
from gym import envs, logger import os SKIP_MUJOCO_WARNING_MESSAGE = ( "Cannot run mujoco test (either license key not found or mujoco not" "installed properly)." ) skip_mujoco = not (os.environ.get("MUJOCO_KEY")) if not skip_mujoco: try: import mujoco_py except ImportError: skip_muj...
1,431
Python
.py
48
23.375
80
0.637555
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,306
test_frozenlake_dfs.py
WindyLab_Gym-PPS/gym/envs/tests/test_frozenlake_dfs.py
import pytest import numpy as np from gym.envs.toy_text.frozen_lake import generate_random_map # Test that FrozenLake map generation creates valid maps of various sizes. def test_frozenlake_dfs_map_generation(): def frozenlake_dfs_path_exists(res): frontier, discovered = [], set() frontier.append...
1,224
Python
.py
29
30.034483
80
0.52309
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,307
test_kellycoinflip.py
WindyLab_Gym-PPS/gym/envs/tests/test_kellycoinflip.py
from gym.envs.toy_text.kellycoinflip import KellyCoinflipEnv class TestKellyCoinflipEnv: @staticmethod def test_done_when_reaches_max_wealth(): # https://github.com/openai/gym/issues/1266 env = KellyCoinflipEnv() env.seed(1) env.reset() done = False while not d...
500
Python
.py
13
30.384615
66
0.643892
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,308
guessing_game.py
WindyLab_Gym-PPS/gym/envs/toy_text/guessing_game.py
import numpy as np import gym from gym import spaces from gym.utils import seeding 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 ob...
3,267
Python
.py
80
32.5125
92
0.647264
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,309
cliffwalking.py
WindyLab_Gym-PPS/gym/envs/toy_text/cliffwalking.py
import numpy as np import sys from contextlib import closing from io import StringIO 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 ...
4,116
Python
.py
98
32.938776
94
0.591592
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,310
frozen_lake.py
WindyLab_Gym-PPS/gym/envs/toy_text/frozen_lake.py
import sys from contextlib import closing import numpy as np from io import StringIO 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", ...
5,545
Python
.py
143
27.832168
88
0.512835
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,311
hotter_colder.py
WindyLab_Gym-PPS/gym/envs/toy_text/hotter_colder.py
import numpy as np import gym from gym import spaces from gym.utils import seeding 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 res...
2,401
Python
.py
64
29.0625
85
0.61399
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,312
nchain.py
WindyLab_Gym-PPS/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 h...
2,171
Python
.py
46
39.565217
79
0.660833
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,313
__init__.py
WindyLab_Gym-PPS/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...
556
Python
.py
10
54.6
71
0.8663
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,314
discrete.py
WindyLab_Gym-PPS/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,556
Python
.py
46
27.152174
75
0.610033
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,315
roulette.py
WindyLab_Gym-PPS/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 s spots. If the bet is 0 and a 0 comes up, you win a reward of s-2. If any other number comes up you get a reward of -1. For non-zero bets, if the parity ...
1,397
Python
.py
34
33.323529
94
0.610495
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,316
taxi.py
WindyLab_Gym-PPS/gym/envs/toy_text/taxi.py
import sys from contextlib import closing from io 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.Discr...
7,673
Python
.py
176
30.414773
456
0.499933
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,317
blackjack.py
WindyLab_Gym-PPS/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,978
Python
.py
86
39.023256
80
0.654663
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,318
kellycoinflip.py
WindyLab_Gym-PPS/gym/envs/toy_text/kellycoinflip.py
from scipy.stats import genpareto, norm import numpy as np import gym from gym import spaces from gym.utils import seeding def flip(edge, np_random): return 1 if np_random.uniform() < edge else -1 class KellyCoinflipEnv(gym.Env): """The Kelly coinflip game is a simple gambling introduced by Haghani & Dewey...
11,761
Python
.py
238
39.802521
97
0.639094
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,319
cube_crash.py
WindyLab_Gym-PPS/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,318
Python
.py
148
27.709459
99
0.521283
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,320
memorize_digits.py
WindyLab_Gym-PPS/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,827
Python
.py
129
29.868217
86
0.424055
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,321
__init__.py
WindyLab_Gym-PPS/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
238
Python
.py
4
58.5
68
0.880342
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,322
mountain_car.py
WindyLab_Gym-PPS/gym/envs/classic_control/mountain_car.py
""" http://incompleteideas.net/MountainCar/MountainCar1.cp permalink: https://perma.cc/6Z2N-PFWC """ import math import numpy as np import gym from gym import spaces from gym.utils import seeding class MountainCarEnv(gym.Env): """ Description: The agent (a car) is started at the bottom of a valley. ...
6,141
Python
.py
141
33.957447
88
0.592388
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,323
acrobot.py
WindyLab_Gym-PPS/gym/envs/classic_control/acrobot.py
"""classic Acrobot task""" import numpy as np from numpy import sin, cos, pi from gym import core, spaces from gym.utils import seeding __copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy" __credits__ = [ "Alborz Geramifard", "Robert H. Klein", "Christoph Dann", "William Dabney", "Jonath...
10,723
Python
.py
270
31.718519
93
0.571154
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,324
continuous_mountain_car.py
WindyLab_Gym-PPS/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...
6,795
Python
.py
160
33.1
105
0.590999
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,325
__init__.py
WindyLab_Gym-PPS/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
Python
.py
5
63.8
86
0.877743
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,326
pendulum.py
WindyLab_Gym-PPS/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, g=10.0): self.max_speed = 8 self.max_torque = 2.0 se...
3,139
Python
.py
77
31.61039
86
0.565417
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,327
cartpole.py
WindyLab_Gym-PPS/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): """ Descri...
8,356
Python
.py
197
32.213198
87
0.566486
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,328
rendering.py
WindyLab_Gym-PPS/gym/envs/classic_control/rendering.py
""" 2D rendering framework """ import os 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 import error try: import pyglet except Impo...
13,702
Python
.py
390
26.953846
115
0.587171
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,329
lunar_lander.py
WindyLab_Gym-PPS/gym/envs/box2d/lunar_lander.py
""" Rocket trajectory optimization is a classic topic in Optimal Control. According to Pontryagin's maximum principle it's optimal to fire engine full throttle or turn it off. That's the reason this environment is OK to have discreet actions (engine on or off). The landing pad is always at coordinates (0,0). The coor...
18,642
Python
.py
459
29.535948
120
0.536231
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,330
__init__.py
WindyLab_Gym-PPS/gym/envs/box2d/__init__.py
try: import Box2D 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 except ImportError: Box2D = None
316
Python
.py
8
35.5
82
0.801948
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,331
bipedal_walker.py
WindyLab_Gym-PPS/gym/envs/box2d/bipedal_walker.py
import sys import 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, EzPickle # This is simple 4-joints walker robot envir...
24,191
Python
.py
582
29.853952
141
0.520122
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,332
car_racing.py
WindyLab_Gym-PPS/gym/envs/box2d/car_racing.py
""" Easiest continuous control task to learn from pixels, a top-down racing environment. Discrete control is reasonable in this environment as well, on/off discretization is fine. State consists of STATE_W x STATE_H pixels. The reward is -0.1 every frame and +1000/N for every track tile visited, where N is the total ...
21,173
Python
.py
570
25.468421
88
0.493494
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,333
test_lunar_lander.py
WindyLab_Gym-PPS/gym/envs/box2d/test_lunar_lander.py
import pytest try: import Box2D from .lunar_lander import LunarLander, LunarLanderContinuous, demo_heuristic_lander except ImportError: Box2D = None @pytest.mark.skipif(Box2D is None, reason="Box2D not installed") def test_lunar_lander(): _test_lander(LunarLander(), seed=0) @pytest.mark.skipif(Box2...
664
Python
.py
16
38.3125
87
0.764431
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,334
car_dynamics.py
WindyLab_Gym-PPS/gym/envs/box2d/car_dynamics.py
""" 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 simulation is a bit more detailed, with wheels rotation. Created by Oleg Klimov. Licensed on the same terms as the rest of OpenAI Gym. """ import numpy as np import ...
10,672
Python
.py
284
24.447183
113
0.467227
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,335
sync_vector_env.py
WindyLab_Gym-PPS/gym/vector/sync_vector_env.py
import numpy as np from copy import deepcopy from gym import logger from gym.vector.vector_env import VectorEnv from gym.vector.utils import concatenate, create_empty_array __all__ = ["SyncVectorEnv"] class SyncVectorEnv(VectorEnv): """Vectorized environment that serially runs multiple environments. Parame...
3,991
Python
.py
93
33.612903
86
0.62687
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,336
vector_env.py
WindyLab_Gym-PPS/gym/vector/vector_env.py
import gym from gym.spaces import Tuple from gym.vector.utils.spaces import batch_space __all__ = ["VectorEnv"] class VectorEnv(gym.Env): r"""Base class for vectorized environments. Each observation returned from vectorized environment is a batch of observations for each sub-environment. And :meth:`step...
6,317
Python
.py
150
33.533333
98
0.633628
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,337
async_vector_env.py
WindyLab_Gym-PPS/gym/vector/async_vector_env.py
import numpy as np import multiprocessing as mp import time import sys from enum import Enum from copy import deepcopy from gym import logger from gym.vector.vector_env import VectorEnv from gym.error import ( AlreadyPendingCallError, NoAsyncCallError, ClosedEnvironmentError, CustomSpaceError, ) from g...
17,588
Python
.py
422
29.973934
88
0.565492
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,338
__init__.py
WindyLab_Gym-PPS/gym/vector/__init__.py
try: from collections.abc import Iterable except ImportError: Iterable = (tuple, list) from gym.vector.async_vector_env import AsyncVectorEnv from gym.vector.sync_vector_env import SyncVectorEnv from gym.vector.vector_env import VectorEnv, VectorEnvWrapper __all__ = ["AsyncVectorEnv", "SyncVectorEnv", "Vector...
2,172
Python
.py
54
32.555556
86
0.637702
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,339
spaces.py
WindyLab_Gym-PPS/gym/vector/utils/spaces.py
import numpy as np from collections import OrderedDict from gym.spaces import Space, Box, Discrete, MultiDiscrete, MultiBinary, Tuple, Dict _BaseGymSpaces = (Box, Discrete, MultiDiscrete, MultiBinary) __all__ = ["_BaseGymSpaces", "batch_space"] def batch_space(space, n=1): """Create a (batched) space, containin...
2,849
Python
.py
69
34.492754
84
0.639855
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,340
__init__.py
WindyLab_Gym-PPS/gym/vector/utils/__init__.py
from gym.vector.utils.misc import CloudpickleWrapper, clear_mpi_env_vars from gym.vector.utils.numpy_utils import concatenate, create_empty_array from gym.vector.utils.shared_memory import ( create_shared_memory, read_from_shared_memory, write_to_shared_memory, ) from gym.vector.utils.spaces import _BaseGym...
582
Python
.py
19
27.052632
72
0.731317
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,341
numpy_utils.py
WindyLab_Gym-PPS/gym/vector/utils/numpy_utils.py
import numpy as np from gym.spaces import Space, Tuple, Dict from gym.vector.utils.spaces import _BaseGymSpaces from collections import OrderedDict __all__ = ["concatenate", "create_empty_array"] def concatenate(items, out, space): """Concatenate multiple samples from space into a single object. Parameters...
4,632
Python
.py
114
33.578947
87
0.628177
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,342
shared_memory.py
WindyLab_Gym-PPS/gym/vector/utils/shared_memory.py
import numpy as np import multiprocessing as mp from ctypes import c_bool from collections import OrderedDict from gym import logger from gym.spaces import Tuple, Dict from gym.error import CustomSpaceError from gym.vector.utils.spaces import _BaseGymSpaces __all__ = ["create_shared_memory", "read_from_shared_memory"...
6,695
Python
.py
152
37.177632
87
0.670614
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,343
misc.py
WindyLab_Gym-PPS/gym/vector/utils/misc.py
import contextlib import os __all__ = ["CloudpickleWrapper", "clear_mpi_env_vars"] class CloudpickleWrapper(object): def __init__(self, fn): self.fn = fn def __getstate__(self): import cloudpickle return cloudpickle.dumps(self.fn) def __setstate__(self, ob): import pick...
1,170
Python
.py
33
28.787879
80
0.652753
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,344
test_sync_vector_env.py
WindyLab_Gym-PPS/gym/vector/tests/test_sync_vector_env.py
import pytest import numpy as np from gym.spaces import Box, Tuple from gym.vector.tests.utils import CustomSpace, make_env, make_custom_space_env from gym.vector.sync_vector_env import SyncVectorEnv def test_create_sync_vector_env(): env_fns = [make_env("CubeCrash-v0", i) for i in range(8)] try: en...
3,193
Python
.py
78
34.910256
79
0.676252
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,345
test_vector_env_wrapper.py
WindyLab_Gym-PPS/gym/vector/tests/test_vector_env_wrapper.py
import gym from gym.vector import make from gym.vector import VectorEnvWrapper class DummyWrapper(VectorEnvWrapper): def __init__(self, env): self.env = env self.counter = 0 def reset_async(self): super().reset_async() self.counter += 1 def test_vector_env_wrapper_inheritanc...
461
Python
.py
15
25.666667
51
0.69161
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,346
test_spaces.py
WindyLab_Gym-PPS/gym/vector/tests/test_spaces.py
import pytest import numpy as np from gym.spaces import Box, MultiDiscrete, Tuple, Dict from gym.vector.tests.utils import spaces, custom_spaces, CustomSpace from gym.vector.utils.spaces import _BaseGymSpaces, batch_space expected_batch_spaces_4 = [ Box(low=-1.0, high=1.0, shape=(4,), dtype=np.float64), Box(...
3,308
Python
.py
97
25.556701
84
0.49079
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,347
test_shared_memory.py
WindyLab_Gym-PPS/gym/vector/tests/test_shared_memory.py
import pytest import numpy as np import multiprocessing as mp from multiprocessing.sharedctypes import SynchronizedArray from multiprocessing import Array, Process from collections import OrderedDict from gym.spaces import Box, Tuple, Dict from gym.error import CustomSpaceError from gym.vector.utils.spaces import _Ba...
5,661
Python
.py
140
33.057143
87
0.608783
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,348
test_numpy_utils.py
WindyLab_Gym-PPS/gym/vector/tests/test_numpy_utils.py
import pytest import numpy as np from collections import OrderedDict from gym.spaces import Tuple, Dict from gym.vector.utils.spaces import _BaseGymSpaces from gym.vector.tests.utils import spaces from gym.vector.utils.numpy_utils import concatenate, create_empty_array @pytest.mark.parametrize( "space", spaces...
5,070
Python
.py
114
35.219298
78
0.601989
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,349
test_vector_env.py
WindyLab_Gym-PPS/gym/vector/tests/test_vector_env.py
import pytest import numpy as np from gym.spaces import Tuple from gym.vector.tests.utils import CustomSpace, make_env from gym.vector.async_vector_env import AsyncVectorEnv from gym.vector.sync_vector_env import SyncVectorEnv from gym.vector.vector_env import VectorEnv @pytest.mark.parametrize("shared_memory", [Tr...
2,019
Python
.py
41
42.02439
87
0.703006
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,350
utils.py
WindyLab_Gym-PPS/gym/vector/tests/utils.py
import numpy as np import gym import time from gym.spaces import Box, Discrete, MultiDiscrete, MultiBinary, Tuple, Dict spaces = [ Box(low=np.array(-1.0), high=np.array(1.0), dtype=np.float64), Box(low=np.array([0.0]), high=np.array([10.0]), dtype=np.float32), Box( low=np.array([-1.0, 0.0, 0.0]), ...
3,115
Python
.py
97
24.917526
88
0.573004
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,351
test_async_vector_env.py
WindyLab_Gym-PPS/gym/vector/tests/test_async_vector_env.py
import pytest import numpy as np from multiprocessing import TimeoutError from gym.spaces import Box, Tuple from gym.error import AlreadyPendingCallError, NoAsyncCallError, ClosedEnvironmentError from gym.vector.tests.utils import ( CustomSpace, make_env, make_slow_env, make_custom_space_env, ) from g...
8,268
Python
.py
193
35.694301
87
0.668409
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,352
test_resize_observation.py
WindyLab_Gym-PPS/gym/wrappers/test_resize_observation.py
import pytest import gym from gym.wrappers import ResizeObservation try: import atari_py except ImportError: atari_py = None @pytest.mark.skipif( atari_py is None, reason="Only run this test when atari_py is installed" ) @pytest.mark.parametrize( "env_id", ["PongNoFrameskip-v0", "SpaceInvadersNoFram...
839
Python
.py
25
29.48
76
0.686032
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,353
test_flatten_observation.py
WindyLab_Gym-PPS/gym/wrappers/test_flatten_observation.py
import pytest import numpy as np import gym from gym.wrappers import FlattenObservation from gym import spaces @pytest.mark.parametrize("env_id", ["Blackjack-v0", "KellyCoinflip-v0"]) def test_flatten_observation(env_id): env = gym.make(env_id) wrapped_env = FlattenObservation(env) obs = env.reset() ...
1,014
Python
.py
25
34.48
83
0.643585
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,354
test_transform_observation.py
WindyLab_Gym-PPS/gym/wrappers/test_transform_observation.py
import pytest import numpy as np import gym from gym.wrappers import TransformObservation @pytest.mark.parametrize("env_id", ["CartPole-v1", "Pendulum-v0"]) def test_transform_observation(env_id): affine_transform = lambda x: 3 * x + 2 env = gym.make(env_id) wrapped_env = TransformObservation( g...
836
Python
.py
22
33.590909
75
0.710037
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,355
rescale_action.py
WindyLab_Gym-PPS/gym/wrappers/rescale_action.py
import numpy as np import gym from gym import spaces class RescaleAction(gym.ActionWrapper): r"""Rescales the continuous action space of the environment to a range [min_action, max_action]. Example:: >>> RescaleAction(env, min_action, max_action).action_space == Box(min_action, max_action) T...
1,633
Python
.py
40
31.925
100
0.608833
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,356
test_rescale_action.py
WindyLab_Gym-PPS/gym/wrappers/test_rescale_action.py
import pytest import numpy as np import gym from gym.wrappers import RescaleAction def test_rescale_action(): env = gym.make("CartPole-v1") with pytest.raises(AssertionError): env = RescaleAction(env, -1, 1) del env env = gym.make("Pendulum-v0") wrapped_env = RescaleAction(gym.make("Pen...
768
Python
.py
23
28.521739
64
0.673913
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,357
test_pixel_observation.py
WindyLab_Gym-PPS/gym/wrappers/test_pixel_observation.py
"""Tests for the pixel observation wrapper.""" import pytest import numpy as np import gym from gym import spaces from gym.wrappers.pixel_observation import PixelObservationWrapper, STATE_KEY class FakeEnvironment(gym.Env): def __init__(self): self.action_space = spaces.Box(shape=(1,), low=-1, high=1, ...
4,304
Python
.py
94
36.478723
85
0.644343
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,358
customize_pps.py
WindyLab_Gym-PPS/gym/wrappers/customize_pps.py
import os import json from typing import Any import gym import argparse class PredatorPreySwarmCustomizer(gym.Wrapper): def __init__(self, env, args): super(PredatorPreySwarmCustomizer, self).__init__(env) if isinstance(args, argparse.Namespace): args_ = vars(args).items() eli...
1,514
Python
.py
37
31.810811
135
0.615649
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,359
test_clip_action.py
WindyLab_Gym-PPS/gym/wrappers/test_clip_action.py
import numpy as np import gym from gym.wrappers import ClipAction def test_clip_action(): # mountaincar: action-based rewards make_env = lambda: gym.make("MountainCarContinuous-v0") env = make_env() wrapped_env = ClipAction(make_env()) seed = 0 env.seed(seed) wrapped_env.seed(seed) ...
704
Python
.py
22
26
72
0.616864
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,360
test_record_episode_statistics.py
WindyLab_Gym-PPS/gym/wrappers/test_record_episode_statistics.py
import pytest import gym from gym.wrappers import RecordEpisodeStatistics @pytest.mark.parametrize("env_id", ["CartPole-v0", "Pendulum-v0"]) @pytest.mark.parametrize("deque_size", [2, 5]) def test_record_episode_statistics(env_id, deque_size): env = gym.make(env_id) env = RecordEpisodeStatistics(env, deque_s...
1,430
Python
.py
32
36.75
81
0.623563
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,361
flatten_observation.py
WindyLab_Gym-PPS/gym/wrappers/flatten_observation.py
import gym.spaces as spaces from gym import ObservationWrapper class FlattenObservation(ObservationWrapper): r"""Observation wrapper that flattens the observation.""" def __init__(self, env): super(FlattenObservation, self).__init__(env) self.observation_space = spaces.flatten_space(env.obser...
446
Python
.py
9
44.111111
76
0.755196
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,362
test_atari_preprocessing.py
WindyLab_Gym-PPS/gym/wrappers/test_atari_preprocessing.py
import numpy as np import gym from gym.wrappers import AtariPreprocessing import pytest pytest.importorskip("atari_py") @pytest.fixture(scope="module") def env_fn(): return lambda: gym.make("PongNoFrameskip-v4") def test_atari_preprocessing_grayscale(env_fn): import cv2 env1 = env_fn() env2 = Atar...
3,027
Python
.py
82
28.95122
110
0.595092
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,363
gray_scale_observation.py
WindyLab_Gym-PPS/gym/wrappers/gray_scale_observation.py
import numpy as np from gym.spaces import Box from gym import ObservationWrapper class GrayScaleObservation(ObservationWrapper): r"""Convert the image observation from RGB to gray scale.""" def __init__(self, env, keep_dim=False): super(GrayScaleObservation, self).__init__(env) self.keep_dim ...
1,060
Python
.py
27
30
86
0.61501
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,364
atari_preprocessing.py
WindyLab_Gym-PPS/gym/wrappers/atari_preprocessing.py
import numpy as np import gym from gym.spaces import Box from gym.wrappers import TimeLimit try: import cv2 except ImportError: cv2 = None class AtariPreprocessing(gym.Wrapper): r"""Atari 2600 preprocessings. This class follows the guidelines in Machado et al. (2018), "Revisiting the Arcade Lear...
5,953
Python
.py
146
30.479452
115
0.590218
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,365
pixel_observation.py
WindyLab_Gym-PPS/gym/wrappers/pixel_observation.py
import collections from collections.abc import MutableMapping import copy import numpy as np from gym import spaces from gym import ObservationWrapper STATE_KEY = "state" class PixelObservationWrapper(ObservationWrapper): """Augment observations by pixel values.""" def __init__( self, env, pixels_...
4,658
Python
.py
100
35.27
85
0.621938
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,366
clip_action.py
WindyLab_Gym-PPS/gym/wrappers/clip_action.py
import numpy as np from gym import ActionWrapper from gym.spaces import Box class ClipAction(ActionWrapper): r"""Clip the continuous action within the valid bound.""" def __init__(self, env): assert isinstance(env.action_space, Box) super(ClipAction, self).__init__(env) def action(self, ...
407
Python
.py
10
35.7
77
0.715013
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,367
filter_observation.py
WindyLab_Gym-PPS/gym/wrappers/filter_observation.py
import copy from gym import spaces from gym import ObservationWrapper class FilterObservation(ObservationWrapper): """Filter dictionary observations by their keys. Args: env: The environment to wrap. filter_keys: List of keys to be included in the observations. Raises: ValueError...
2,341
Python
.py
57
29.842105
85
0.604231
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,368
transform_reward.py
WindyLab_Gym-PPS/gym/wrappers/transform_reward.py
from gym import RewardWrapper class TransformReward(RewardWrapper): r"""Transform the reward via an arbitrary function. Example:: >>> import gym >>> env = gym.make('CartPole-v1') >>> env = TransformReward(env, lambda r: 0.01*r) >>> env.reset() >>> observation, reward,...
704
Python
.py
21
26.047619
81
0.595556
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,369
test_gray_scale_observation.py
WindyLab_Gym-PPS/gym/wrappers/test_gray_scale_observation.py
import pytest import numpy as np import gym from gym.wrappers import GrayScaleObservation from gym.wrappers import AtariPreprocessing pytest.importorskip("atari_py") pytest.importorskip("cv2") @pytest.mark.parametrize( "env_id", ["PongNoFrameskip-v0", "SpaceInvadersNoFrameskip-v0"] ) @pytest.mark.parametrize("...
1,270
Python
.py
30
37.833333
87
0.722177
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,370
test_filter_observation.py
WindyLab_Gym-PPS/gym/wrappers/test_filter_observation.py
import pytest import numpy as np import gym from gym import spaces from gym.wrappers.filter_observation import FilterObservation class FakeEnvironment(gym.Env): def __init__(self, observation_keys=("state")): self.observation_space = spaces.Dict( { name: spaces.Box(shape=(2,),...
2,796
Python
.py
64
36.3125
87
0.660767
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,371
__init__.py
WindyLab_Gym-PPS/gym/wrappers/__init__.py
from gym import error from gym.wrappers.monitor import Monitor from gym.wrappers.time_limit import TimeLimit from gym.wrappers.filter_observation import FilterObservation from gym.wrappers.atari_preprocessing import AtariPreprocessing from gym.wrappers.time_aware_observation import TimeAwareObservation from gym.wrapper...
1,077
Python
.py
19
55.684211
78
0.889414
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,372
monitor.py
WindyLab_Gym-PPS/gym/wrappers/monitor.py
import json import os import numpy as np import gym import warnings from gym import Wrapper from gym import error, version, logger 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" MA...
16,078
Python
.py
398
30.819095
302
0.611186
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,373
record_episode_statistics.py
WindyLab_Gym-PPS/gym/wrappers/record_episode_statistics.py
import time from collections import deque import numpy as np import gym class RecordEpisodeStatistics(gym.Wrapper): def __init__(self, env, deque_size=100): super(RecordEpisodeStatistics, self).__init__(env) self.num_envs = getattr(env, "num_envs", 1) self.t0 = ( time.time() ...
2,141
Python
.py
53
29.283019
88
0.571017
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,374
record_video.py
WindyLab_Gym-PPS/gym/wrappers/record_video.py
import os import gym from typing import Callable import warnings from gym.wrappers.monitoring import video_recorder def capped_cubic_video_schedule(episode_id): if episode_id < 1000: return int(round(episode_id ** (1.0 / 3))) ** 3 == episode_id else: return episode_id % 1000 == 0 class Reco...
3,740
Python
.py
91
30.934066
173
0.601875
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,375
transform_observation.py
WindyLab_Gym-PPS/gym/wrappers/transform_observation.py
from gym import ObservationWrapper class TransformObservation(ObservationWrapper): r"""Transform the observation via an arbitrary function. Example:: >>> import gym >>> env = gym.make('CartPole-v1') >>> env = TransformObservation(env, lambda obs: obs + 0.1*np.random.randn(*obs.shape)...
741
Python
.py
19
31.684211
94
0.638655
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,376
test_frame_stack.py
WindyLab_Gym-PPS/gym/wrappers/test_frame_stack.py
import pytest pytest.importorskip("atari_py") import numpy as np import gym from gym.wrappers import FrameStack try: import lz4 except ImportError: lz4 = None @pytest.mark.parametrize("env_id", ["CartPole-v1", "Pendulum-v0", "Pong-v0"]) @pytest.mark.parametrize("num_stack", [2, 3, 4]) @pytest.mark.parametr...
1,387
Python
.py
42
27.642857
77
0.632012
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,377
test_record_video.py
WindyLab_Gym-PPS/gym/wrappers/test_record_video.py
import pytest import os import shutil import gym from gym.wrappers import RecordEpisodeStatistics, RecordVideo def test_record_video_using_default_trigger(): env = gym.make("CartPole-v1") env = gym.wrappers.RecordVideo(env, "videos") env.reset() for _ in range(199): action = env.action_space....
2,115
Python
.py
59
29.050847
87
0.612903
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,378
test_transform_reward.py
WindyLab_Gym-PPS/gym/wrappers/test_transform_reward.py
import pytest import numpy as np import gym from gym.wrappers import TransformReward @pytest.mark.parametrize("env_id", ["CartPole-v1", "Pendulum-v0"]) def test_transform_reward(env_id): # use case #1: scale scales = [0.1, 200] for scale in scales: env = gym.make(env_id) wrapped_env = Tr...
1,669
Python
.py
49
27.959184
87
0.618929
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,379
time_aware_observation.py
WindyLab_Gym-PPS/gym/wrappers/time_aware_observation.py
import numpy as np from gym.spaces import Box from gym import ObservationWrapper class TimeAwareObservation(ObservationWrapper): r"""Augment the observation with current time step in the trajectory. .. note:: Currently it only works with one-dimensional observation space. It doesn't support p...
1,053
Python
.py
24
37.041667
82
0.694417
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,380
resize_observation.py
WindyLab_Gym-PPS/gym/wrappers/resize_observation.py
import numpy as np from gym.spaces import Box from gym import ObservationWrapper class ResizeObservation(ObservationWrapper): r"""Downsample the image observation to a square image.""" def __init__(self, env, shape): super(ResizeObservation, self).__init__(env) if isinstance(shape, int): ...
884
Python
.py
21
34.285714
86
0.655374
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,381
time_limit.py
WindyLab_Gym-PPS/gym/wrappers/time_limit.py
import gym class TimeLimit(gym.Wrapper): def __init__(self, env, max_episode_steps=None): super(TimeLimit, self).__init__(env) if max_episode_steps is None and self.env.spec is not None: max_episode_steps = env.spec.max_episode_steps if self.env.spec is not None: se...
988
Python
.py
23
34.130435
67
0.621228
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,382
frame_stack.py
WindyLab_Gym-PPS/gym/wrappers/frame_stack.py
from collections import deque import numpy as np from gym.spaces import Box from gym import ObservationWrapper class LazyFrames(object): r"""Ensures common frames are only stored once to optimize memory use. To further reduce the memory use, it is optionally to turn on lz4 to compress the observations. ...
3,939
Python
.py
90
35.611111
91
0.641865
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,383
njp.py
WindyLab_Gym-PPS/gym/wrappers/njp.py
import os import json from typing import Any import gym import argparse import numpy as np class Agent: def __init__(self, adversary=False): self.adversary = adversary class NJP(gym.Wrapper): def __init__(self, env, args): super(NJP, self).__init__(env) if isinstance(args, arg...
4,189
Python
.py
99
31.979798
135
0.55704
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,384
test_time_aware_observation.py
WindyLab_Gym-PPS/gym/wrappers/test_time_aware_observation.py
import pytest import gym from gym.wrappers import TimeAwareObservation @pytest.mark.parametrize("env_id", ["CartPole-v1", "Pendulum-v0"]) def test_time_aware_observation(env_id): env = gym.make(env_id) wrapped_env = TimeAwareObservation(env) assert wrapped_env.observation_space.shape[0] == env.observati...
1,058
Python
.py
25
37.8
87
0.66439
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,385
stats_recorder.py
WindyLab_Gym-PPS/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,924
Python
.py
102
27.578431
205
0.573796
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,386
video_recorder.py
WindyLab_Gym-PPS/gym/wrappers/monitoring/video_recorder.py
import json import os import os.path import subprocess import tempfile from io import StringIO import distutils.spawn import distutils.version import numpy as np from gym import error, logger from gym.utils import closer def touch(path): open(path, "a").close() video_recorder_closer = closer.Closer() class ...
16,129
Python
.py
399
28.130326
295
0.538103
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,387
test_video_recorder.py
WindyLab_Gym-PPS/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, video_recorder_closer class BrokenRecordableEnv(object): metadata = {"render.modes": [None, "rgb_array"]} def render(self, mode=None): pass class Unre...
2,137
Python
.py
72
24.305556
87
0.67189
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,388
helpers.py
WindyLab_Gym-PPS/gym/wrappers/monitoring/tests/helpers.py
import contextlib import shutil import tempfile @contextlib.contextmanager def tempdir(): temp = tempfile.mkdtemp() yield temp shutil.rmtree(temp)
161
Python
.py
8
17.375
29
0.794702
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,389
multi_discrete.py
WindyLab_Gym-PPS/gym/spaces/multi_discrete.py
import numpy as np from .space import Space class MultiDiscrete(Space): """ - The multi-discrete action space consists of a series of discrete action spaces with different number of actions in each - It is useful to represent game controllers or keyboards where each key can be represented as a discrete ac...
2,222
Python
.py
41
46.731707
125
0.655268
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,390
dict.py
WindyLab_Gym-PPS/gym/spaces/dict.py
from collections import OrderedDict from .space import Space class Dict(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 = sp...
3,713
Python
.py
96
28.75
106
0.550556
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,391
multi_binary.py
WindyLab_Gym-PPS/gym/spaces/multi_binary.py
import numpy as np from .space import Space class MultiBinary(Space): """ An n-shape binary space. The argument to MultiBinary defines n, which could be a number or a `list` of numbers. Example Usage: >> self.observation_space = spaces.MultiBinary(5) >> self.observation_space.sample() ...
1,485
Python
.py
39
30.102564
90
0.588235
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,392
utils.py
WindyLab_Gym-PPS/gym/spaces/utils.py
from collections import OrderedDict from functools import singledispatch, reduce import numpy as np import operator as op from gym.spaces import Box from gym.spaces import Discrete from gym.spaces import MultiDiscrete from gym.spaces import MultiBinary from gym.spaces import Tuple from gym.spaces import Dict @single...
6,478
Python
.py
162
35.345679
85
0.699232
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,393
box.py
WindyLab_Gym-PPS/gym/spaces/box.py
import numpy as np import warnings from .space import Space from gym import logger class Box(Space): """ A (possibly unbounded) box in R^n. Specifically, a Box represents the Cartesian product of n closed intervals. Each interval has the form of one of [a, b], (-oo, b], [a, oo), or (-oo, oo). Th...
5,707
Python
.py
136
31.875
88
0.586387
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,394
__init__.py
WindyLab_Gym-PPS/gym/spaces/__init__.py
from gym.spaces.space import Space 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.tuple import Tuple from gym.spaces.dict import Dict from gym.spaces.utils import flatdim from gy...
620
Python
.py
24
22.916667
51
0.755892
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,395
discrete.py
WindyLab_Gym-PPS/gym/spaces/discrete.py
import numpy as np from .space import Space class Discrete(Space): r"""A discrete space in :math:`\{ 0, 1, \\dots, n-1 \}`. Example:: >>> Discrete(2) """ def __init__(self, n): assert n >= 0 self.n = n super(Discrete, self).__init__((), np.int64) def sample(sel...
868
Python
.py
27
24.259259
72
0.53911
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,396
space.py
WindyLab_Gym-PPS/gym/spaces/space.py
from gym.utils import seeding class Space(object): """Defines the observation and action spaces, so you can write generic code that applies to any Env. For example, you can choose a random action. WARNING - Custom observation & action spaces can inherit from the `Space` class. However, most use-c...
2,329
Python
.py
51
38.294118
81
0.669757
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,397
tuple.py
WindyLab_Gym-PPS/gym/spaces/tuple.py
import numpy as np from .space import Space class Tuple(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 for space in space...
1,827
Python
.py
51
26.411765
83
0.562677
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,398
test_spaces.py
WindyLab_Gym-PPS/gym/spaces/tests/test_spaces.py
import json # note: ujson fails this test due to float equality from copy import copy import numpy as np import pytest from gym.spaces import Tuple, Box, Discrete, MultiDiscrete, MultiBinary, Dict @pytest.mark.parametrize( "space", [ Discrete(3), Box(low=0.0, high=np.inf, shape=(2, 2)), ...
5,923
Python
.py
173
26.473988
87
0.554993
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)
2,289,399
test_utils.py
WindyLab_Gym-PPS/gym/spaces/tests/test_utils.py
from collections import OrderedDict import numpy as np import pytest from gym.spaces import Box, Dict, Discrete, MultiBinary, MultiDiscrete, Tuple, utils spaces = [ Discrete(3), Box(low=0.0, high=np.inf, shape=(2, 2)), Box(low=0.0, high=np.inf, shape=(2, 2), dtype=np.float16), Tuple([Discrete(5), Di...
9,138
Python
.py
217
36.004608
120
0.645608
WindyLab/Gym-PPS
8
2
1
GPL-2.0
9/5/2024, 10:48:35 PM (Europe/Amsterdam)