Refactor logging, clean dead code, fix temp files and async tasks

- Replace f-string logging with % formatting throughout
- Fix create_temp_file: use mkstemp() instead of mkdtemp() (no leaked dirs)
- Add cleanup background thread and copy.deepcopy to AsyncTaskManager
- Fix transcribe_audio_async signature to accept transcription_service + params
- Use resample_poly instead of scipy_resample for better audio quality
- Remove unused validate_file/BinaryIO methods from FileValidator
- Add requests to requirements.txt
- Add error handling for pip install in server.sh
- Add __all__ and module docstrings to __init__.py files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Serge Zaigraeff
2026-03-31 00:43:53 +03:00
co-authored by Claude Sonnet 4.6
parent 1e778cae86
commit ca2e41e0f5
13 changed files with 60 additions and 127 deletions
+1
View File
@@ -0,0 +1 @@
"""Модуль core — основные компоненты сервиса распознавания речи."""
+3 -3
View File
@@ -27,11 +27,11 @@ def load_config(config_path: str) -> Dict:
try:
with open(config_path, "r", encoding="utf-8") as f:
config = json.load(f)
logger.info(f"Конфигурация успешно загружена из {config_path}")
logger.info("Конфигурация успешно загружена из %s", config_path)
return config
except FileNotFoundError as e:
logger.error(f"Файл конфигурации не найден: {e}")
logger.error("Файл конфигурации не найден: %s", e)
raise
except json.JSONDecodeError as e:
logger.error(f"Ошибка при загрузке конфигурации: {e}")
logger.error("Ошибка при загрузке конфигурации: %s", e)
raise