(self, sources: List[Dict])
| 102 | temp_path.unlink() |
| 103 | |
| 104 | def _dedupe_by_url(self, sources: List[Dict]) -> List[Dict]: |
| 105 | best_by_url: Dict[str, Dict] = {} |
| 106 | for source in sources: |
| 107 | url = str(source.get("bookSourceUrl", "")).strip() |
| 108 | if not url: |
| 109 | continue |
| 110 | score = float(source.get("selectionScore") or source.get("score") or 0) |
| 111 | existing = best_by_url.get(url) |
| 112 | existing_score = float(existing.get("selectionScore") or existing.get("score") or 0) if existing else -1 |
| 113 | if not existing or score >= existing_score: |
| 114 | best_by_url[url] = source |
| 115 | return list(best_by_url.values()) |
| 116 | |
| 117 | def _sort_sources(self, sources: List[Dict]) -> List[Dict]: |
| 118 | return sorted( |
no outgoing calls
no test coverage detected