Including submission output content if error
Browse files
data/2022_1/execution_2022_1.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d326974c7c60809c127743bb84fc5915ef73b0b35a47cf35a91d58a166662224
|
3 |
+
size 216790595
|
data/2022_2/execution_2022_2.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:381cea3acdd03e906a28057e3050dd7bd9f0b6b994d2ac9dc192ba794ebfb7a4
|
3 |
+
size 150986252
|
data/2023_1/execution_2023_1.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d800a4007244e5907b71486afa3061bf51e82614582dcd12584401e7a206010d
|
3 |
+
size 241671163
|
data/2023_2/execution_2023_2.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ef359cc9bc49642f70216f39e937bd2a6e5aeaeb7633e8150986e62bf691d096
|
3 |
+
size 212906617
|
data/2024_1/execution_2024_1.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3999adc837c91942af8a083f1d689ef3ff5bdd2af6225a9bdd564137407277dc
|
3 |
+
size 232638959
|
src/__pycache__/execution.cpython-312.pyc
CHANGED
Binary files a/src/__pycache__/execution.cpython-312.pyc and b/src/__pycache__/execution.cpython-312.pyc differ
|
|
src/execution.py
CHANGED
@@ -72,8 +72,9 @@ def _extract_submission(block: str):
|
|
72 |
Extract from a SUBMISSION/SUBMITION block:
|
73 |
- execution_time (float, seconds)
|
74 |
- grade (float, percent 0..100)
|
75 |
-
- testcases (list of dicts with index, input, correct_output, user_output)
|
76 |
-
-
|
|
|
77 |
"""
|
78 |
lines = block.splitlines()
|
79 |
_, after_code_idx = _extract_code(block)
|
@@ -82,7 +83,8 @@ def _extract_submission(block: str):
|
|
82 |
execution_time = None
|
83 |
grade = None
|
84 |
testcases = []
|
85 |
-
output_lines = []
|
|
|
86 |
|
87 |
i = scan_start
|
88 |
while i < len(lines):
|
@@ -100,6 +102,21 @@ def _extract_submission(block: str):
|
|
100 |
i += 1
|
101 |
continue
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
# -- TEST CASE N:
|
104 |
if low.startswith("-- test case"):
|
105 |
idx = None
|
@@ -112,27 +129,20 @@ def _extract_submission(block: str):
|
|
112 |
j = i + 1
|
113 |
current = {"index": idx, "input": "", "correct_output": "", "user_output": ""}
|
114 |
active = None
|
115 |
-
|
116 |
output_lines.append(lines[i]) # keep the "-- TEST CASE ..." line
|
117 |
|
118 |
while j < len(lines):
|
119 |
sraw = lines[j].rstrip("\n")
|
120 |
slow = sraw.strip().lower()
|
121 |
-
|
122 |
if slow.startswith("-- test case") or slow.startswith("-- grade:"):
|
123 |
break
|
124 |
-
|
125 |
output_lines.append(sraw)
|
126 |
-
|
127 |
if slow.startswith("---- input:"):
|
128 |
-
active = "input"
|
129 |
-
current["input"] = ""
|
130 |
elif slow.startswith("---- correct output:"):
|
131 |
-
active = "correct_output"
|
132 |
-
current["correct_output"] = ""
|
133 |
elif slow.startswith("---- user output:"):
|
134 |
-
active = "user_output"
|
135 |
-
current["user_output"] = ""
|
136 |
else:
|
137 |
if active:
|
138 |
current[active] += (sraw + "\n")
|
@@ -143,6 +153,7 @@ def _extract_submission(block: str):
|
|
143 |
|
144 |
testcases.append(current)
|
145 |
i = j
|
|
|
146 |
continue
|
147 |
|
148 |
# -- GRADE:
|
@@ -155,17 +166,17 @@ def _extract_submission(block: str):
|
|
155 |
except:
|
156 |
pass
|
157 |
output_lines.append(lines[i])
|
158 |
-
if val:
|
159 |
-
output_lines.append(val)
|
160 |
i += 1
|
161 |
continue
|
162 |
|
163 |
i += 1
|
164 |
|
165 |
-
|
166 |
-
|
|
|
|
|
167 |
|
168 |
-
return execution_time, grade, testcases, output_content
|
169 |
|
170 |
|
171 |
def parse_execution_data(full_path):
|
@@ -211,9 +222,7 @@ def parse_execution_data(full_path):
|
|
211 |
if tnorm == "test":
|
212 |
output_type, output_content = _extract_test_output(block)
|
213 |
elif tnorm in ("submission", "submition", "submit"):
|
214 |
-
execution_time, grade, testcases, output_content = _extract_submission(block)
|
215 |
-
output_type = "stdout" if output_content else None
|
216 |
-
|
217 |
|
218 |
rows.append({
|
219 |
"user": user,
|
|
|
72 |
Extract from a SUBMISSION/SUBMITION block:
|
73 |
- execution_time (float, seconds)
|
74 |
- grade (float, percent 0..100)
|
75 |
+
- testcases (list of dicts with index, input, correct_output, user_output) OR None
|
76 |
+
- output_type: "stdout" (for test cases) or "stderr" (for error trace)
|
77 |
+
- output_content: raw text of test cases+grade or the error message
|
78 |
"""
|
79 |
lines = block.splitlines()
|
80 |
_, after_code_idx = _extract_code(block)
|
|
|
83 |
execution_time = None
|
84 |
grade = None
|
85 |
testcases = []
|
86 |
+
output_lines = []
|
87 |
+
output_type, output_content = None, None
|
88 |
|
89 |
i = scan_start
|
90 |
while i < len(lines):
|
|
|
102 |
i += 1
|
103 |
continue
|
104 |
|
105 |
+
# -- ERROR:
|
106 |
+
if low.startswith("-- error:"):
|
107 |
+
output_type = "stderr"
|
108 |
+
# collect everything until next "-- " section or end
|
109 |
+
j = i + 1
|
110 |
+
err_lines = []
|
111 |
+
while j < len(lines):
|
112 |
+
if lines[j].strip().startswith("-- "):
|
113 |
+
break
|
114 |
+
err_lines.append(lines[j])
|
115 |
+
j += 1
|
116 |
+
output_content = "\n".join(err_lines).strip()
|
117 |
+
i = j
|
118 |
+
continue
|
119 |
+
|
120 |
# -- TEST CASE N:
|
121 |
if low.startswith("-- test case"):
|
122 |
idx = None
|
|
|
129 |
j = i + 1
|
130 |
current = {"index": idx, "input": "", "correct_output": "", "user_output": ""}
|
131 |
active = None
|
|
|
132 |
output_lines.append(lines[i]) # keep the "-- TEST CASE ..." line
|
133 |
|
134 |
while j < len(lines):
|
135 |
sraw = lines[j].rstrip("\n")
|
136 |
slow = sraw.strip().lower()
|
|
|
137 |
if slow.startswith("-- test case") or slow.startswith("-- grade:"):
|
138 |
break
|
|
|
139 |
output_lines.append(sraw)
|
|
|
140 |
if slow.startswith("---- input:"):
|
141 |
+
active = "input"; current["input"] = ""
|
|
|
142 |
elif slow.startswith("---- correct output:"):
|
143 |
+
active = "correct_output"; current["correct_output"] = ""
|
|
|
144 |
elif slow.startswith("---- user output:"):
|
145 |
+
active = "user_output"; current["user_output"] = ""
|
|
|
146 |
else:
|
147 |
if active:
|
148 |
current[active] += (sraw + "\n")
|
|
|
153 |
|
154 |
testcases.append(current)
|
155 |
i = j
|
156 |
+
output_type = "stdout"
|
157 |
continue
|
158 |
|
159 |
# -- GRADE:
|
|
|
166 |
except:
|
167 |
pass
|
168 |
output_lines.append(lines[i])
|
169 |
+
if val: output_lines.append(val)
|
|
|
170 |
i += 1
|
171 |
continue
|
172 |
|
173 |
i += 1
|
174 |
|
175 |
+
if output_type == "stdout":
|
176 |
+
output_content = "\n".join(output_lines).strip() or None
|
177 |
+
|
178 |
+
return execution_time, grade, testcases or None, output_type, output_content
|
179 |
|
|
|
180 |
|
181 |
|
182 |
def parse_execution_data(full_path):
|
|
|
222 |
if tnorm == "test":
|
223 |
output_type, output_content = _extract_test_output(block)
|
224 |
elif tnorm in ("submission", "submition", "submit"):
|
225 |
+
execution_time, grade, testcases, output_type, output_content = _extract_submission(block)
|
|
|
|
|
226 |
|
227 |
rows.append({
|
228 |
"user": user,
|