@@ -70,10 +70,13 @@ def check_authorization(
7070 raise HTTPError (403 )
7171 elif lecture_id is None and "/lectures" in self .request .path and self .request .method == "GET" :
7272 return True
73- if re .match (r"/api/users/(?P<username>[^/]+)/submissions/?" , self .request .path ) and self .request .method == "GET" :
73+ if (
74+ re .match (r"/api/users/(?P<username>[^/]+)/submissions/?" , self .request .path )
75+ and self .request .method == "GET"
76+ ):
7477 return True
7578
76- is_admin = self .authenticator .is_admin (handler = self , authentication = {' name' : self .user .name })
79+ is_admin = self .authenticator .is_admin (handler = self , authentication = {" name" : self .user .name })
7780
7881 role = self .session .get (Role , (self .user .id , lecture_id ))
7982
@@ -835,7 +838,7 @@ def get_latest_submissions(
835838 subquery ,
836839 (Submission .user_id == subquery .c .user_id )
837840 & (Submission .date == subquery .c .max_date )
838- & (Submission .assignid == assignment_id )
841+ & (Submission .assignid == assignment_id ),
839842 )
840843 .order_by (Submission .id )
841844 )
@@ -885,7 +888,7 @@ def get_best_submissions(
885888 subquery ,
886889 (Submission .user_id == subquery .c .user_id )
887890 & (Submission .score == subquery .c .max_score )
888- & (Submission .assignid == assignment_id )
891+ & (Submission .assignid == assignment_id ),
889892 )
890893 .order_by (Submission .id )
891894 )
@@ -916,10 +919,14 @@ def delete_assignment_files(self, assignment: Assignment):
916919 def delete_submission_files (self , submission : Submission ):
917920 # delete all associated directories of the submission
918921 assignment_path = os .path .abspath (
919- os .path .join (self .gitbase , submission .assignment .lecture .code , str (submission .assignment .id ))
922+ os .path .join (
923+ self .gitbase , submission .assignment .lecture .code , str (submission .assignment .id )
924+ )
920925 )
921926 tmp_assignment_path = os .path .abspath (
922- os .path .join (self .tmpbase , submission .assignment .lecture .code , str (submission .assignment .id ))
927+ os .path .join (
928+ self .tmpbase , submission .assignment .lecture .code , str (submission .assignment .id )
929+ )
923930 )
924931 target_names = {submission .user .name , str (submission .id )}
925932 matching_dirs = []
@@ -968,7 +975,9 @@ def construct_git_dir(
968975 elif repo_type in {GitRepoType .AUTOGRADE , GitRepoType .FEEDBACK }:
969976 type_path = os .path .join (assignment_path , repo_type , "user" )
970977 if repo_type == GitRepoType .AUTOGRADE :
971- if (submission is None ) or (not self .user .is_admin and self .get_role (lecture .id ).role < Scope .tutor ):
978+ if (submission is None ) or (
979+ not self .user .is_admin and self .get_role (lecture .id ).role < Scope .tutor
980+ ):
972981 raise HTTPError (403 )
973982 path = os .path .join (type_path , submission .user .name )
974983 else :
0 commit comments