Skip to content

Commit

Permalink
Feat: filter function signatures to prevent error when passing to new…
Browse files Browse the repository at this point in the history
… signature with again()
  • Loading branch information
Bubobubobubobubo committed Jun 19, 2024
1 parent 80dadce commit 4e98343
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sardine_core/scheduler/async_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,15 @@ async def _call_func(self, func, args, kwargs):
"""Calls the given function and optionally applies time shift
according to the `defer_beats` attribute.
"""
signature = inspect.signature(func)
valid_kwargs = {k: v for k, v in kwargs.items() if k in signature.parameters}

if self.defer_beats:
delta = self.clock.time - self._expected_time
shift = self.defer_beats * self.clock.beat_duration - delta
self.time.shift += shift

return await maybe_coro(func, *args, **kwargs)
return await maybe_coro(func, *args, **valid_kwargs)

def _get_period(self, state: Optional[FunctionState]) -> Union[float, int]:
"""
Expand Down

0 comments on commit 4e98343

Please sign in to comment.