(
profile: Dict[str, Any],
selected_papers: Optional[List[Dict]],
)
| 293 | |
| 294 | def _select_hidden_anchor_from_trigger( |
| 295 | profile: Dict[str, Any], |
| 296 | selected_papers: Optional[List[Dict]], |
| 297 | ) -> Optional[str]: |
| 298 | shift_topics = _candidate_shift_topics(profile) |
| 299 | if not shift_topics: |
| 300 | return None |
| 301 | |
| 302 | if selected_papers: |
| 303 | topic_hits = { |
| 304 | topic: _keyword_hit_count(selected_papers, _direction_match_terms(topic)) |
| 305 | for topic in shift_topics |
| 306 | } |
| 307 | ranked = sorted(topic_hits.items(), key=lambda item: (-item[1], item[0])) |
| 308 | if ranked and ranked[0][1] > 0: |
| 309 | return ranked[0][0] |
| 310 | |
| 311 | return shift_topics[0] |
| 312 | |
| 313 | |
| 314 | def _activate_anchor_from_checkfile( |
| 315 | profile: Dict[str, Any], |
no test coverage detected