MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / wrapper

Function wrapper

applications/chatdev/chatdev/utils.py:49–66  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

47
48def log_arguments(func):
49 def wrapper(*args, **kwargs):
50 sig = inspect.signature(func)
51 params = sig.parameters
52
53 all_args = {}
54 all_args.update({name: value for name, value in zip(params.keys(), args)})
55 all_args.update(kwargs)
56
57 records_kv = []
58 for name, value in all_args.items():
59 if name in ["self", "chat_env", "task_type"]:
60 continue
61 value = escape_string(value)
62 records_kv.append([name, value])
63 records = f"**[{func.__name__}]**\n\n" + convert_to_markdown_table(records_kv)
64 log_visualize("System", records)
65
66 return func(*args, **kwargs)
67
68 return wrapper
69

Callers

nothing calls this directly

Calls 5

keysMethod · 0.80
escape_stringFunction · 0.70
log_visualizeFunction · 0.70
updateMethod · 0.45

Tested by

no test coverage detected