File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 33
44from RestrictedPython import compile_restricted , RestrictingNodeTransformer
55from contextlib import redirect_stdout
6+ from zipfile import ZipFile
7+
68import sys
79import os
810import shutil
@@ -56,8 +58,14 @@ def run_code(project_name: str):
5658 input_file = os .path .join ('input' , input_file_name )
5759 execute_file (input_file , 'code.py' , out_file , project_name )
5860 print ('=' * 100 )
59- print (f'----> Project { repr (project_name )} done.' )
61+ print (f'----> Project { repr (project_name )} done. Compressing...' )
62+
63+ with ZipFile ('tests_cases.zip' , mode = 'w' ) as zip_ :
64+ for folder in ['input' , 'output' ]:
65+ for file_ in os .listdir (folder ):
66+ zip_ .write (os .path .join (folder , file_ ), os .path .join (folder , file_ ))
6067 os .chdir (os .path .join ('..' , '..' ))
68+ print (f'----> Project { repr (project_name )} compressed.' )
6169
6270
6371def main ():
You can’t perform that action at this time.
0 commit comments