Skip to content

Commit

Permalink
Commented out verify code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiannis128 committed Sep 4, 2023
1 parent a905326 commit a68419d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions esbmc_ai_lib/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
HelpCommand,
ExitCommand,
OptimizeCodeCommand,
VerifyCodeCommand,
# VerifyCodeCommand,
)

from esbmc_ai_lib.loading_widget import LoadingWidget, create_loading_widget
Expand All @@ -38,7 +38,7 @@
help_command: HelpCommand = HelpCommand()
fix_code_command: FixCodeCommand = FixCodeCommand()
optimize_code_command: OptimizeCodeCommand = OptimizeCodeCommand()
verify_code_command: VerifyCodeCommand = VerifyCodeCommand()
# verify_code_command: VerifyCodeCommand = VerifyCodeCommand()
exit_command: ExitCommand = ExitCommand()

chat: UserChat
Expand Down Expand Up @@ -102,12 +102,6 @@ def check_health() -> None:
sys.exit(3)


def get_src(path: str) -> str:
with open(path, mode="r") as file:
content = file.read()
return str(content)


def print_assistant_response(
chat: UserChat,
response: ChatResponse,
Expand All @@ -133,7 +127,7 @@ def init_commands_list() -> None:
exit_command,
fix_code_command,
optimize_code_command,
verify_code_command,
# verify_code_command,
]
)
help_command.set_commands(commands)
Expand All @@ -150,8 +144,7 @@ def init_commands() -> None:

# Let the AI model know about the corrected code.
fix_code_command.on_solution_signal.add_listener(chat.set_solution)
fix_code_command.on_solution_signal.add_listener(verify_code_command.set_solution)
pass
fix_code_command.on_solution_signal.add_listener(optimize_code_command.set_solution)


def _run_command_mode(
Expand All @@ -172,8 +165,8 @@ def _run_command_mode(
sys.exit(1)
else:
print(solution)
elif command == verify_code_command:
raise NotImplementedError()
# elif command == verify_code_command:
# raise NotImplementedError()
elif command == optimize_code_command:
optimize_code_command.execute(
file_path=get_main_source_file(),
Expand Down Expand Up @@ -279,7 +272,10 @@ def main() -> None:
# Read the source code and esbmc output.
printv("Reading source code...")
print(f"Running ESBMC with {config.esbmc_params}\n")
source_code: str = get_src(get_main_source_file())

# Read source code
with open(get_main_source_file(), mode="r") as file:
source_code: str = file.read()

anim.start("ESBMC is processing... Please Wait")
exit_code, esbmc_output, esbmc_err_output = esbmc(
Expand Down Expand Up @@ -372,6 +368,7 @@ def main() -> None:
command, command_args = parse_command(user_message)
command = command[1:] # Remove the /
if command == fix_code_command.command_name:
# Fix Code command
print()
print("ESBMC-AI will generate a fix for the code...")

Expand All @@ -388,6 +385,7 @@ def main() -> None:
print(f"```\n{solution}\n```")
continue
elif command == optimize_code_command.command_name:
# Optimize Code command
optimize_code_command.execute(
file_path=get_main_source_file(),
source_code=source_code,
Expand Down

0 comments on commit a68419d

Please sign in to comment.