From 3719cbd83c1cc44c2d8978f9f4c1a4e9d18d8964 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Fri, 23 Feb 2024 08:15:43 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Remove=20use=20of=20deprecated?= =?UTF-8?q?=20`needs=5Fextra=5Foptions`=20as=20`dict`=20(#1126)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/configuration.rst | 7 +------ docs/layout_styles.rst | 15 ++++++++------- tests/doc_test/add_sections/conf.py | 12 +++++------- tests/doc_test/doc_df_calc_sum/conf.py | 8 +------- tests/doc_test/doc_df_check_linked_values/conf.py | 4 +--- tests/doc_test/doc_df_user_functions/conf.py | 4 +--- tests/doc_test/doc_dynamic_functions/conf.py | 4 +--- tests/doc_test/doc_layout/conf.py | 7 +------ tests/doc_test/doc_needs_filter_data/conf.py | 6 +----- tests/doc_test/extra_options/conf.py | 8 +------- 10 files changed, 21 insertions(+), 54 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index f3e225d22..1914ce56c 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -165,12 +165,7 @@ And use it like: .. code-block:: python - from docutils.parsers.rst import directives - - needs_extra_options = { - "my_extra_option": directives.unchanged, - "another_option": directives.unchanged, - } + needs_extra_options = ["my_extra_option", "another_option"] **index.rst** diff --git a/docs/layout_styles.rst b/docs/layout_styles.rst index 0d0b613c1..37e70803f 100644 --- a/docs/layout_styles.rst +++ b/docs/layout_styles.rst @@ -307,16 +307,15 @@ The line for the ``side`` area could look like:: The used layout takes the value from ``author`` and puts some image-path related information around it. -Here is the complete used code:: +Here is the complete used code + +.. code-block:: python # conf.py # ------- - from docutils.parsers.rst import directives # Make the author option valid - needs_extra_options = { - "author": directives.unchanged, - } + needs_extra_options = ["author"] # Define own layout needs_layouts = { @@ -331,8 +330,10 @@ Here is the complete used code:: } } - # rst-code of the above need - # -------------------------- +.. code-block:: restructuredtext + + rst-code of the above need + -------------------------- .. spec:: My test spec :author: daniel diff --git a/tests/doc_test/add_sections/conf.py b/tests/doc_test/add_sections/conf.py index c684207da..ea5667392 100644 --- a/tests/doc_test/add_sections/conf.py +++ b/tests/doc_test/add_sections/conf.py @@ -1,12 +1,10 @@ -from docutils.parsers.rst import directives - extensions = ["sphinx_needs"] -needs_extra_options = { - "introduced": directives.unchanged, - "updated": directives.unchanged, - "impacts": directives.unchanged, -} +needs_extra_options = [ + "introduced", + "updated", + "impacts", +] needs_template_collapse = """ .. _{{id}}: diff --git a/tests/doc_test/doc_df_calc_sum/conf.py b/tests/doc_test/doc_df_calc_sum/conf.py index ee4795ac0..e98febfc9 100644 --- a/tests/doc_test/doc_df_calc_sum/conf.py +++ b/tests/doc_test/doc_df_calc_sum/conf.py @@ -1,5 +1,3 @@ -from docutils.parsers.rst import directives - extensions = ["sphinx_needs"] needs_types = [ @@ -33,8 +31,4 @@ }, ] -needs_extra_options = { - "test_func": directives.unchanged, - "hours": directives.unchanged, - "amount": directives.unchanged, -} +needs_extra_options = ["test_func", "hours", "amount"] diff --git a/tests/doc_test/doc_df_check_linked_values/conf.py b/tests/doc_test/doc_df_check_linked_values/conf.py index 2a93cda81..0b41a6348 100644 --- a/tests/doc_test/doc_df_check_linked_values/conf.py +++ b/tests/doc_test/doc_df_check_linked_values/conf.py @@ -1,5 +1,3 @@ -from docutils.parsers.rst import directives - extensions = ["sphinx_needs"] needs_types = [ @@ -33,4 +31,4 @@ }, ] -needs_extra_options = {"test_func": directives.unchanged, "hours": directives.unchanged} +needs_extra_options = ["test_func", "hours"] diff --git a/tests/doc_test/doc_df_user_functions/conf.py b/tests/doc_test/doc_df_user_functions/conf.py index 14945940d..20f8cea84 100644 --- a/tests/doc_test/doc_df_user_functions/conf.py +++ b/tests/doc_test/doc_df_user_functions/conf.py @@ -1,5 +1,3 @@ -from docutils.parsers.rst import directives - extensions = ["sphinx_needs"] needs_types = [ @@ -33,7 +31,7 @@ }, ] -needs_extra_options = {"test_func": directives.unchanged, "hours": directives.unchanged} +needs_extra_options = ["test_func", "hours"] def my_own_function(app, need, needs): diff --git a/tests/doc_test/doc_dynamic_functions/conf.py b/tests/doc_test/doc_dynamic_functions/conf.py index e474af668..111e1eab6 100644 --- a/tests/doc_test/doc_dynamic_functions/conf.py +++ b/tests/doc_test/doc_dynamic_functions/conf.py @@ -1,5 +1,3 @@ -from docutils.parsers.rst import directives - extensions = ["sphinx_needs"] needs_types = [ @@ -33,4 +31,4 @@ }, ] -needs_extra_options = {"test_func": directives.unchanged} +needs_extra_options = ["test_func"] diff --git a/tests/doc_test/doc_layout/conf.py b/tests/doc_test/doc_layout/conf.py index 899d6306c..c118c5817 100644 --- a/tests/doc_test/doc_layout/conf.py +++ b/tests/doc_test/doc_layout/conf.py @@ -1,5 +1,3 @@ -from docutils.parsers.rst import directives - extensions = ["sphinx_needs"] needs_types = [ @@ -33,10 +31,7 @@ }, ] -needs_extra_options = { - "author": directives.unchanged, -} - +needs_extra_options = ["author"] needs_layouts = { "example": { diff --git a/tests/doc_test/doc_needs_filter_data/conf.py b/tests/doc_test/doc_needs_filter_data/conf.py index 8c62e9c97..0addc00ad 100644 --- a/tests/doc_test/doc_needs_filter_data/conf.py +++ b/tests/doc_test/doc_needs_filter_data/conf.py @@ -1,8 +1,6 @@ import os import sys -from docutils.parsers.rst import directives - sys.path.insert(0, os.path.abspath("./")) extensions = ["sphinx_needs", "sphinxcontrib.plantuml"] @@ -49,9 +47,7 @@ def custom_func(): needs_filter_data = {"current_variant": "project_x", "sphinx_tag": custom_func()} -needs_extra_options = { - "variant": directives.unchanged, -} +needs_extra_options = ["variant"] needs_warnings = { "variant_not_equal_current_variant": "variant != current_variant", diff --git a/tests/doc_test/extra_options/conf.py b/tests/doc_test/extra_options/conf.py index 7518f91ca..323f4113d 100644 --- a/tests/doc_test/extra_options/conf.py +++ b/tests/doc_test/extra_options/conf.py @@ -1,12 +1,6 @@ -from docutils.parsers.rst import directives - extensions = ["sphinx_needs"] -needs_extra_options = { - "introduced": directives.unchanged, - "updated": directives.unchanged, - "impacts": directives.unchanged, -} +needs_extra_options = ["introduced", "updated", "impacts"] def setup(app):