From a53d1827b19da3ba359ab024ecd0789b8179d361 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 24 Jun 2022 14:20:53 -0700 Subject: [PATCH 1/5] fix pendingdeprecationwarning --- sphinx_design/dropdown.py | 5 ++++- sphinx_design/tabs.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sphinx_design/dropdown.py b/sphinx_design/dropdown.py index 874d7e4..2f177b0 100644 --- a/sphinx_design/dropdown.py +++ b/sphinx_design/dropdown.py @@ -142,7 +142,10 @@ class DropdownHtmlTransform(SphinxPostTransform): def run(self): """Run the transform""" - for node in self.document.traverse(lambda node: is_component(node, "dropdown")): + # Can just use "findall" once docutils 0.18+ is required + meth = 'findall' if hasattr(self.document, 'findall') else 'traverse' + for node in getattr(self.document, meth)( + lambda node: is_component(node, "dropdown")): # TODO option to not have card css (but requires more formatting) use_card = True diff --git a/sphinx_design/tabs.py b/sphinx_design/tabs.py index e874a43..1b75024 100644 --- a/sphinx_design/tabs.py +++ b/sphinx_design/tabs.py @@ -213,7 +213,9 @@ def get_unique_key(self): def run(self) -> None: """Run the transform.""" - for tab_set in self.document.traverse( + # Can just use "findall" once docutils 0.18+ is required + meth = 'findall' if hasattr(self.document, 'findall') else 'traverse' + for tab_set in getattr(self.document, meth)( lambda node: is_component(node, "tab-set") ): tab_set_identity = self.get_unique_key() From fbf7916cbb83c061915780db6c390396045083ee Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 24 Jun 2022 21:22:00 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sphinx_design/dropdown.py | 5 +++-- sphinx_design/tabs.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sphinx_design/dropdown.py b/sphinx_design/dropdown.py index 2f177b0..5be00a6 100644 --- a/sphinx_design/dropdown.py +++ b/sphinx_design/dropdown.py @@ -143,9 +143,10 @@ class DropdownHtmlTransform(SphinxPostTransform): def run(self): """Run the transform""" # Can just use "findall" once docutils 0.18+ is required - meth = 'findall' if hasattr(self.document, 'findall') else 'traverse' + meth = "findall" if hasattr(self.document, "findall") else "traverse" for node in getattr(self.document, meth)( - lambda node: is_component(node, "dropdown")): + lambda node: is_component(node, "dropdown") + ): # TODO option to not have card css (but requires more formatting) use_card = True diff --git a/sphinx_design/tabs.py b/sphinx_design/tabs.py index 1b75024..ff4f0e5 100644 --- a/sphinx_design/tabs.py +++ b/sphinx_design/tabs.py @@ -214,7 +214,7 @@ def get_unique_key(self): def run(self) -> None: """Run the transform.""" # Can just use "findall" once docutils 0.18+ is required - meth = 'findall' if hasattr(self.document, 'findall') else 'traverse' + meth = "findall" if hasattr(self.document, "findall") else "traverse" for tab_set in getattr(self.document, meth)( lambda node: is_component(node, "tab-set") ): From 67cf61ca19ebd387470dc2a02e6da6625dfb342b Mon Sep 17 00:00:00 2001 From: Alex Rockhill Date: Tue, 28 Jun 2022 10:50:01 -0700 Subject: [PATCH 3/5] Update sphinx_design/dropdown.py Co-authored-by: Daniel McCloy --- sphinx_design/dropdown.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_design/dropdown.py b/sphinx_design/dropdown.py index 5be00a6..5a76625 100644 --- a/sphinx_design/dropdown.py +++ b/sphinx_design/dropdown.py @@ -142,7 +142,7 @@ class DropdownHtmlTransform(SphinxPostTransform): def run(self): """Run the transform""" - # Can just use "findall" once docutils 0.18+ is required + # Can just use "findall" once docutils 0.18.1+ is required meth = "findall" if hasattr(self.document, "findall") else "traverse" for node in getattr(self.document, meth)( lambda node: is_component(node, "dropdown") From 13a940bf92b65247a6237b7e423b155e52851248 Mon Sep 17 00:00:00 2001 From: Alex Rockhill Date: Tue, 28 Jun 2022 10:50:12 -0700 Subject: [PATCH 4/5] Update sphinx_design/tabs.py Co-authored-by: Daniel McCloy --- sphinx_design/tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_design/tabs.py b/sphinx_design/tabs.py index ff4f0e5..090dd45 100644 --- a/sphinx_design/tabs.py +++ b/sphinx_design/tabs.py @@ -213,7 +213,7 @@ def get_unique_key(self): def run(self) -> None: """Run the transform.""" - # Can just use "findall" once docutils 0.18+ is required + # Can just use "findall" once docutils 0.18.1+ is required meth = "findall" if hasattr(self.document, "findall") else "traverse" for tab_set in getattr(self.document, meth)( lambda node: is_component(node, "tab-set") From 076a7f7ddbfac0538250c3454bf7ac8a3049b94f Mon Sep 17 00:00:00 2001 From: Alex Rockhill Date: Tue, 28 Jun 2022 11:51:43 -0700 Subject: [PATCH 5/5] Update sphinx_design/dropdown.py Co-authored-by: Chris Sewell --- sphinx_design/dropdown.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sphinx_design/dropdown.py b/sphinx_design/dropdown.py index 5a76625..cebe956 100644 --- a/sphinx_design/dropdown.py +++ b/sphinx_design/dropdown.py @@ -143,8 +143,7 @@ class DropdownHtmlTransform(SphinxPostTransform): def run(self): """Run the transform""" # Can just use "findall" once docutils 0.18.1+ is required - meth = "findall" if hasattr(self.document, "findall") else "traverse" - for node in getattr(self.document, meth)( + for node in getattr(self.document, "findall", self.document.traverse)( lambda node: is_component(node, "dropdown") ):