Skip to content

Commit ce3c736

Browse files
committed
🚧 rewrite example notebook
1 parent 072577a commit ce3c736

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎pylib/traopy/example/problems/addition/main.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"metadata": {},
2828
"outputs": [],
2929
"source": [
30-
"judge_env = traopy.PyProcedure()"
30+
"builder = traopy.PRocedureBuilder()"
3131
]
3232
},
3333
{
@@ -37,21 +37,21 @@
3737
"outputs": [],
3838
"source": [
3939
"base_path = Path(\".\").resolve()\n",
40-
"input_text = traopy.PyResourceKind.TextFile(\n",
40+
"input_text = traopy.ResourceKind.TextFile(\n",
4141
" traopy.PyText(\n",
4242
" \"input\",\n",
4343
" f\"{base_path}/testcases/input.txt\",\n",
4444
" )\n",
4545
")\n",
46-
"output_text = traopy.PyResourceKind.TextFile(\n",
46+
"output_text = traopy.ResourceKind.TextFile(\n",
4747
" traopy.PyText(\n",
4848
" \"output\",\n",
4949
" f\"{base_path}/testcases/output.txt\",\n",
5050
" )\n",
5151
")\n",
5252
"\n",
53-
"input_result = judge_env.add_resource(input_text)\n",
54-
"output_result = judge_env.add_resource(output_text)"
53+
"input_result = builder.add_resource(input_text)\n",
54+
"output_result = builder.add_resource(output_text)"
5555
]
5656
},
5757
{
@@ -60,14 +60,14 @@
6060
"metadata": {},
6161
"outputs": [],
6262
"source": [
63-
"actual_output = traopy.PyResourceKind.RuntimeTextFile(\n",
63+
"actual_output = traopy.ResourceKind.RuntimeTextFile(\n",
6464
" traopy.PyRuntimeText(\n",
6565
" \"actual\",\n",
6666
" \"actual\"\n",
6767
" )\n",
6868
")\n",
6969
"\n",
70-
"actual_result = judge_env.add_resource(actual_output)"
70+
"actual_result = builder.add_resource(actual_output)"
7171
]
7272
},
7373
{
@@ -76,12 +76,12 @@
7676
"metadata": {},
7777
"outputs": [],
7878
"source": [
79-
"script = traopy.PyText(\n",
79+
"script = traopy.Text(\n",
8080
" \"script\",\n",
8181
" f\"{base_path}/tester.py\",\n",
8282
")\n",
8383
"\n",
84-
"script_result = judge_env.add_script(script)"
84+
"script_result = builder.add_script(script)"
8585
]
8686
},
8787
{
@@ -90,7 +90,7 @@
9090
"metadata": {},
9191
"outputs": [],
9292
"source": [
93-
"execution = traopy.PyExecution(\n",
93+
"execution = traopy.Execution(\n",
9494
" \"test\",\n",
9595
" script_result,\n",
9696
" [\n",
@@ -105,7 +105,7 @@
105105
" ],\n",
106106
")\n",
107107
"\n",
108-
"execution_result = judge_env.add_execution(execution)"
108+
"execution_result = builder.add_execution(execution)"
109109
]
110110
},
111111
{
@@ -114,7 +114,7 @@
114114
"metadata": {},
115115
"outputs": [],
116116
"source": [
117-
"judge_env.write_to(\"judge_procedure.json\")"
117+
"builder.write_to(\"judge_procedure.json\")"
118118
]
119119
},
120120
{
@@ -124,7 +124,7 @@
124124
"outputs": [],
125125
"source": [
126126
"local_judge = traopy.LocalJudge(base_path.joinpath(\"tempdir\"))\n",
127-
"result = await local_judge.run(judge_env, {\"actual\": \"3\\n\"})\n",
127+
"result = await local_judge.run(builder, {\"actual\": \"3\\n\"})\n",
128128
"import json\n",
129129
"parsed = json.loads(result)\n",
130130
"pretty = json.dumps(parsed, indent=4)\n",

0 commit comments

Comments
 (0)