def import_special(env,i_lines): utils.update_env(env, importlib.import_module("standard_lib")) #always import the standard_lib first because things get overwritten for line in i_lines: filename = line.replace("import","").replace(".py","").strip() if DEBUG: print("importing:",filename) f = importlib.import_module(filename) env = utils.update_env(env,f) return env
def __next__(self): if self.next_proof_idx >= len(self.proofs): # no more theorem raise StopIteration next_proof = self.proofs[self.next_proof_idx] self.env = update_env(self.env, next_proof['env_delta']) del next_proof['env_delta'] next_proof['env'] = self.env if self.serapi.dead: self.serapi = self.initialize_serapi() self.cmd_idx = 0 elif self.next_proof_idx > 0: # rollback to the start of the current proof self.serapi.pop() if self.next_proof_idx > 0 and self.next_proof_idx % 30 == 0: # renew the SerAPI to prevent stack overflow self.serapi.clean() self.serapi = self.initialize_serapi() self.cmd_idx = 0 while self.cmd_idx <= next_proof['line_nb']: cmd, _ = self.vernac_cmds[self.cmd_idx] self.serapi.execute(cmd) self.cmd_idx += 1 self.serapi.push() self.next_proof_idx += 1 return ProofEnv(next_proof, self.serapi, self.max_num_tactics, self.timeout)