Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- 123/instruction.md +3 -0
- 123/task.toml +19 -0
- 125/tests/conftest.py +3 -0
- 125/tests/test_mbpp_2.py +6 -0
- 162/solution/solve.sh +12 -0
- 162/tests/conftest.py +3 -0
- 162/tests/test_mbpp_1.py +6 -0
- 162/tests/test_mbpp_2.py +6 -0
- 252/solution/_reference.py +5 -0
- 252/solution/solution.py +22 -0
- 252/tests/__init__.py +0 -0
- 283/solution/__init__.py +1 -0
- 283/solution/_reference.py +12 -0
- 283/solution/solution.py +22 -0
- 283/solution/solve.sh +12 -0
- 283/task.toml +19 -0
- 283/tests/__init__.py +0 -0
- 283/tests/conftest.py +3 -0
- 283/tests/test_mbpp_0.py +6 -0
- 283/tests/test_mbpp_1.py +6 -0
- 283/tests/test_mbpp_2.py +6 -0
- 293/instruction.md +3 -0
- 293/solution/_reference.py +5 -0
- 293/solution/solution.py +22 -0
- 293/solution/solve.sh +12 -0
- 293/task.toml +19 -0
- 293/tests/__init__.py +0 -0
- 293/tests/conftest.py +3 -0
- 293/tests/test_mbpp_0.py +6 -0
- 293/tests/test_mbpp_1.py +6 -0
- 293/tests/test_mbpp_2.py +6 -0
- 428/instruction.md +3 -0
- 428/solution/__init__.py +1 -0
- 428/solution/_reference.py +14 -0
- 428/solution/solution.py +22 -0
- 428/solution/solve.sh +12 -0
- 428/task.toml +19 -0
- 428/tests/__init__.py +0 -0
- 428/tests/conftest.py +3 -0
- 428/tests/test_mbpp_0.py +6 -0
- 428/tests/test_mbpp_1.py +6 -0
- 432/instruction.md +3 -0
- 432/solution/__init__.py +1 -0
- 432/solution/_reference.py +4 -0
- 432/solution/solution.py +22 -0
- 432/solution/solve.sh +12 -0
- 432/task.toml +19 -0
- 432/tests/__init__.py +0 -0
- 432/tests/conftest.py +3 -0
- 432/tests/test_mbpp_0.py +6 -0
123/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 123
|
| 2 |
+
|
| 3 |
+
Write a function to sum all amicable numbers from 1 to a specified number.
|
123/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/123"
|
| 5 |
+
name = "MBPP — 123"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
125/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
125/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert find_length("11011101100101") == 2
|
162/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
162/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
162/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert sum_series(10) == 30
|
162/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert sum_series(9) == 25
|
252/solution/_reference.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import cmath
|
| 3 |
+
def convert(numbers):
|
| 4 |
+
num = cmath.polar(numbers)
|
| 5 |
+
return (num)
|
252/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
252/tests/__init__.py
ADDED
|
File without changes
|
283/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
283/solution/_reference.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def validate(n):
|
| 3 |
+
for i in range(10):
|
| 4 |
+
temp = n;
|
| 5 |
+
count = 0;
|
| 6 |
+
while (temp):
|
| 7 |
+
if (temp % 10 == i):
|
| 8 |
+
count+=1;
|
| 9 |
+
if (count > i):
|
| 10 |
+
return False
|
| 11 |
+
temp //= 10;
|
| 12 |
+
return True
|
283/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
283/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
283/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/283"
|
| 5 |
+
name = "MBPP — 283"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
283/tests/__init__.py
ADDED
|
File without changes
|
283/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
283/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert validate(1234) == True
|
283/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert validate(51241) == False
|
283/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert validate(321) == True
|
293/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 293
|
| 2 |
+
|
| 3 |
+
Write a function to find the third side of a right angled triangle.
|
293/solution/_reference.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import math
|
| 3 |
+
def otherside_rightangle(w,h):
|
| 4 |
+
s=math.sqrt((w*w)+(h*h))
|
| 5 |
+
return s
|
293/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
293/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
293/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/293"
|
| 5 |
+
name = "MBPP — 293"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
293/tests/__init__.py
ADDED
|
File without changes
|
293/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
293/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert otherside_rightangle(7,8)==10.63014581273465
|
293/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert otherside_rightangle(3,4)==5
|
293/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert otherside_rightangle(7,15)==16.55294535724685
|
428/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 428
|
| 2 |
+
|
| 3 |
+
Write a function to sort the given array by using shell sort.
|
428/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
428/solution/_reference.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def shell_sort(my_list):
|
| 3 |
+
gap = len(my_list) // 2
|
| 4 |
+
while gap > 0:
|
| 5 |
+
for i in range(gap, len(my_list)):
|
| 6 |
+
current_item = my_list[i]
|
| 7 |
+
j = i
|
| 8 |
+
while j >= gap and my_list[j - gap] > current_item:
|
| 9 |
+
my_list[j] = my_list[j - gap]
|
| 10 |
+
j -= gap
|
| 11 |
+
my_list[j] = current_item
|
| 12 |
+
gap //= 2
|
| 13 |
+
|
| 14 |
+
return my_list
|
428/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
428/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
428/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/428"
|
| 5 |
+
name = "MBPP — 428"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
428/tests/__init__.py
ADDED
|
File without changes
|
428/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
428/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert shell_sort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) == [2, 3, 4, 5, 12, 12, 23, 56, 81, 95]
|
428/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert shell_sort([24, 22, 39, 34, 87, 73, 68]) == [22, 24, 34, 39, 68, 73, 87]
|
432/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 432
|
| 2 |
+
|
| 3 |
+
Write a function to find the median length of a trapezium.
|
432/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
432/solution/_reference.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def median_trapezium(base1,base2,height):
|
| 3 |
+
median = 0.5 * (base1+ base2)
|
| 4 |
+
return median
|
432/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
432/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
432/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/432"
|
| 5 |
+
name = "MBPP — 432"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
432/tests/__init__.py
ADDED
|
File without changes
|
432/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
432/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert median_trapezium(15,25,35)==20
|