[Proposal] Type Hint Error in `async_vector_env`'s `_raise_if_errors` Method Argument
helpingstar opened this issue · comments
Proposal
In the AsyncVectorEnv(VectorEnv)
class, the def _raise_if_errors(self, successes: list[bool]):
method specifies the type hint for successes
as list[bool]
.
This method is called by the *_wait
, _check_spaces
, set_attr
methods.
However, except for step_wait
, all of these use the result of zip()
as the argument for success
.
Gymnasium/gymnasium/vector/async_vector_env.py
Lines 298 to 299 in 94a7909
Gymnasium/gymnasium/vector/async_vector_env.py
Lines 481 to 482 in 94a7909
Gymnasium/gymnasium/vector/async_vector_env.py
Lines 528 to 529 in 94a7909
Gymnasium/gymnasium/vector/async_vector_env.py
Lines 595 to 596 in 94a7909
According to the documentation, the zip()
function returns an iterator of tuples
Returns an iterator of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables.
Motivation
No response
Pitch
I recommend updating the type hint to def _raise_if_errors(self, successes: list[bool] | tuple[bool]):
to accurately reflect the data types that may be passed to this method.
Alternatives
No response
Additional context
I categorized the issue as a "Proposal" because it doesn't cause a bug.
If my suggestion is right, I'll PR it.
Checklist
- I have checked that there is no similar issue in the repo
Sure, I would be happy to update the type hints for it. Could you make a PR for it?