Commit Graph

97 Commits

Author SHA1 Message Date
Elijah K
a4da53c210 Py36+ syntax in gym/*.py: derived by running pyupgrade --py36-plus gym/*.py and flynt gym --ll 120 (#2473)
Co-authored-by: Ilya Kamen <ilya.kamenshchikov@bosch.com>
2021-11-14 08:50:40 -05:00
Tristan Deleu
d35d211fee Forward environment properties to the wrapper (#2373)
* Forward environment properties to the wrapper, fixes #2175

* Add tests for property forwarding in Wrapper

* Rename klass to class_ in test_core
2021-09-17 18:02:59 -04:00
Paweł Gajewski
ee0a568004 docstring fix for compute_reward (#2380) 2021-09-01 14:12:36 -04:00
J K Terry
267916b9d2 try removing dead code (#2305) 2021-08-10 10:50:59 -04:00
Justin Terry
ddd650a3fe black 2021-08-05 10:35:48 -04:00
Jakob Stigenberg
936dc6de36 mark abstract methods as abstract (#2158)
Co-authored-by: J K Terry <justinkterry@gmail.com>
2021-08-05 10:35:07 -04:00
J K Terry
78d2b512d8 redo black (#2272) 2021-07-29 15:39:42 -04:00
Justin Terry
e9d2c41f2b redo black 2021-07-29 12:42:48 -04:00
Christian Clauss
bb81e141ea Blacken the codebase (#2265) 2021-07-28 20:26:34 -04:00
Jim Turner
abb815c871 Clarify relationship between reset() and RNGs (#2019)
The current docstring for `reset()` seems to indicate that the
environment will be identical after separate calls to `reset()`.
However, the `reset()` function isn't supposed to reset the states of
the environment's RNGs [1]. This change clarifies the relationship
between the `reset()` function and the RNGs.

[1]: https://github.com/openai/gym/issues/250
2020-08-28 14:58:35 -07:00
Dan Timbrell
3bd5ef71c2 Clean some docstrings (#1854)
* add type of argument

* fix typos

* split lines for formatting

* reformat string, add ellipsis, remove r string

* make docstring stylistically consistent

* make docstrings a little more elaboratet

* reduce by 1 space

* make line wrap 120

* remove unnecessary line

* add returns to docstring

* add docstring, make code more pep8 and delete some unused print functions

* more pep8

* file docstring instead of comments

* delete unused variables, add file docstring and add some pep8 spring cleaning

* add file docstring, fix typos and add some pep8 correections

Co-authored-by: Dan <daniel.timbrell@ing.com>
2020-04-24 16:10:27 -05:00
Xingdong Zuo
0cd9266d98 Update core.py (#1627) 2019-10-25 15:48:21 -07:00
Kristian Hartikainen
a49c3e0fc8 Feature/pixel observation wrapper (#1499)
* Implement PixelObservationWrapper

* Change MujocoEnv.render to support custom camera_{name,id}

* Implement tests for PixelObservationWrapper

* Use env.get_pixels instead of direct env.render

* Fix camera_{id,name} check in pixel observation wrapper

* Fix rendering with explicit camera_id

* Add Wrapperget_pixels to allow call to be propagated to wrapped env

* Remove use of unnecessary `get_pixels` method

* Update PixelObservationWrapper to support multiple pixel keys

* Remove unnecessary `rgb_rendering_tracking` argument

* Remove rgb_rendering_tracking logic
2019-08-23 15:02:33 -07:00
pzhokhov
cd7f96e4db add spec property to wrapper to be forwarded to wrapped env. Fixes 1554 (#1574) 2019-06-28 15:27:43 -07:00
Christopher Hesse
cf06aeff9f docstring change, fixes #744 (#1493) 2019-05-24 14:29:01 -07:00
pzhokhov
5861d95ecd fix #1425 (#1459)
* fixes #1266

* test for correct observation space keys in GoalEnv

* fix import leading to test failures

* fix test failures
2019-05-10 15:00:01 -07:00
Xingdong Zuo
e801ccfdb0 [Update core.py] Remove underscore methods and its deprecation warning (#1320)
* Update core.py

* Update core.py

* Update core.py

* Update core.py

* Update core.py

* Update core.py
2019-05-03 14:53:31 -07:00
Yulun Li
3394e24572 Bugfix: wrapper should make spec optional for backward compatibility (#1424) 2019-04-08 19:29:13 -07:00
Xingdong Zuo
5744b25a6c [Update core.py]: support Wrapper for registering global methods with nested wrapping (#1347)
* Update core.py

* Update core.py
2019-03-25 12:11:53 -07:00
Xingdong Zuo
97a416fa14 [Update core.py] Remove unnecessary parts (#1406)
* Update core.py

* Update core.py
2019-03-25 10:23:14 -07:00
Sid Mysore
52e94a2b50 kwargs on reset for Reward and Action Wrapper (#1340) 2019-03-01 14:15:39 -08:00
Will Douglas
b5a3367fd5 Finish removing close as an option from render (#1009)
This cleans up some leftover changes after PR #836
2019-02-25 17:01:54 -07:00
Tom Alcorn
6c7e22245a Implement context handler protocol for Env (#1012)
This enables writing
```
import gym

with gym.make(...) as env:
    ...
```
without the need to remember to call `env.close()` later.
2019-02-25 16:53:58 -07:00
Xingdong Zuo
6497c9f1c6 Delete prng.py (#1196)
* Delete prng.py

Since it seems like this seeding function is rarely used.

* Update __init__.py

* Update kellycoinflip.py

* Update core.py

* Update box.py

* Update discrete.py

* Update multi_binary.py

* Update multi_discrete.py

* Update test_determinism.py

* Update test_determinism.py

* Update test_determinism.py

* Update core.py

* Update box.py

* Update test_determinism.py

* Update core.py

* Update box.py

* Update discrete.py

* Update multi_binary.py

* Update multi_discrete.py

* Update dict_space.py

* Update tuple_space.py

* Update core.py

* Create space.py

* Update __init__.py

* Update __init__.py

* Update box.py

* Update dict_space.py

* Update discrete.py

* Update dict_space.py

* Update multi_binary.py

* Update multi_discrete.py

* Update tuple_space.py

* Update discrete.py

* Update box.py

* Update dict_space.py

* Update multi_binary.py

* Update multi_discrete.py

* Update tuple_space.py

* Update multi_discrete.py

* Update multi_binary.py

* Update dict_space.py

* Update box.py

* Update test_determinism.py

* Update kellycoinflip.py

* Update space.py
2019-01-30 13:39:55 -08:00
Balázs Kossovics
e8349e3668 Fix in keyword with Spaces (#1261)
Binding `__contains__` to the Space class' contains method this way prevents overriding it in subclasses, which leads to `NotImplementedException`s when trying to do things like `2 in gym.spaces.Discrete(2)`.
2019-01-28 14:52:41 -08:00
Alok Singh
6332d4f113 rm unnecessary __contains__ duplicate code (#1147)
`contains` really should not exist when it does exactly what the builtin
magic method `__contains__` was meant for, but that would break backward
compatibility.
2018-08-28 10:51:28 -07:00
Alex Nichol
5404b39d06 remove double-wrap warning (#1061)
* remove double-wrap warning

* remove double-wrap tests
2018-06-04 17:00:27 -04:00
Adam Gleave
0e1fce13d2 Make Wrapper pass-through optional arguments to render (#1055) 2018-05-30 10:38:58 +02:00
Greg Brockman
28df2b1a21 Speed up time for import gym (#1020)
* Improve default import time from 750ms -> 73ms on 2016 Macbook pro

* Support code which expects gym.spaces.foo to work without a direct import of gym.spaces
2018-05-04 09:24:30 -07:00
Matthias Plappert
78c416ef7b New robotics environments (#912) 2018-02-26 17:35:07 +01:00
Glenn Powell
eeabe4f91f Reverting all commits to gym (#887) 2018-02-12 15:17:04 -08:00
Glenn Powell
148e2ec048 Generic interface to propagate custom commands through wrapper/env stack (#873)
* Spaces have a compatible method which determines if 2 Spaces are of the same shape, ignoring bounds.

* Added a command interface for Env/Wrappers

* Made command interface more aligned with gym codebase.  Added CommandWrapper helper class.

* Refactored method names from command to event/broadcast
2018-02-09 14:51:24 -08:00
Szymon Sidor
e775e5a333 add default arguments to gym.Spaces constructor for backwards compatibility 2018-02-08 16:46:25 -08:00
Glenn Powell
7682f7117f Glenn space compatibility (#872)
* Spaces have a compatible method which determines if 2 Spaces are of the same shape, ignoring bounds.

* Comparing compatibility of a Space with None will result in False now
2018-02-08 13:09:28 -08:00
Glenn Powell
2b2460b5c0 Spaces have a compatible method which determines if 2 Spaces are of the same shape, ignoring bounds. (#871) 2018-02-08 12:53:47 -08:00
John Schulman
4c460ba6c8 Cleanup, removal of unmaintained code (#836)
* add dtype to Box

* remove board_game, debugging, safety, parameter_tuning environments

* massive set of breaking changes
- remove python logging module
- _step, _reset, _seed, _close => non underscored method
- remove benchmark and scoring folder

* Improve render("human"), now resizable, closable window.

* get rid of default step and reset in wrappers, so it doesn’t silently fail for people with underscore methods

* CubeCrash unit test environment

* followup fixes

* MemorizeDigits unit test envrionment

* refactored spaces a bit
fixed indentation
disabled test_env_semantics

* fix unit tests

* fixes

* CubeCrash, MemorizeDigits tested

* gym backwards compatibility patch

* gym backwards compatibility, followup fixes

* changelist, add spaces to main namespaces

* undo_logger_setup for backwards compat

* remove configuration.py
2018-01-25 18:20:14 -08:00
John Schulman
dbae2538e8 only close env if it exists (otherwise we get bad stack traces when construction fails) 2017-09-02 18:10:50 -07:00
John Schulman
c13490db86 forward **reset through wrappers 2017-09-02 18:09:44 -07:00
John Schulman
2b30434d14 Make sure env.spec always exists and is valid. (#621)
* Make sure env.spec always exists and is valid. Previously there was an error when you tried to get the string representation of an unregistered env.

* update changelist
2017-06-16 16:35:03 -07:00
Trevor Blackwell
2a0a2a3a2b Forward spec down the tree, rather than copy at init time, since it can be set after wrapping 2017-03-09 18:16:26 -08:00
John Schulman
ed35158524 simplify renderer closing 2017-03-05 20:11:24 -08:00
Greg Brockman
3174039cbf Revert render change for now 2017-03-05 16:30:04 -08:00
Tom Brown
842de12611 Clarify instructions for resolving env.configure related issues 2017-03-05 14:11:43 -08:00
John Schulman
0ee49635f1 add *args, **kwargs to (non-functional) configure 2017-03-05 13:17:32 -08:00
John Schulman
387f14d381 remove configure, simplify core.py 2017-03-05 12:00:51 -08:00
John Schulman
9f23363e17 minor, spelling 2017-02-04 23:35:38 -08:00
John Schulman
518f4b7c4b change auto-configure behavior to unbreak universe 2017-01-04 17:29:32 -08:00
John Schulman
1a06fe0d9b get rid of auto reset 2017-01-03 23:51:25 -08:00
John Schulman
a67653ccb1 cartpole fix (#457)
minor fixes related to configure() and cartpole
2017-01-03 23:19:14 -08:00
Tom Brown
69c1cda01c Downgrade DoubleWrap error to warning 2016-12-28 13:08:47 -08:00