Skip to content

Commit

Permalink
Merge pull request #6977 from matham/typing
Browse files Browse the repository at this point in the history
Add some typing to clock
  • Loading branch information
matham committed Jul 4, 2020
2 parents a2e554c + a8120d5 commit 52cf096
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
16 changes: 8 additions & 8 deletions kivy/_clock.pxd
Expand Up @@ -100,13 +100,13 @@ cdef class CyClockBase(object):
cdef public int _del_safe_done

cpdef get_resolution(self)
cpdef create_lifecycle_aware_trigger(
cpdef ClockEvent create_lifecycle_aware_trigger(
self, callback, clock_ended_callback, timeout=*, interval=*, release_ref=*)
cpdef create_trigger(self, callback, timeout=*, interval=*, release_ref=*)
cpdef ClockEvent create_trigger(self, callback, timeout=*, interval=*, release_ref=*)
cpdef schedule_lifecycle_aware_del_safe(self, callback, clock_ended_callback)
cpdef schedule_del_safe(self, callback)
cpdef schedule_once(self, callback, timeout=*)
cpdef schedule_interval(self, callback, timeout)
cpdef ClockEvent schedule_once(self, callback, timeout=*)
cpdef ClockEvent schedule_interval(self, callback, timeout)
cpdef unschedule(self, callback, all=*)
cpdef _release_references(self)
cpdef _process_del_safe_events(self)
Expand All @@ -120,10 +120,10 @@ cdef class CyClockBase(object):

cdef class CyClockBaseFree(CyClockBase):

cpdef create_lifecycle_aware_trigger_free(
cpdef FreeClockEvent create_lifecycle_aware_trigger_free(
self, callback, clock_ended_callback, timeout=*, interval=*, release_ref=*)
cpdef create_trigger_free(self, callback, timeout=*, interval=*, release_ref=*)
cpdef schedule_once_free(self, callback, timeout=*)
cpdef schedule_interval_free(self, callback, timeout)
cpdef FreeClockEvent create_trigger_free(self, callback, timeout=*, interval=*, release_ref=*)
cpdef FreeClockEvent schedule_once_free(self, callback, timeout=*)
cpdef FreeClockEvent schedule_interval_free(self, callback, timeout)
cpdef _process_free_events(self, double last_tick)
cpdef get_min_free_timeout(self)
24 changes: 12 additions & 12 deletions kivy/_clock.pyx
Expand Up @@ -318,7 +318,7 @@ cdef class CyClockBase(object):
'''
pass

cpdef create_lifecycle_aware_trigger(
cpdef ClockEvent create_lifecycle_aware_trigger(
self, callback, clock_ended_callback, timeout=0, interval=False,
release_ref=True):
'''Create a Trigger event similarly to :meth:`create_trigger`, but the event
Expand Down Expand Up @@ -371,7 +371,7 @@ cdef class CyClockBase(object):
ev.release()
return ev

cpdef create_trigger(
cpdef ClockEvent create_trigger(
self, callback, timeout=0, interval=False, release_ref=True):
'''Create a Trigger event. It is thread safe but not ``__del__`` or
``__dealloc__`` safe (see :meth:`schedule_del_safe`).
Expand Down Expand Up @@ -473,7 +473,7 @@ cdef class CyClockBase(object):
'''
self._del_queue.append((callback, None))

cpdef schedule_once(self, callback, timeout=0):
cpdef ClockEvent schedule_once(self, callback, timeout=0):
'''Schedule an event in <timeout> seconds. If <timeout> is unspecified
or 0, the callback will be called after the next frame is rendered.
See :meth:`create_trigger` for advanced scheduling and more details.
Expand Down Expand Up @@ -501,7 +501,7 @@ cdef class CyClockBase(object):
self, False, callback, timeout, self._last_tick, None, True)
return event

cpdef schedule_interval(self, callback, timeout):
cpdef ClockEvent schedule_interval(self, callback, timeout):
'''Schedule an event to be called every <timeout> seconds.
See :meth:`create_trigger` for advanced scheduling and more details.
Expand Down Expand Up @@ -805,7 +805,7 @@ cdef class CyClockBaseFree(CyClockBase):
for creating a free event.
'''

cpdef create_lifecycle_aware_trigger(
cpdef FreeClockEvent create_lifecycle_aware_trigger(
self, callback, clock_ended_callback, timeout=0, interval=False,
release_ref=True):
cdef FreeClockEvent event
Expand All @@ -819,7 +819,7 @@ cdef class CyClockBaseFree(CyClockBase):
event.release()
return event

cpdef create_trigger(
cpdef FreeClockEvent create_trigger(
self, callback, timeout=0, interval=False, release_ref=True):
cdef FreeClockEvent event
if not callable(callback):
Expand All @@ -831,7 +831,7 @@ cdef class CyClockBaseFree(CyClockBase):
event.release()
return event

cpdef schedule_once(self, callback, timeout=0):
cpdef FreeClockEvent schedule_once(self, callback, timeout=0):
cdef FreeClockEvent event
if not callable(callback):
raise ValueError('callback must be a callable, got %s' % callback)
Expand All @@ -840,7 +840,7 @@ cdef class CyClockBaseFree(CyClockBase):
False, self, False, callback, timeout, self._last_tick, None, True)
return event

cpdef schedule_interval(self, callback, timeout):
cpdef FreeClockEvent schedule_interval(self, callback, timeout):
cdef FreeClockEvent event
if not callable(callback):
raise ValueError('callback must be a callable, got %s' % callback)
Expand All @@ -849,7 +849,7 @@ cdef class CyClockBaseFree(CyClockBase):
False, self, True, callback, timeout, self._last_tick, None, True)
return event

cpdef create_lifecycle_aware_trigger_free(
cpdef FreeClockEvent create_lifecycle_aware_trigger_free(
self, callback, clock_ended_callback, timeout=0, interval=False,
release_ref=True):
'''Similar to :meth:`~CyClockBase.create_lifecycle_aware_trigger`, but instead creates
Expand All @@ -866,7 +866,7 @@ cdef class CyClockBaseFree(CyClockBase):
event.release()
return event

cpdef create_trigger_free(
cpdef FreeClockEvent create_trigger_free(
self, callback, timeout=0, interval=False, release_ref=True):
'''Similar to :meth:`~CyClockBase.create_trigger`, but instead creates
a free event.
Expand All @@ -881,7 +881,7 @@ cdef class CyClockBaseFree(CyClockBase):
event.release()
return event

cpdef schedule_once_free(self, callback, timeout=0):
cpdef FreeClockEvent schedule_once_free(self, callback, timeout=0):
'''Similar to :meth:`~CyClockBase.schedule_once`, but instead creates
a free event.
'''
Expand All @@ -893,7 +893,7 @@ cdef class CyClockBaseFree(CyClockBase):
True, self, False, callback, timeout, self._last_tick, None, True)
return event

cpdef schedule_interval_free(self, callback, timeout):
cpdef FreeClockEvent schedule_interval_free(self, callback, timeout):
'''Similar to :meth:`~CyClockBase.schedule_interval`, but instead creates
a free event.
'''
Expand Down
1 change: 0 additions & 1 deletion kivy/base.py
Expand Up @@ -357,7 +357,6 @@ def mainloop(self):
pass

async def async_mainloop(self):
from kivy.base import ExceptionManager, stopTouchApp
while not self.quit and self.status == 'started':
try:
await self.async_idle()
Expand Down

0 comments on commit 52cf096

Please sign in to comment.