File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ import asyncio
4
+ import argparse
5
+ from pathlib import Path
6
+
7
+ import databases
8
+
9
+ from . import utils , config
10
+
11
+
12
+ async def async_main (submissions_directory : Path ) -> None :
13
+ submissions_directory .mkdir (parents = True , exist_ok = True )
14
+
15
+ database = databases .Database (config .DATABASE_URL )
16
+
17
+ async with database .transaction ():
18
+ submissions = await utils .get_chosen_submissions (database )
19
+
20
+ for team , content in submissions .items ():
21
+ (submissions_directory / f'{ team .upper ()} .zip' ).write_bytes (content )
22
+
23
+
24
+ def parse_args () -> argparse .Namespace :
25
+ parser = argparse .ArgumentParser ()
26
+ parser .add_argument ('submissions_directory' , type = Path )
27
+ return parser .parse_args ()
28
+
29
+
30
+ def main (args : argparse .Namespace ) -> None :
31
+ asyncio .get_event_loop ().run_until_complete (async_main (args .submissions_directory ))
32
+
33
+
34
+ if __name__ == '__main__' :
35
+ main (parse_args ())
You can’t perform that action at this time.
0 commit comments