diff --git a/pod/authentication/utils.py b/pod/authentication/utils.py index fdf71e0398..74f5f62e9d 100644 --- a/pod/authentication/utils.py +++ b/pod/authentication/utils.py @@ -30,6 +30,6 @@ def get_owners(search, limit, offset): "first_name", "last_name", ) - )[offset: limit + offset] + )[offset : limit + offset] return JsonResponse(users, safe=False) diff --git a/pod/dressing/views.py b/pod/dressing/views.py index 8338d845df..3892c74dea 100644 --- a/pod/dressing/views.py +++ b/pod/dressing/views.py @@ -35,7 +35,10 @@ def video_dressing(request: WSGIRequest, slug: str): dressings = get_dressings(request.user, request.user.owner.accessgroup_set.all()) - if not (request.user.is_superuser or (request.user == video.owner and request.user.is_staff)): + if not ( + request.user.is_superuser + or (request.user == video.owner and request.user.is_staff) + ): messages.add_message(request, messages.ERROR, _("You cannot dress this video.")) raise PermissionDenied diff --git a/pod/live/live_transcript.py b/pod/live/live_transcript.py index 75a14f44a9..e1aca90eef 100644 --- a/pod/live/live_transcript.py +++ b/pod/live/live_transcript.py @@ -89,7 +89,7 @@ def transcribe(url, slug, model, filepath): # noqa: C901 " " ), current_caption_text.split(" ") current_caption_words1 = current_caption_words[ - 1: len(current_caption_words) + 1 : len(current_caption_words) ] for i in range(len(last_caption_words) - 1, 0, -1): diff --git a/pod/meeting/views.py b/pod/meeting/views.py index 6bac160e72..fd7f3bc31c 100644 --- a/pod/meeting/views.py +++ b/pod/meeting/views.py @@ -977,11 +977,7 @@ def invite(request: WSGIRequest, meeting_id: str) -> HttpResponse: return render( request, "meeting/invite.html", - { - "page_title": page_title, - "meeting": meeting, - "form": form - }, + {"page_title": page_title, "meeting": meeting, "form": form}, ) diff --git a/pod/playlist/utils.py b/pod/playlist/utils.py index f9c5ad27a0..4c6d027022 100644 --- a/pod/playlist/utils.py +++ b/pod/playlist/utils.py @@ -316,7 +316,9 @@ def get_count_video_added_in_playlist(video: Video) -> int: return PlaylistContent.objects.filter(video=video).count() -def user_can_see_playlist_video(request: WSGIRequest, video: Video, playlist: Playlist) -> bool: +def user_can_see_playlist_video( + request: WSGIRequest, video: Video, playlist: Playlist +) -> bool: """ Check if the authenticated can see the playlist video. @@ -338,11 +340,15 @@ def user_can_see_playlist_video(request: WSGIRequest, video: Video, playlist: Pl or request.user.is_superuser ) else: - return playlist.visibility == "private" and ( - playlist.owner == request.user - or playlist in get_playlists_for_additional_owner(request.user) - or request.user.is_superuser - ) or playlist.visibility in {"public", "protected"} + return ( + playlist.visibility == "private" + and ( + playlist.owner == request.user + or playlist in get_playlists_for_additional_owner(request.user) + or request.user.is_superuser + ) + or playlist.visibility in {"public", "protected"} + ) def sort_playlist_list(playlist_list: list, sort_field: str, sort_direction="") -> list: diff --git a/pod/playlist/views.py b/pod/playlist/views.py index 26ab1f4b53..0bd982133c 100644 --- a/pod/playlist/views.py +++ b/pod/playlist/views.py @@ -128,10 +128,12 @@ def playlist_content(request: WSGIRequest, slug: str): playlist.visibility == "public" or playlist.visibility == "protected" or ( - request.user.is_authenticated and - (playlist.owner == request.user - or playlist in get_playlists_for_additional_owner(request.user) - or request.user.is_superuser) + request.user.is_authenticated + and ( + playlist.owner == request.user + or playlist in get_playlists_for_additional_owner(request.user) + or request.user.is_superuser + ) ) ): return render_playlist(request, playlist, sort_field, sort_direction) diff --git a/pod/recorder/plugins/type_studio.py b/pod/recorder/plugins/type_studio.py index 72788a5dc4..b0e1d4b927 100644 --- a/pod/recorder/plugins/type_studio.py +++ b/pod/recorder/plugins/type_studio.py @@ -206,7 +206,7 @@ def getElementsByName(xmldoc, name): urlElement = element.getElementsByTagName("url")[0] if urlElement.firstChild and urlElement.firstChild.data != "": element_path = urlElement.firstChild.data[ - urlElement.firstChild.data.index(MEDIA_URL) + len(MEDIA_URL): + urlElement.firstChild.data.index(MEDIA_URL) + len(MEDIA_URL) : ] src = os.path.join(settings.MEDIA_ROOT, element_path) if os.path.isfile(src): diff --git a/pod/recorder/views.py b/pod/recorder/views.py index d0b07b1103..174621b7b4 100644 --- a/pod/recorder/views.py +++ b/pod/recorder/views.py @@ -381,13 +381,13 @@ def studio_pod(request): ) head = opencast_studio_rendered[ opencast_studio_rendered.index("") - + len(""): opencast_studio_rendered.index("") + + len("") : opencast_studio_rendered.index("") ] scripts = re.findall('', head) styles = re.findall("", head) body = opencast_studio_rendered[ opencast_studio_rendered.index("") - + len(""): opencast_studio_rendered.index("") + + len("") : opencast_studio_rendered.index("") ] body = "".join(scripts) + "".join(styles) + body return render( diff --git a/pod/video/utils.py b/pod/video/utils.py index 270105b6bf..c019ccde7e 100644 --- a/pod/video/utils.py +++ b/pod/video/utils.py @@ -180,7 +180,7 @@ def get_videos(title, user_id, search=None, limit=12, offset=0): results = list( map( lambda v: {"id": v.id, "title": v.title, "thumbnail": v.get_thumbnail_url()}, - videos[offset: limit + offset], + videos[offset : limit + offset], ) ) diff --git a/pod/video/views.py b/pod/video/views.py index b530781b5f..34392272f6 100644 --- a/pod/video/views.py +++ b/pod/video/views.py @@ -253,7 +253,7 @@ def _regroup_videos_by_theme(request, videos, channel, theme=None): request.path, offset, limit, videos.count() ) count = videos.count() - videos = videos[offset: limit + offset] + videos = videos[offset : limit + offset] response = { **response, "videos": list(videos), @@ -1084,7 +1084,9 @@ def video(request, slug, slug_c=None, slug_t=None, slug_private=None): template_video = "videos/video-iframe.html" elif request.GET.get("playlist"): playlist = get_object_or_404(Playlist, slug=request.GET.get("playlist")) - if playlist_can_be_displayed(request, playlist) and user_can_see_playlist_video(request, video, playlist): + if playlist_can_be_displayed(request, playlist) and user_can_see_playlist_video( + request, video, playlist + ): videos = sort_videos_list(get_video_list_for_playlist(playlist), "rank") params = { "playlist_in_get": playlist, @@ -1194,7 +1196,9 @@ def render_video( if request.GET.get("playlist"): playlist = get_object_or_404(Playlist, slug=request.GET.get("playlist")) if not user_can_see_playlist_video( - request, video, playlist, + request, + video, + playlist, ): toggle_render_video_when_is_playlist_player(request) return render( diff --git a/pod/video_encode_transcript/transcript_model.py b/pod/video_encode_transcript/transcript_model.py index 2043b20523..f21e46a8d6 100644 --- a/pod/video_encode_transcript/transcript_model.py +++ b/pod/video_encode_transcript/transcript_model.py @@ -464,7 +464,7 @@ def get_text_caption(text_caption, last_word_added): """Get the text for a caption.""" try: first_index = text_caption.index(last_word_added) - return text_caption[first_index + 1:] + return text_caption[first_index + 1 :] except ValueError: return text_caption