import asyncio
from collections.abc import Awaitable
from pathlib import Path
from typing import Any

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: Awaitable[Any]) -> None:
    asyncio.create_task(_later(awaitable))


async def _later(awaitable: Awaitable[Any]) -> None:
    await asyncio.sleep(0.5)
    await awaitable
