Skip to content

Commit

Permalink
Merge pull request #15 from afrancoc2000/afrancoc2000/adapt-to-go
Browse files Browse the repository at this point in the history
Adding Go to the examples
  • Loading branch information
andyz245 authored Jan 12, 2024
2 parents 7bd3401 + aebed58 commit a5e1413
Show file tree
Hide file tree
Showing 10 changed files with 802 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ dist/
.env
*.pyc
*.DS_Store
**/logs
**/logs
.venv/
.vscode/
164 changes: 164 additions & 0 deletions programming/benchmarks/humaneval-go.jsonl

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions programming/executors/factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .py_executor import PyExecutor
from .rs_executor import RsExecutor
from .go_executor import GoExecutor
from .executor_types import Executor
from .leet_executor import LeetExecutor

Expand All @@ -8,7 +9,7 @@ def executor_factory(lang: str, is_leet: bool = False) -> Executor:
if is_leet:
print("Using LeetCode Python executor")
from .leetcode_env.leetcode_env.leetcode_types import ProgrammingLanguage
from .leetcode_env.leetcode_env.utils import PySubmissionFormatter, RsSubmissionFormatter
from .leetcode_env.leetcode_env.utils import PySubmissionFormatter
return LeetExecutor(ProgrammingLanguage.PYTHON3,
PyExecutor(),
PySubmissionFormatter)
Expand All @@ -17,11 +18,20 @@ def executor_factory(lang: str, is_leet: bool = False) -> Executor:
elif lang == "rs" or lang == "rust":
if is_leet:
from .leetcode_env.leetcode_env.leetcode_types import ProgrammingLanguage
from .leetcode_env.leetcode_env.utils import PySubmissionFormatter, RsSubmissionFormatter
from .leetcode_env.leetcode_env.utils import RsSubmissionFormatter
return LeetExecutor(ProgrammingLanguage.RUST,
RsExecutor(),
RsSubmissionFormatter)
else:
return RsExecutor()
elif lang == "go" or lang == "golang":
if is_leet:
from .leetcode_env.leetcode_env.leetcode_types import ProgrammingLanguage
from .leetcode_env.leetcode_env.utils import GoSubmissionFormatter
return LeetExecutor(ProgrammingLanguage.GO,
GoExecutor(),
GoSubmissionFormatter)
else:
return GoExecutor()
else:
raise ValueError(f"Invalid language for executor: {lang}")
Loading

0 comments on commit a5e1413

Please sign in to comment.