1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-14 04:32:29 +00:00
senpy/tests/sleep_plugin/sleep.py
J. Fernando Sánchez 14c9f61864 Python 3 compatible
There are also some slight changes to the JSON schemas and the use of
JSON-LD.
2016-02-20 16:17:37 +01:00

18 lines
479 B
Python

from senpy.plugins import SenpyPlugin
from senpy.models import Results
from time import sleep
class SleepPlugin(SenpyPlugin):
def __init__(self, info, *args, **kwargs):
super(SleepPlugin, self).__init__(info, *args, **kwargs)
self.timeout = int(info["timeout"])
def activate(self, *args, **kwargs):
sleep(self.timeout)
def analyse(self, *args, **kwargs):
sleep(float(kwargs.get("timeout", self.timeout)))
return Results()