initial
This commit is contained in:
21
ReactDev/utils/file_utils.py
Normal file
21
ReactDev/utils/file_utils.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
def read_file(file_path: str) -> str:
|
||||
"""
|
||||
Читает содержимое файла.
|
||||
"""
|
||||
with open(file_path, "r") as f:
|
||||
return f.read()
|
||||
|
||||
def write_file(file_path: str, content: str):
|
||||
"""
|
||||
Записывает содержимое в файл.
|
||||
"""
|
||||
with open(file_path, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
def create_directory(path: str):
|
||||
"""
|
||||
Создает директорию, если она не существует.
|
||||
"""
|
||||
os.makedirs(path, exist_ok=True)
|
||||
13
ReactDev/utils/logger.py
Normal file
13
ReactDev/utils/logger.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import sys
|
||||
|
||||
def log(message: str, level: str = "info"):
|
||||
"""
|
||||
Логирует сообщения в консоль.
|
||||
"""
|
||||
levels = {
|
||||
"info": "[INFO]",
|
||||
"warning": "[WARNING]",
|
||||
"error": "[ERROR]",
|
||||
}
|
||||
prefix = levels.get(level, "[UNKNOWN]")
|
||||
print(f"{prefix} {message}", file=sys.stderr if level == "error" else sys.stdout)
|
||||
0
ReactDev/utils/prompt_utils.py
Normal file
0
ReactDev/utils/prompt_utils.py
Normal file
Reference in New Issue
Block a user