MCPcopy Create free account
hub / github.com/THUDM/AgentBench / remove_unused

Method remove_unused

src/typings/config.py:97–128  ·  view source on GitHub ↗
(
            target: Union[DefinitionConfig, ConcurrencyConfig], warning_suffix: str
        )

Source from the content-addressed store, hash-verified

95 ), f"Concurrency of {task} is not specified."
96
97 def remove_unused(
98 target: Union[DefinitionConfig, ConcurrencyConfig], warning_suffix: str
99 ):
100 nonlocal agent_in_assignment, task_in_assignment
101 removed_agents = set()
102 removed_tasks = set()
103
104 for definition_agent in target.agent.keys():
105 if definition_agent not in agent_in_assignment:
106 removed_agents.add(definition_agent)
107
108 for definition_task in target.task.keys():
109 if definition_task not in task_in_assignment:
110 removed_tasks.add(definition_task)
111
112 if len(removed_agents) > 0 or len(removed_tasks) > 0:
113
114 print(
115 ColorMessage.yellow(
116 f"Warning: {len(removed_agents)} agent(s) and {len(removed_tasks)} task(s) are "
117 + warning_suffix
118 ),
119 file=sys.stderr,
120 )
121 print(ColorMessage.yellow(f" Agent: {removed_agents}"))
122 print(ColorMessage.yellow(f" Task: {removed_tasks}"))
123
124 for agent in removed_agents:
125 target.agent.pop(agent)
126
127 for task in removed_tasks:
128 target.task.pop(task)
129
130 if REMOVE_UNUSED_IN_DEFINITION:
131 remove_unused(

Callers

nothing calls this directly

Calls 1

yellowMethod · 0.80

Tested by

no test coverage detected