MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / confirm_pending_direction_candidate

Function confirm_pending_direction_candidate

config/direction_lexicon.py:812–834  ·  view source on GitHub ↗
(query: str, *, user_id: Optional[str] = None)

Source from the content-addressed store, hash-verified

810
811
812def confirm_pending_direction_candidate(query: str, *, user_id: Optional[str] = None) -> Optional[Dict[str, Any]]:
813 candidate = find_pending_direction_candidate(query, user_id=user_id)
814 if not candidate:
815 return None
816
817 canonical_name = candidate.get("canonical_name") or candidate.get("candidate_key")
818 add_new_direction(
819 direction_key=str(canonical_name),
820 name=str(candidate.get("name") or canonical_name),
821 name_cn=str(candidate.get("name_cn") or candidate.get("name") or canonical_name),
822 aliases=list(candidate.get("source_texts", []) or []),
823 paper_terms=list(candidate.get("paper_terms", []) or candidate.get("source_texts", []) or []),
824 keywords=list(candidate.get("paper_terms", []) or candidate.get("source_texts", []) or []),
825 source_text=str((candidate.get("source_texts") or [""])[0]),
826 )
827
828 store = _load_pending_store()
829 candidate_key = str(candidate.get("candidate_key") or "")
830 if candidate_key in store:
831 store.pop(candidate_key, None)
832 _save_pending_store(store)
833
834 return get_direction_entry(str(canonical_name))
835
836
837if __name__ == "__main__":

Callers 1

Calls 6

add_new_directionFunction · 0.85
_load_pending_storeFunction · 0.85
_save_pending_storeFunction · 0.85
get_direction_entryFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected