Skip to content

Commit

Permalink
🔧 Remove use of deprecated needs_extra_options as dict (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Feb 23, 2024
1 parent 9c8c721 commit 3719cbd
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 54 deletions.
7 changes: 1 addition & 6 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
15 changes: 8 additions & 7 deletions docs/layout_styles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand Down
12 changes: 5 additions & 7 deletions tests/doc_test/add_sections/conf.py
Original file line number Diff line number Diff line change
@@ -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}}:
Expand Down
8 changes: 1 addition & 7 deletions tests/doc_test/doc_df_calc_sum/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from docutils.parsers.rst import directives

extensions = ["sphinx_needs"]

needs_types = [
Expand Down Expand Up @@ -33,8 +31,4 @@
},
]

needs_extra_options = {
"test_func": directives.unchanged,
"hours": directives.unchanged,
"amount": directives.unchanged,
}
needs_extra_options = ["test_func", "hours", "amount"]
4 changes: 1 addition & 3 deletions tests/doc_test/doc_df_check_linked_values/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from docutils.parsers.rst import directives

extensions = ["sphinx_needs"]

needs_types = [
Expand Down Expand Up @@ -33,4 +31,4 @@
},
]

needs_extra_options = {"test_func": directives.unchanged, "hours": directives.unchanged}
needs_extra_options = ["test_func", "hours"]
4 changes: 1 addition & 3 deletions tests/doc_test/doc_df_user_functions/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from docutils.parsers.rst import directives

extensions = ["sphinx_needs"]

needs_types = [
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions tests/doc_test/doc_dynamic_functions/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from docutils.parsers.rst import directives

extensions = ["sphinx_needs"]

needs_types = [
Expand Down Expand Up @@ -33,4 +31,4 @@
},
]

needs_extra_options = {"test_func": directives.unchanged}
needs_extra_options = ["test_func"]
7 changes: 1 addition & 6 deletions tests/doc_test/doc_layout/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from docutils.parsers.rst import directives

extensions = ["sphinx_needs"]

needs_types = [
Expand Down Expand Up @@ -33,10 +31,7 @@
},
]

needs_extra_options = {
"author": directives.unchanged,
}

needs_extra_options = ["author"]

needs_layouts = {
"example": {
Expand Down
6 changes: 1 addition & 5 deletions tests/doc_test/doc_needs_filter_data/conf.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 1 addition & 7 deletions tests/doc_test/extra_options/conf.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down

0 comments on commit 3719cbd

Please sign in to comment.