Add and refine type annotations in mesa.time.event#3412
Add and refine type annotations in mesa.time.event#3412Tushar1733 wants to merge 5 commits intomesa:mainfrom
Conversation
|
Performance benchmarks:
|
| self, | ||
| time: int | float, | ||
| function: Callable, | ||
| function: Callable[..., Any], |
There was a problem hiding this comment.
can you explain how to read this typing information.
There was a problem hiding this comment.
Callable[..., Any] means the function can take any arguments and return any type. Since event callbacks may have different signatures, this keeps the typing flexible while being more explicit than a plain Callable.
There was a problem hiding this comment.
Please remove the changes to agentset.py. They are not part of this PR given your description.
There was a problem hiding this comment.
Thanks for the feedback.
I noticed that the PR was created from main, which included unintended changes (e.g., in agentset.py).
I’ll create a clean branch with only the event module changes and open a new PR shortly.
This PR improves type annotations in the
mesa.time.eventmodule.Changes include:
__getstate__,__setstate__, and other methodsCallableannotations toCallable[..., Any]EventandEventGeneratorNo functional changes were made.