Skip to content

Commit

Permalink
🔧 Add TypedDict for statuses/tags config
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Nov 28, 2024
1 parent 6a14189 commit 3f92911
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions sphinx_needs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ class NeedExtraOption(TypedDict):
"""A description of the option."""


class NeedStatusesOption(TypedDict):
name: str
description: NotRequired[str]


class NeedTagsOption(TypedDict):
name: str
description: NotRequired[str]


@dataclass
class NeedsSphinxConfig:
"""A wrapper around the Sphinx configuration,
Expand Down Expand Up @@ -479,24 +489,14 @@ def functions(self) -> Mapping[str, NeedFunctionsType]:
default=False, metadata={"rebuild": "html", "types": (bool,)}
)
"""Raise exceptions if a needextend filter does not match any needs."""
statuses: list[dict[str, str]] = field(
statuses: list[NeedStatusesOption] = field(
default_factory=list, metadata={"rebuild": "html", "types": ()}
)
"""If given, only the defined status are allowed.
Values needed for each status:
* name
* description
Example: [{"name": "open", "description": "open status"}, {...}, {...}]
"""
tags: list[dict[str, str]] = field(
"""If given, only the defined statuses are allowed."""
tags: list[NeedTagsOption] = field(
default_factory=list, metadata={"rebuild": "html", "types": (list,)}
)
"""If given, only the defined tags are allowed.
Values needed for each tag:
* name
* description
Example: [{"name": "new", "description": "new needs"}, {...}, {...}]
"""
"""If given, only the defined tags are allowed."""
css: str = field(
default="modern.css", metadata={"rebuild": "html", "types": (str,)}
)
Expand Down

0 comments on commit 3f92911

Please sign in to comment.