refactor: убрал лишние импорты

This commit is contained in:
whymequestion 2026-03-12 00:12:07 +05:00
parent f12e0905f6
commit e5adaf8526
2 changed files with 18 additions and 4 deletions

View File

@ -1,9 +1,7 @@
pyTelegramBotAPI
aiomysql
python-dotenv
msgpack
lz4
websockets
pydantic
aiohttp
aiosqlite

View File

@ -1,6 +1,22 @@
import os
from dotenv import load_dotenv
load_dotenv()
from pathlib import Path
def _load_dotenv():
env_path = Path(".env")
if not env_path.is_file():
return
with open(env_path, encoding="utf-8") as f:
for line in f:
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
key, _, value = line.partition("=")
key = key.strip()
value = value.strip().strip("\"'")
if key and key not in os.environ:
os.environ[key] = value
_load_dotenv()
class ServerConfig:
def __init__(self):