summaryrefslogtreecommitdiff
path: root/poezio/timed_events.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2017-11-12 15:03:09 +0100
committermathieui <mathieui@mathieui.net>2017-11-12 15:03:09 +0100
commitd55cc5872503567775f0d7a7731d6f489bf2299b (patch)
tree725f9e7b8144d36054447b3c82edfb45bda8df1d /poezio/timed_events.py
parent92496db823db34f7f7fb1ab31eaef093a707c3e8 (diff)
downloadpoezio-d55cc5872503567775f0d7a7731d6f489bf2299b.tar.gz
poezio-d55cc5872503567775f0d7a7731d6f489bf2299b.tar.bz2
poezio-d55cc5872503567775f0d7a7731d6f489bf2299b.tar.xz
poezio-d55cc5872503567775f0d7a7731d6f489bf2299b.zip
yapf -ir
Diffstat (limited to 'poezio/timed_events.py')
-rw-r--r--poezio/timed_events.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/poezio/timed_events.py b/poezio/timed_events.py
index 8ce94407..f203bf19 100644
--- a/poezio/timed_events.py
+++ b/poezio/timed_events.py
@@ -4,7 +4,6 @@
#
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
-
"""
Timed events are the standard way to schedule events for later in poezio.
@@ -15,11 +14,13 @@ Once created, they must be added to the list of checked events with
import datetime
+
class DelayedEvent(object):
"""
A TimedEvent, but with the date calculated from now + a delay in seconds.
Use it if you want an event to happen in, e.g. 6 seconds.
"""
+
def __init__(self, delay, callback, *args):
"""
Create a new DelayedEvent.
@@ -34,12 +35,14 @@ class DelayedEvent(object):
# An asyncio handler, as returned by call_later() or call_at()
self.handler = None
+
class TimedEvent(DelayedEvent):
"""
An event with a callback that is called when the specified time is passed.
The callback and its arguments should be passed as the lasts arguments.
"""
+
def __init__(self, date, callback, *args):
"""
Create a new timed event.