diff --git a/asynckivy/_n_frames.py b/asynckivy/_n_frames.py index 3dc3da4..c6aab41 100644 --- a/asynckivy/_n_frames.py +++ b/asynckivy/_n_frames.py @@ -19,7 +19,7 @@ def _resume(dt): @types.coroutine -def one_frame(): +def one_frame(*, _trigger_resume=_trigger_resume): # default引數を使った最適化を試してみる '''(experimental) wait for one frame. @@ -37,7 +37,7 @@ async def async_fn(): yield _waiting.append -async def n_frames(n: int): +async def n_frames(n: int, *, _one_frame=one_frame, _range=range): # default引數を使った最適化を試してみる '''(experimental) wait for the specified number of frames. @@ -53,6 +53,5 @@ async def async_fn(): ''' if n < 0: raise ValueError("Cannot wait for negative number of frames") - _one_frame = one_frame - for __ in range(n): + for __ in _range(n): await _one_frame()