(paper: Dict[str, Any], number: int)
| 270 | |
| 271 | |
| 272 | def _paper_card(paper: Dict[str, Any], number: int) -> Dict[str, Any]: |
| 273 | metadata = _paper_metadata(paper) |
| 274 | authors = paper.get("authors") or [] |
| 275 | if isinstance(authors, str): |
| 276 | authors = _load_json(authors, [authors]) |
| 277 | categories = paper.get("categories") or metadata.get("categories") or [] |
| 278 | if isinstance(categories, str): |
| 279 | categories = _load_json(categories, [categories]) |
| 280 | |
| 281 | return { |
| 282 | "number": number, |
| 283 | "id": paper.get("id"), |
| 284 | "arxiv_id": _paper_arxiv_id(paper, metadata), |
| 285 | "doi": _paper_doi(paper, metadata), |
| 286 | "title": str(paper.get("title") or "Untitled"), |
| 287 | "authors": authors[:8] if isinstance(authors, list) else [], |
| 288 | "abstract": str(paper.get("abstract") or ""), |
| 289 | "category": paper.get("category") or metadata.get("category") or "unknown", |
| 290 | "score": _to_float(paper.get("score") or metadata.get("score")), |
| 291 | "rank": paper.get("rank") or metadata.get("rank") or number, |
| 292 | "source": paper.get("source") or metadata.get("source") or "", |
| 293 | "venue": paper.get("venue") or paper.get("journal") or metadata.get("venue") or "", |
| 294 | "publish_date": paper.get("publish_date") or metadata.get("publish_date") or "", |
| 295 | "categories": categories if isinstance(categories, list) else [], |
| 296 | "url": _paper_url(paper, metadata), |
| 297 | "pdf_url": _paper_pdf_url(paper, metadata), |
| 298 | "metadata": metadata, |
| 299 | } |
| 300 | |
| 301 | |
| 302 | def _push_payload(push: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]: |
no test coverage detected