Skip to content

Commit 9337686

Browse files
committed
update
1 parent af26a38 commit 9337686

File tree

10 files changed

+136
-136
lines changed

10 files changed

+136
-136
lines changed

sphinx_needs/api/need.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import re
66
import warnings
7-
from collections.abc import Iterable, Iterator
7+
from collections.abc import Iterable, Iterator, Sequence
88
from contextlib import contextmanager
99
from pathlib import Path
1010
from typing import Any, TypeVar
@@ -64,7 +64,7 @@ def generate_need(
6464
parts: dict[str, NeedsPartType] | None = None,
6565
arch: dict[str, str] | None = None,
6666
signature: None | str = None,
67-
sections: list[str] | None = None,
67+
sections: Sequence[str] | None = None,
6868
jinja_content: bool | None = None,
6969
hide: None | bool = None,
7070
collapse: None | bool = None,
@@ -353,7 +353,7 @@ def generate_need(
353353
"modifications": 0,
354354
"has_dead_links": False,
355355
"has_forbidden_dead_links": False,
356-
"sections": sections or [],
356+
"sections": tuple(sections or ()),
357357
"signature": signature,
358358
}
359359

sphinx_needs/data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class CoreFieldParameters(TypedDict):
328328
},
329329
"constraints": {
330330
"description": "List of constraint names, which are defined for this need.",
331-
"schema": {"type": "array", "items": {"type": "string"}, "default": []},
331+
"schema": {"type": "array", "items": {"type": "string"}, "default": ()},
332332
"allow_default": "str_list",
333333
"allow_df": True,
334334
"allow_extend": True,
@@ -361,7 +361,7 @@ class CoreFieldParameters(TypedDict):
361361
},
362362
"sections": {
363363
"description": "Sections of the need.",
364-
"schema": {"type": "array", "items": {"type": "string"}, "default": []},
364+
"schema": {"type": "array", "items": {"type": "string"}, "default": ()},
365365
"exclude_import": True,
366366
},
367367
"section_name": {
@@ -469,7 +469,7 @@ class NeedsInfoType(TypedDict):
469469

470470
# additional source information
471471
# set in analyse_need_locations transform
472-
sections: list[str]
472+
sections: tuple[str, ...]
473473
signature: None | str
474474
"""Derived from a docutils desc_name node."""
475475

@@ -496,7 +496,7 @@ class NeedsInfoComputedType(TypedDict):
496496
"""Simply the first section."""
497497
parent_need: None | str
498498
"""Simply the first parent id."""
499-
constraints: list[str]
499+
constraints: tuple[str, ...]
500500
"""List of constraint names, which are defined for this need."""
501501
constraints_passed: bool
502502
"""True if all constraints passed, False if any failed, None if not yet checked."""

sphinx_needs/directives/need.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def analyse_need_locations(app: Sphinx, doctree: nodes.document) -> None:
319319

320320
# first we initialize to default values
321321
if "sections" not in need_info:
322-
need_info["sections"] = []
322+
need_info["sections"] = ()
323323

324324
if "section_name" not in need_info:
325325
need_info["section_name"] = None
@@ -341,7 +341,7 @@ def analyse_need_locations(app: Sphinx, doctree: nodes.document) -> None:
341341

342342
# append / set values from need
343343
if sections:
344-
need_info["sections"] = sections
344+
need_info["sections"] = tuple(sections)
345345

346346
if signature:
347347
need_info["signature"] = str(signature)

sphinx_needs/need_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def _recompute(self) -> None:
265265
"is_modified": self._core["modifications"] > 0,
266266
"id_parent": self._core["id"],
267267
"id_complete": self._core["id"],
268-
"constraints": list(self._core["constraints_results"]),
268+
"constraints": tuple(self._core["constraints_results"]),
269269
"constraints_passed": all(
270270
result
271271
for check in self._core["constraints_results"].values()

0 commit comments

Comments
 (0)