- копирую модуль upload/ из drhider (слои 1-2) - blueprint: параметр sink (drhider-сессия по умолчанию, сверка — DB+парсинг) - upload_bp: contracts_upload_sink = _store_and_parse - routes: регистрирую create_upload_refs_blueprint(cfg, sink=...) - app.py: корень репо в sys.path (для import upload) - History: план переиспользования + ревью Соннета
24 lines
552 B
Python
24 lines
552 B
Python
"""create_session — создать новую сессию."""
|
|
|
|
import threading
|
|
import uuid
|
|
|
|
from .state import _sessions, _lock, _start_timer
|
|
|
|
|
|
def create_session() -> str:
|
|
"""Создать новую сессию.
|
|
|
|
Returns:
|
|
Уникальный идентификатор сессии (UUID).
|
|
"""
|
|
sid = uuid.uuid4().hex
|
|
with _lock:
|
|
_sessions[sid] = {
|
|
"files": [],
|
|
"result": None,
|
|
"cancel": threading.Event(),
|
|
"timer": _start_timer(sid),
|
|
}
|
|
return sid
|