From f99bf93f39683876502e3faf75d9a20ab41ec042 Mon Sep 17 00:00:00 2001 From: TunaLobster Date: Mon, 6 Sep 2021 20:53:37 -0500 Subject: [PATCH 1/3] Remove f strings for backwards compatibility --- sphinxcontrib/youtube/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinxcontrib/youtube/utils.py b/sphinxcontrib/youtube/utils.py index 3569f41f1..c532dfe00 100644 --- a/sphinxcontrib/youtube/utils.py +++ b/sphinxcontrib/youtube/utils.py @@ -50,7 +50,7 @@ def visit_video_node(self, node, platform_url): "border": "0", } attrs = { - "src": f"{platform_url}{node['id']}", + "src": "{}{}".format(platform_url,node['id']), "style": css(style), } else: @@ -67,7 +67,7 @@ def visit_video_node(self, node, platform_url): "border": "0", } attrs = { - "src": f"{platform_url}{node['id']}", + "src": "{}{}".format(platform_url,node['id']), "style": css(style), } attrs["allowfullscreen"] = "true" @@ -120,5 +120,5 @@ def run(self): def unsupported_visit_video(self, node, platform): - self.builder.warn(f'{platform}: unsupported output format (node skipped)') + self.builder.warn('{}: unsupported output format (node skipped)'.format(platform)) raise nodes.SkipNode From bc332d742bcacb67fb65de247814baa8f6021d59 Mon Sep 17 00:00:00 2001 From: TunaLobster Date: Tue, 7 Sep 2021 11:48:37 -0500 Subject: [PATCH 2/3] Change partial to wrapper --- sphinxcontrib/youtube/vimeo.py | 13 ++++++------- sphinxcontrib/youtube/youtube.py | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/sphinxcontrib/youtube/vimeo.py b/sphinxcontrib/youtube/vimeo.py index 553ce6bf7..6fe3c316b 100644 --- a/sphinxcontrib/youtube/vimeo.py +++ b/sphinxcontrib/youtube/vimeo.py @@ -12,17 +12,16 @@ class Vimeo(utils.Video): _node = vimeo -visit_vimeo_node = partial(utils.visit_video_node, - platform_url="https://player.vimeo.com/video/") +def visit_vimeo_node(self, node): + return utils.visit_video_node(self, node, platform_url="https://player.vimeo.com/video/") -visit_vimeo_node_latex = partial(utils.visit_video_node_latex, - platform="vimeo", - platform_url="https://player.vimeo.com/video/") +def visit_vimeo_node_latex(self, node): + return utils.visit_video_node_latex(self, node, platform="vimeo", platform_url="https://player.vimeo.com/video/") -unsupported_visit_vimeo = partial(utils.unsupported_visit_video, - platform="vimeo") +def unsupported_visit_vimeo(self, node): + return utils.unsupported_visit_video(self, node, platform="vimeo") _NODE_VISITORS = { diff --git a/sphinxcontrib/youtube/youtube.py b/sphinxcontrib/youtube/youtube.py index 1b154f8c2..6c92fbe1e 100644 --- a/sphinxcontrib/youtube/youtube.py +++ b/sphinxcontrib/youtube/youtube.py @@ -12,17 +12,16 @@ class YouTube(utils.Video): _node = youtube -visit_youtube_node = partial(utils.visit_video_node, - platform_url="https://www.youtube.com/embed/") +def visit_youtube_node(self, node): + return utils.visit_video_node(self, node, platform_url="https://www.youtube.com/embed/") -visit_youtube_node_latex = partial(utils.visit_video_node_latex, - platform="youtube", - platform_url="https://youtu.be/") +def visit_youtube_node_latex(self, node): + return utils.visit_video_node_latex(self, node, platform="youtube", platform_url="https://youtu.be/") -unsupported_visit_youtube = partial(utils.unsupported_visit_video, - platform="youtube") +def unsupported_visit_youtube(self, node): + return utils.unsupported_visit_video(self, node, platform="youtube") _NODE_VISITORS = { From 8175c3a36a9c054bc8e2ce6216a6db091820690e Mon Sep 17 00:00:00 2001 From: TunaLobster Date: Sat, 11 Sep 2021 15:05:18 -0500 Subject: [PATCH 3/3] Remove unused functools from imports --- sphinxcontrib/youtube/vimeo.py | 1 - sphinxcontrib/youtube/youtube.py | 1 - 2 files changed, 2 deletions(-) diff --git a/sphinxcontrib/youtube/vimeo.py b/sphinxcontrib/youtube/vimeo.py index 6fe3c316b..a00876c5c 100644 --- a/sphinxcontrib/youtube/vimeo.py +++ b/sphinxcontrib/youtube/vimeo.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from . import utils -from functools import partial class vimeo(utils.video): diff --git a/sphinxcontrib/youtube/youtube.py b/sphinxcontrib/youtube/youtube.py index 6c92fbe1e..7aeda968c 100644 --- a/sphinxcontrib/youtube/youtube.py +++ b/sphinxcontrib/youtube/youtube.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from . import utils -from functools import partial class youtube(utils.video):