MCPcopy
hub / github.com/tickmao/Novel / _dedupe_by_url

Method _dedupe_by_url

scripts/source_inventory.py:104–115  ·  view source on GitHub ↗
(self, sources: List[Dict])

Source from the content-addressed store, hash-verified

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(

Callers 3

refresh_screened_poolMethod · 0.95
build_inventoryMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected