MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / safe_repr

Function safe_repr

internbootcamp/utils/tool_server/worker_server.py:40–47  ·  view source on GitHub ↗

先转字符串,再做日志脱敏,适合打印 dict / list / 任意对象。

(obj)

Source from the content-addressed store, hash-verified

38
39
40def safe_repr(obj) -> str:
41 """
42 先转字符串,再做日志脱敏,适合打印 dict / list / 任意对象。
43 """
44 try:
45 return sanitize_log_message(repr(obj))
46 except Exception:
47 return sanitize_log_message(str(obj))
48
49
50class DistributedWorkerServer:

Callers 4

create_endpointMethod · 0.85
execute_endpointMethod · 0.85
release_endpointMethod · 0.85
calc_reward_endpointMethod · 0.85

Calls 1

sanitize_log_messageFunction · 0.70

Tested by

no test coverage detected