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

Function truncate

experiments/human_eval/build_main_human_eval_packet.py:68–73  ·  view source on GitHub ↗
(value: Any, limit: int)

Source from the content-addressed store, hash-verified

66
67
68def truncate(value: Any, limit: int) -> str:
69 text = json.dumps(value, ensure_ascii=False) if isinstance(value, (list, dict)) else str(value or "")
70 text = " ".join(text.split())
71 if len(text) <= limit:
72 return text
73 return text[: max(0, limit - 3)] + "..."
74
75
76def paper_url_from_record(paper: Dict[str, Any]) -> str:

Callers 1

build_rowsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected