@@ -273,8 +273,7 @@ def create(self, request):
273273 res ["message" ] = "Primary schedule successfully unset"
274274 res ["message" ] = "Primary schedule was already unset"
275275 else :
276- schedule = Schedule .objects .filter (
277- person_id = user .id , id = schedule_id ).first ()
276+ schedule = Schedule .objects .filter (person_id = user .id , id = schedule_id ).first ()
278277 if not schedule :
279278 res ["message" ] = "Schedule does not exist"
280279 return JsonResponse (res , status = status .HTTP_400_BAD_REQUEST )
@@ -522,8 +521,7 @@ def validate_name(self, request, existing_schedule=None, allow_path=False):
522521 name ,
523522 existing_schedule and existing_schedule .name ,
524523 ] and not (
525- allow_path and isinstance (
526- request .successful_authenticator , PlatformAuthentication )
524+ allow_path and isinstance (request .successful_authenticator , PlatformAuthentication )
527525 ):
528526 raise PermissionDenied (
529527 "You cannot create/update/delete a schedule with the name "
@@ -549,8 +547,7 @@ def update(self, request, pk=None):
549547 if from_path :
550548 schedule , _ = self .get_queryset (semester ).get_or_create (
551549 name = PATH_REGISTRATION_SCHEDULE_NAME ,
552- defaults = {"person" : self .request .user ,
553- "semester" : semester },
550+ defaults = {"person" : self .request .user , "semester" : semester },
554551 )
555552 else :
556553 schedule = self .get_queryset (semester ).get (id = pk )
@@ -560,12 +557,10 @@ def update(self, request, pk=None):
560557 status = status .HTTP_403_FORBIDDEN ,
561558 )
562559
563- name = self .validate_name (
564- request , existing_schedule = schedule , allow_path = from_path )
560+ name = self .validate_name (request , existing_schedule = schedule , allow_path = from_path )
565561
566562 try :
567- sections = self .get_sections (
568- request .data , semester , skip_missing = from_path )
563+ sections = self .get_sections (request .data , semester , skip_missing = from_path )
569564 except ObjectDoesNotExist :
570565 return Response (
571566 {"detail" : "One or more sections not found in database." },
@@ -650,8 +645,7 @@ def create(self, request, *args, **kwargs):
650645 def get_queryset (self , semester = None ):
651646 if not semester :
652647 semester = get_current_semester ()
653- queryset = Schedule .objects .filter (
654- person = self .request .user , semester = semester )
648+ queryset = Schedule .objects .filter (person = self .request .user , semester = semester )
655649 queryset = queryset .prefetch_related (
656650 Prefetch ("sections" , Section .with_reviews .all ()),
657651 "sections__associated_sections" ,
@@ -682,8 +676,7 @@ def get(self):
682676 Get all breaks for the current user.
683677 """
684678 breaks = self .get_queryset ()
685- serializer = BreakSerializer (
686- breaks , many = True , context = self .get_serializer_context ())
679+ serializer = BreakSerializer (breaks , many = True , context = self .get_serializer_context ())
687680 return Response (serializer .data , status = status .HTTP_200_OK )
688681
689682 def update (self , request , * args , ** kwargs ):
@@ -880,8 +873,7 @@ def get(self, *args, **kwargs):
880873 day_mapping = {"M" : "MO" , "T" : "TU" , "W" : "WE" , "R" : "TH" , "F" : "FR" }
881874
882875 calendar = ICSCal (creator = "Penn Labs" )
883- calendar .extra .append (ContentLine (
884- name = "X-WR-CALNAME" , value = f"{ schedule .name } Schedule" ))
876+ calendar .extra .append (ContentLine (name = "X-WR-CALNAME" , value = f"{ schedule .name } Schedule" ))
885877
886878 for section in schedule .sections .all ():
887879 e = ICSEvent ()
@@ -908,10 +900,8 @@ def get(self, *args, **kwargs):
908900 start_datetime = ""
909901 end_datetime = ""
910902 else :
911- start_datetime = get_first_matching_date (
912- first_meeting .start_date , days ) + " "
913- end_datetime = get_first_matching_date (
914- first_meeting .start_date , days ) + " "
903+ start_datetime = get_first_matching_date (first_meeting .start_date , days ) + " "
904+ end_datetime = get_first_matching_date (first_meeting .start_date , days ) + " "
915905
916906 if int (first_meeting .start ) < 10 :
917907 start_datetime += "0"
@@ -921,11 +911,9 @@ def get(self, *args, **kwargs):
921911 start_datetime += start_time
922912 end_datetime += end_time
923913
924- e .begin = arrow .get (start_datetime , "YYYY-MM-DD h:mm A" ,
925- tzinfo = "America/New_York" )
914+ e .begin = arrow .get (start_datetime , "YYYY-MM-DD h:mm A" , tzinfo = "America/New_York" )
926915
927- e .end = arrow .get (end_datetime , "YYYY-MM-DD h:mm A" ,
928- tzinfo = "America/New York" )
916+ e .end = arrow .get (end_datetime , "YYYY-MM-DD h:mm A" , tzinfo = "America/New York" )
929917
930918 location = None
931919 if hasattr (first_meeting , "room" ) and first_meeting .room :
0 commit comments