(docs: Iterable[Dict[str, Any]])
| 2824 | task["thread"] = thread |
| 2825 | with _READING_TASK_LOCK: |
| 2826 | _READING_TASKS[task_id] = task |
| 2827 | thread.start() |
| 2828 | return {"task": _reading_task_payload(task), "created_docs": task["created_docs"], "count": len(docs)} |
| 2829 | |
| 2830 | |
| 2831 | def get_reading_reports_task(task_id: str) -> Dict[str, Any]: |
| 2832 | with _READING_TASK_LOCK: |
| 2833 | return {"task": _reading_task_payload(_READING_TASKS.get(str(task_id or "").strip()))} |
| 2834 | |
| 2835 | |
| 2836 | def _doc_payloads(docs: Iterable[Dict[str, Any]]) -> List[Dict[str, Any]]: |
| 2837 | return [ |
| 2838 | { |
| 2839 | "title": doc.get("title"), |
| 2840 | "url": doc.get("url"), |
| 2841 | "doc_token": doc.get("doc_token"), |
| 2842 | "report_path": doc.get("report_path"), |
| 2843 | "report_id": ( |
| 2844 | _report_id( |
| 2845 | Path(doc["report_path"]) |
| 2846 | if Path(doc["report_path"]).is_absolute() |
| 2847 | else (PROJECT_ROOT / str(doc["report_path"])) |
| 2848 | ) |
| 2849 | if doc.get("report_path") |
| 2850 | else "" |
| 2851 | ), |
no test coverage detected