* Added docstrings for spaces, WIP
* Formatting changes
* Use raw docstring for Box.sample
* Formatting fix
* Formatting fix
* Use :class:, :meth:, formatting fixes, resolve TODO, use Optional
* Moved pygame imports into render
* Formatting
* Make pygame optional for box2d, try to make formatting work
* fix tests, fix pre-commit.
* Update ci linter config.
* fix type hints for latest pyright version and backward compatibility with numpy <= 1.21.5
* pre-commit.
Co-authored-by: Ariel Kwiatkowski <ariel.j.kwiatkowski@gmail.com>
Co-authored-by: Gianluca De Cola <gianluca.decola@ags-it.com>
* Fix flatten utils to handle Discrete.start
* Fix vector space utils to handle Discrete.start
* More granular dispatch in vector utils
* Fix Box including the high end of the interval
* typing in spaces.Box and spaces.Discrete
* adds typing to dict and tuple spaces
* Typecheck all spaces
* Explicit regex to include all files under space folder
* Style: use native types and __future__ annotations
* Allow only specific strings for Box.is_bounded args
* Add typing to changes from #2517
* Remove Literal as it's not supported by py3.7
* Use more recent version of pyright
* Avoid name clash for type checker
* Revert "Avoid name clash for type checker"
This reverts commit 1aaf3e0e0328171623a17a997b65fe734bc0afb1.
* Ignore the error. It's reported as probable bug at https://github.com/microsoft/pyright/issues/2852
* rebase and add typing for `_short_repr`
* Fixed ordering of space. Added singledispatch utility.
* Added singledispatch utility to vector.utils & changed order of space argument
* Fixed Error from _BaseGymSpaces
* Minor adjustment for Discrete Spaces
* Fixed Tests/ to reflect changes
* Fixed precommit error - custom namespaces
* Concrete Implementations start with _
* add test showing mismatch in flattened space dtype and flattened point dtype
* fix mismatch in flattened space dtype and flattened point dtype
* fix typo
* enhance test to detect when flattened dtype is incorrect
* fix incorrect flattened dtype
* remove inaccurate comment
* change flatten to always use space.dtype
* added testing for unflattened dtypes
* fix unflatten dtypes
* swtich flatten_space to use space.dtype for hardcoded space dtypes
* fix failure in python 3.5
* Add tests for gym.spaces.utils.
* Add docstrings to gym.spaces.utils.
* Remove some trailing whitespace.
* Add gym.spaces.utils.flatten_space.
The new function also is reexported as gym.spaces.flatten_space. It
improves the determination of observation_space in
gym.wrappers.FlattenObservation.
* Produce OrderedDict instead of dict in gym.spaces.unflatten().
`gym.spaces.Dict` is very particular about producing its samples as
`OrderedDict` in order preserve the order of its items. Hence,
`unflatten()` should reproduce this behavior.
* In test_utils.compare_nested, also verify order of OrderedDict items.
* Add examples to flatten_space() docstring.
* Document ``flatten(space, space.sample()) in flatten_space(space)``.
Co-authored-by: Nico Madysa <nico.madysa@tu-dresden.de>
* Respect the order of keys in a Dict's observation space when flattening
Prior to this change, the order of the key/values in the observation was used instead of the order in the Dict's observation space. unflatten already uses the order specified by the Dict's observation space.
* add tests for FlattenObservation