Commit Graph

17 Commits

Author SHA1 Message Date
Mark Towers
bf093c6890 Update the flake8 pre-commit ignores (#2778)
* Remove additional ignores from flake8

* Remove all unused imports

* Remove all unused imports

* Update flake8 and pyupgrade

* F841, removed unused variables

* E731, removed lambda assignment to variables

* Remove E731, F403, F405, F524

* Remove E722, bare exceptions

* Remove E712, compare variable == True or == False to is True or is False

* Remove E402, module level import not at top of file

* Added --pre-file-ignores

* Add --per-file-ignores removing E741, E302 and E704

* Add E741, do not use variables named ‘l’, ‘O’, or ‘I’ to ignore issues in classic control

* Fixed issues for pytest==6.2

* Remove unnecessary # noqa

* Edit comment with the removal of E302

* Added warnings and declared module, attr for pyright type hinting

* Remove unused import

* Removed flake8 E302

* Updated flake8 from 3.9.2 to 4.0.1

* Remove unused variable
2022-04-26 11:18:37 -04:00
Andrea PIERRÉ
e913bc81b8 Improve pre-commit workflow (#2602)
* feat: add `isort` to `pre-commit`

* ci: skip `__init__.py` file for `isort`

* ci: make `isort` mandatory in lint pipeline

* docs: add a section on Git hooks

* ci: check isort diff

* fix: isort from master branch

* docs: add pre-commit badge

* ci: update black + bandit versions

* feat: add PR template

* refactor: PR template

* ci: remove bandit

* docs: add Black badge

* ci: try to remove all `|| true` statements

* ci: remove lint_python job

- Remove `lint_python` CI job
- Move `pyupgrade` job to `pre-commit` workflow

* fix: avoid messing with typing

* docs: add a note on running `pre-cpmmit` manually

* ci: apply `pre-commit` to the whole codebase
2022-03-31 15:50:38 -04:00
Ariel Kwiatkowski
3fa10a2360 Fix return_info for wrappers (#2612)
* Fix `return_info` for Observation wrappers, Atari (?) and framestack

* Make type checkers and IDEs happier

* Merge in #2454

* Update the info dict based on no-op steps
Some type hints

* Bug fix

* Handle resets during frameskip
2022-02-17 12:03:35 -05:00
Ariel Kwiatkowski
925823661d Add options to the signature of env.reset (#2515)
* First find/replace, now tests

* Fixes to the vector env

* Make seed keyword only in wrappers

* (try to) fix the bug with old environments using new wrappers (with the seed keyword)

* black

* Change **kwargs to options, try to make it work; black

* Add OrderEnforcing wrapper to wrapper exports
Add a test for compatibility with old (pybullet-like) envs

* Add OrderEnforcing wrapper to wrapper exports
Add a test for compatibility with old (pybullet-like) envs
black

* Update the env checker

* Update the env checker

* Update the env checker to use inspect (might fail tests, let's see)

* Allow the signature to include kwargs in env_checker

* Minor fix
2022-01-19 17:28:59 -05:00
Ariel Kwiatkowski
c364506710 Seeding update (#2422)
* Ditch most of the seeding.py and replace np_random with the numpy default_rng. Let's see if tests pass

* Updated a bunch of RNG calls from the RandomState API to Generator API

* black; didn't expect that, did ya?

* Undo a typo

* blaaack

* More typo fixes

* Fixed setting/getting state in multidiscrete spaces

* Fix typo, fix a test to work with the new sampling

* Correctly (?) pass the randomly generated seed if np_random is called with None as seed

* Convert the Discrete sample to a python int (as opposed to np.int64)

* Remove some redundant imports

* First version of the compatibility layer for old-style RNG. Mainly to trigger tests.

* Removed redundant f-strings

* Style fixes, removing unused imports

* Try to make tests pass by removing atari from the dockerfile

* Try to make tests pass by removing atari from the setup

* Try to make tests pass by removing atari from the setup

* Try to make tests pass by removing atari from the setup

* First attempt at deprecating `env.seed` and supporting `env.reset(seed=seed)` instead. Tests should hopefully pass but throw up a million warnings.

* black; didn't expect that, didya?

* Rename the reset parameter in VecEnvs back to `seed`

* Updated tests to use the new seeding method

* Removed a bunch of old `seed` calls.

Fixed a bug in AsyncVectorEnv

* Stop Discrete envs from doing part of the setup (and using the randomness) in init (as opposed to reset)

* Add explicit seed to wrappers reset

* Remove an accidental return

* Re-add some legacy functions with a warning.

* Use deprecation instead of regular warnings for the newly deprecated methods/functions
2021-12-08 16:14:15 -05:00
Elijah K
9ae4331dfd Py36+ syntax in gym/wrappers: derived by running pyupgrade --py36-plus gym/wrappers/**.py and flynt gym --ll 120 (#2464)
Co-authored-by: Ilya Kamen <ilya.kamenshchikov@bosch.com>
2021-11-13 19:53:06 -05:00
Ariel Kwiatkowski
d199778b9e Pendulum updates (#2423)
* Pendulum env updates

Simplify the math a bit (no difference in behavior)

* Reorder the clipping of angular velocity

* Bump version of Pendulum

* black

* Update mentions of Pendulum-v0 to Pendulum-v1.
2021-09-25 14:00:28 -04:00
jfpettit
0b07221d84 change FrameStack wrapper to inherit from ObservationWrapper (#2378) 2021-09-01 12:09:43 -04:00
J K Terry
3abd5d55af remove wrapper deprication (#2273) 2021-07-29 17:51:02 -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
Justin Terry
3133e99a64 deprecate built in wrappers for supersuit 2021-07-28 22:21:47 -04:00
Christian Clauss
bb81e141ea Blacken the codebase (#2265) 2021-07-28 20:26:34 -04:00
Kristian Holsheimer
5ff4e7d750 Bug fix, missing attrs: dtype, shape (#1950) 2020-06-19 14:16:02 -07:00
Kristian Holsheimer
074bc269b5 Rewrite LazyFrames.__getitem__ to only decompress if needed (#1906)
* add last_frame property to LazyFrames

* drop LazyFrames.last_frame and rewrite __getitem__ instead
2020-06-05 15:01:04 -07:00
johannespitz
a8a3d36353 Add shape property and equality operation to LazyFrames (#1862)
* Add shape property and equality operation to LazyFrames for simplified usage in tests

* Fix shape property with lz4_compress
2020-04-10 17:10:10 -05:00
Xingdong Zuo
80a6d089b7 [Wrappers]: add LazyFrames, FrameStack (#1485)
* Create frame_stack.py

* Update __init__.py

* Create test_frame_stack.py

* Update test_frame_stack.py

* Update frame_stack.py

* Update test_frame_stack.py

* Update __init__.py

* Update test_frame_stack.py

* Update test_frame_stack.py

* Update frame_stack.py

* Update gym/wrappers/frame_stack.py

Thanks !

Co-Authored-By: Kristian Hartikainen <kristian.hartikainen@gmail.com>

* Update gym/wrappers/frame_stack.py

Thanks !

Co-Authored-By: Kristian Hartikainen <kristian.hartikainen@gmail.com>

* make framestack tests actually run (with and without lz4)
2019-08-23 14:04:11 -07:00