-
-
Notifications
You must be signed in to change notification settings - Fork 446
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When I run pre-commit run --all-files
, I get the following error:
/home/albert-han/PettingZoo/pettingzoo/utils/average_total_reward.py
/home/albert-han/PettingZoo/pettingzoo/utils/average_total_reward.py:37:40 - error: Argument of type "int | list[int] | list[list[int]] | list[list[list[Any]]]" cannot be assigned to parameter "seq" of type "SupportsLenAndGetItem[_T@choice]" in function "choice"
Type "int | list[int] | list[list[int]] | list[list[list[Any]]]" cannot be assigned to type "SupportsLenAndGetItem[_T@choice]"
"int" is incompatible with protocol "SupportsLenAndGetItem[_T@choice]"
"__len__" is not present
"__getitem__" is not present (reportGeneralTypeIssues)
/home/albert-han/PettingZoo/pettingzoo/utils/random_demo.py
/home/albert-han/PettingZoo/pettingzoo/utils/random_demo.py:26:40 - error: Argument of type "int | list[int] | list[list[int]] | list[list[list[Any]]]" cannot be assigned to parameter "seq" of type "SupportsLenAndGetItem[_T@choice]" in function "choice"
Type "int | list[int] | list[list[int]] | list[list[list[Any]]]" cannot be assigned to type "SupportsLenAndGetItem[_T@choice]"
"int" is incompatible with protocol "SupportsLenAndGetItem[_T@choice]"
"__len__" is not present
"__getitem__" is not present (reportGe
These pyright errors seem valid to me as tolist()
's return type includes a scalar, and random.choice()
doesn't accept scalar values as arguments.
Code example
Following line causes a pyright error:
action = random.choice(np.flatnonzero(obs["action_mask"]).tolist())
System info
No response
Additional context
No response
Checklist
- I have checked that there is no similar issue in the repo
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working