MCPcopy Create free account
hub / github.com/catid/supercharger / handle_code

Method handle_code

codegen/codegen.py:195–220  ·  view source on GitHub ↗
(self, code_id, code, score, improved=False)

Source from the content-addressed store, hash-verified

193 return True
194
195 def handle_code(self, code_id, code, score, improved=False):
196 print(f"Task ID {code_id}: Generated code (improved={improved}) with score {score} and len={len(code)}")
197 #print("Code:", code)
198
199 self.codes.append(code_id)
200 self.contents[code_id] = code
201 self.code_scores[code_id] = score
202
203 write_script_to_disk(
204 code,
205 args.sources_dirname,
206 args.function_name,
207 is_test=False,
208 variation=code_id)
209
210 install_container_requirements(
211 args.sources_dirname,
212 args.function_name,
213 self.docker_execute)
214
215 for test_id in self.tests:
216 self.test_pair(code_id, test_id)
217
218 if not improved:
219 logging.info("Adding a job to improve the code with self-reflection")
220 self.manager.add_improve_code_job(code)
221
222 def handle_test(self, test_id, test, improved=False):
223 print(f"Task ID {test_id}: Generated test (improved={improved}) len={len(test)}")

Callers 1

handle_resultsMethod · 0.95

Calls 4

test_pairMethod · 0.95
write_script_to_diskFunction · 0.85
add_improve_code_jobMethod · 0.80

Tested by

no test coverage detected