Skip to content

Commit

Permalink
refomat
Browse files Browse the repository at this point in the history
  • Loading branch information
alex28sh committed Sep 24, 2024
1 parent 91e05a7 commit da791a6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions verified_cogen/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ def get_default_parser():
parser.add_argument(
"--output-logging", help="Print logs to standard output", default=False
)
parser.add_argument(
"--parser", help="Parser for rewriting", default="identParser"
)
parser.add_argument("--parser", help="Parser for rewriting", default="identParser")
return parser


Expand Down
5 changes: 2 additions & 3 deletions verified_cogen/runners/parsers/identParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@


class IdentParser(Parser):

def __init__(self):
super().__init__()

def parse(self, text : str) -> str:
return text
def parse(self, text: str) -> str:
return text
3 changes: 1 addition & 2 deletions verified_cogen/runners/parsers/jsonParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@


class JsonParser(Parser):

def __init__(self):
super().__init__()

def parse(self, text: str) -> str:
return json.loads(text)["code"].replace("\\n", "\n")
return json.loads(text)["code"].replace("\\n", "\n")
2 changes: 2 additions & 0 deletions verified_cogen/runners/parsers/parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from abc import abstractmethod
from typing import Any


class Parser:
_instance = None

Expand All @@ -15,6 +16,7 @@ def __init__(self, *args: list[Any], **kwargs: dict[str, Any]): ...
@abstractmethod
def parse(self, text: str) -> str: ...


class ParserDatabase:
_instance = None
parsers: dict[str, Parser] = dict()
Expand Down

0 comments on commit da791a6

Please sign in to comment.