MCPcopy Create free account
hub / github.com/evalplus/evalplus / generate

Method generate

evalplus/gen/type_mut.py:321–340  ·  view source on GitHub ↗
(self, num: int)

Source from the content-addressed store, hash-verified

319 self._fetch_list_like(seed_input.values())
320
321 def generate(self, num: int):
322 start = time.time()
323 num_generated = 1
324 while len(self.new_inputs) < num and time.time() - start < self.timeout:
325 if num_generated % 1000 == 0:
326 print(
327 f"generated {num_generated} already with {len(self.new_inputs)} new inputs ... "
328 )
329 new_input = self.seed_selection()
330 # Multi-step instead of single-step
331 for _ in range(random.randint(1, MAX_MULTI_STEP_SIZE)):
332 new_input = self.mutate(new_input)
333 num_generated += 1
334 if hash(str(new_input)) not in self.seed_hash:
335 if trusted_check_exec(self.contract, [new_input], self.entry_point):
336 self.typed_fetch(new_input)
337 self.seed_pool.append(new_input)
338 self.new_inputs.append(new_input)
339 self.seed_hash.add(hash(str(new_input)))
340 return self.new_inputs[:num]

Callers

nothing calls this directly

Calls 4

seed_selectionMethod · 0.95
mutateMethod · 0.95
typed_fetchMethod · 0.95
trusted_check_execFunction · 0.90

Tested by

no test coverage detected