/
servlamo
/
POP
Обзор
Документация
Войти
/
servlamo
/
POP
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
tests/mods/proc.py
49 строк
1 KB
Pedro Algarvio
Formatting consistency across pop projects
26 окт 2020, 23:42
Не верифицирован
26 окт 2020, 23:42
35f59ab
Код
Авторство
О чём код?
import random async def callback(hub, payload): if "payload" in payload: hub.set_me = payload["payload"]["ret"] return "foo" async def ret(hub): await hub.proc.worker.ret({"ret": "Returned"}) return "inline" async def gen(hub, start, end): for x in range(start, end): yield x def simple_gen(hub, start, end): yield from range(start, end) def init_lasts(hub): hub.LASTS = {} return True def echo_last(hub): """ Return 2 numbers, the second number is new, the first number is the same that was the second number the last time it was called """ next_ = random.randint(0, 50000) if "last" not in hub.LASTS: hub.LASTS["last"] = 0 last = hub.LASTS["last"] hub.LASTS["last"] = next_ return last, next_ def gen_last(hub, num=5): for _ in range(num): next_ = random.randint(0, 50000) if "last" not in hub.LASTS: hub.LASTS["last"] = 0 last = hub.LASTS["last"] hub.LASTS["last"] = next_ yield last, next_