formatting

This commit is contained in:
AF 2023-10-02 16:55:58 +00:00
parent cd03009eed
commit 89ac8a491b
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import asyncio
import aiohttp
@ -54,7 +56,7 @@ class AppContext:
task = asyncio.create_task(start_app(app))
return app, task
async def __aenter__(self) -> "AppContext":
async def __aenter__(self) -> AppContext:
self.__task: asyncio.Task[tuple[web.Application, asyncio.Task[None]] | None] = asyncio.create_task(self.start())
return self

View File

@ -1,7 +1,9 @@
from __future__ import annotations
import asyncio
import traceback
from contextlib import AsyncExitStack
from typing import AsyncIterable, Callable, TypeVar
from typing import AsyncIterable, TypeVar
import discord
@ -106,7 +108,7 @@ class MainService:
async def create(self, guild: discord.Guild) -> MainAudio:
return await MainAudio.create(self.__servicing, self.__volumes, self.__queues, guild)
async def __aenter__(self) -> "MainService":
async def __aenter__(self) -> MainService:
async with AsyncExitStack() as es:
self.__locks = Locks()
self.__volumes = await es.enter_async_context(DbFactory(myroot / "volume.db", kvfactory=KVJson()))
@ -120,6 +122,7 @@ class MainService:
self.register_instrumentation()
self.__es = es.pop_all()
return self
raise RuntimeError
async def __aexit__(self, exc_type, exc_val, exc_tb):
async with self.__es: