summaryrefslogtreecommitdiff
path: root/kvmd/aiotools.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-03-22 04:44:07 +0200
committerMaxim Devaev <[email protected]>2023-03-22 04:44:07 +0200
commit22db176ef05df0b49a9e40e3c31c886dfcb710b5 (patch)
tree49e3b409e66706dd327604a72dcaac0583628e38 /kvmd/aiotools.py
parent6c0f5cccb94fc8092a49d90eca89fe89e9cf923a (diff)
removed aiofs
Diffstat (limited to 'kvmd/aiotools.py')
-rw-r--r--kvmd/aiotools.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/kvmd/aiotools.py b/kvmd/aiotools.py
index a5a28fde..c87e8268 100644
--- a/kvmd/aiotools.py
+++ b/kvmd/aiotools.py
@@ -26,7 +26,6 @@ import asyncio
import ssl
import functools
import types
-
import typing
from typing import Callable
@@ -35,10 +34,18 @@ from typing import Coroutine
from typing import TypeVar
from typing import Any
+import aiofiles
+
from .logging import get_logger
# =====
+async def read_file(path: str) -> str:
+ async with aiofiles.open(path) as file:
+ return (await file.read())
+
+
+# =====
def run(coro: Coroutine, final: (Coroutine | None)=None) -> None:
# https://github.com/aio-libs/aiohttp/blob/a1d4dac1d/aiohttp/web.py#L515