File: util.py

package info (click to toggle)
slidge 0.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,516 kB
  • sloc: python: 20,548; xml: 518; sh: 57; javascript: 27; makefile: 14
file content (17 lines) | stat: -rw-r--r-- 391 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import asyncio
from pathlib import Path

ASSETS_DIR = Path(__file__).parent / "assets"
if not ASSETS_DIR.exists():
    ASSETS_DIR = Path(__file__).parent.parent / "dev" / "assets"
    if not ASSETS_DIR.exists():
        raise FileNotFoundError


def later(awaitable):
    asyncio.create_task(_later(awaitable))


async def _later(awaitable):
    await asyncio.sleep(0.5)
    await awaitable