Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alex28sh committed Nov 2, 2024
1 parent 068e219 commit 81ee8e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions verified_cogen/runners/rewriters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Tuple, Optional
from typing import Tuple


class Rewriter:
def rewrite(self, prg: str) -> Tuple[str, Optional[str]]: ...
def rewrite(self, prg: str) -> Tuple[str, str]: ...
6 changes: 3 additions & 3 deletions verified_cogen/runners/rewriters/nagini_rewriter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Tuple, Optional, List
from typing import Tuple, List

from verified_cogen.runners.rewriters import Rewriter


class NaginiRewriter(Rewriter):
def rewrite(self, prg: str) -> Tuple[str, Optional[str]]:
def rewrite(self, prg: str) -> Tuple[str, str]:
pos_implications: List[Tuple[int, int]] = []

for idx, line in enumerate(prg.splitlines()):
Expand All @@ -13,7 +13,7 @@ def rewrite(self, prg: str) -> Tuple[str, Optional[str]]:
pos_implications.append((idx + 1, j + 1))

if len(pos_implications) == 0:
return prg, None
return prg, ""

prompt = "Manual inspection revealed occurrences of `==>` operator for implication on the following positions:\n"
prompt += ", ".join(f"({a}, {b})" for a, b in pos_implications) + "\n"
Expand Down
8 changes: 4 additions & 4 deletions verified_cogen/runners/rewriters/nagini_rewriter_fixing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Tuple, Optional, Dict
from typing import Tuple, Optional, Dict, List

from verified_cogen.runners.rewriters.__init__ import Rewriter
from verified_cogen.runners.rewriters.nagini_rewriter import NaginiRewriter
Expand All @@ -12,7 +12,7 @@ def __init__(self, rewriter: Optional[NaginiRewriter] = None):
self.wrapped_rewriter = rewriter

def replace_impl(self, prg: str):
indices = []
indices: List[Tuple[int, str]] = []

for i in range(len(prg) - 2):
if prg[i : i + 3] == "==>":
Expand Down Expand Up @@ -55,8 +55,8 @@ def replace_impl(self, prg: str):

return new_prg

def rewrite(self, prg: str) -> Tuple[str, Optional[str]]:
prompt = ""
def rewrite(self, prg: str) -> Tuple[str, str]:
prompt: str = ""

if self.wrapped_rewriter is not None:
_, prompt = self.wrapped_rewriter.rewrite(prg)
Expand Down

0 comments on commit 81ee8e6

Please sign in to comment.