mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
removed aiofs
This commit is contained in:
@@ -31,7 +31,7 @@ from ....logging import get_logger
|
||||
|
||||
from .... import env
|
||||
from .... import tools
|
||||
from .... import aiofs
|
||||
from .... import aiotools
|
||||
from .... import aioproc
|
||||
|
||||
from .base import BaseInfoSubmanager
|
||||
@@ -90,7 +90,7 @@ class HwInfoSubmanager(BaseInfoSubmanager):
|
||||
if name not in self.__dt_cache:
|
||||
path = os.path.join(f"{env.PROCFS_PREFIX}/proc/device-tree", name)
|
||||
try:
|
||||
self.__dt_cache[name] = (await aiofs.read(path)).strip(" \t\r\n\0")
|
||||
self.__dt_cache[name] = (await aiotools.read_file(path)).strip(" \t\r\n\0")
|
||||
except Exception as err:
|
||||
get_logger(0).error("Can't read DT %s from %s: %s", name, path, err)
|
||||
return None
|
||||
@@ -99,7 +99,7 @@ class HwInfoSubmanager(BaseInfoSubmanager):
|
||||
async def __get_cpu_temp(self) -> (float | None):
|
||||
temp_path = f"{env.SYSFS_PREFIX}/sys/class/thermal/thermal_zone0/temp"
|
||||
try:
|
||||
return int((await aiofs.read(temp_path)).strip()) / 1000
|
||||
return int((await aiotools.read_file(temp_path)).strip()) / 1000
|
||||
except Exception as err:
|
||||
get_logger(0).error("Can't read CPU temp from %s: %s", temp_path, err)
|
||||
return None
|
||||
|
||||
@@ -24,7 +24,7 @@ import dataclasses
|
||||
|
||||
from ...logging import get_logger
|
||||
|
||||
from ... import aiofs
|
||||
from ... import aiotools
|
||||
|
||||
|
||||
# =====
|
||||
@@ -61,8 +61,7 @@ class VncAuthManager:
|
||||
return ({}, (not self.__enabled))
|
||||
|
||||
async def __inner_read_credentials(self) -> dict[str, VncAuthKvmdCredentials]:
|
||||
lines = (await aiofs.read(self.__path)).split("\n")
|
||||
|
||||
lines = (await aiotools.read_file(self.__path)).split("\n")
|
||||
credentials: dict[str, VncAuthKvmdCredentials] = {}
|
||||
for (lineno, line) in enumerate(lines):
|
||||
if len(line.strip()) == 0 or line.lstrip().startswith("#"):
|
||||
|
||||
Reference in New Issue
Block a user