From cc055b2382a42a91737d97b9f422769a994af723 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:12:31 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.12.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.9...v0.12.0) - [github.com/google/yamlfmt: v0.16.0 → v0.17.1](https://github.com/google/yamlfmt/compare/v0.16.0...v0.17.1) - [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.16.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.16.1) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e724ba1d6..5afa98a94 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,19 +6,19 @@ repos: - id: taplo-format - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.9 + rev: v0.12.0 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/google/yamlfmt - rev: v0.16.0 + rev: v0.17.1 hooks: - id: yamlfmt - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.16.1 hooks: - id: mypy files: sphinx_needs/.* From e11de0c1217b426670db201e598e466e3a38e726 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:13:08 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sphinx_needs/functions/functions.py | 2 +- sphinx_needs/needsfile.py | 3 +-- sphinx_needs/views.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sphinx_needs/functions/functions.py b/sphinx_needs/functions/functions.py index 525421f7b..89bf1228a 100644 --- a/sphinx_needs/functions/functions.py +++ b/sphinx_needs/functions/functions.py @@ -363,7 +363,7 @@ def resolve_variants_options( **needs_config.filter_data ) # Add needs_filter_data to filter context need_context.update( - **{tag: True for tag in tags} + **dict.fromkeys(tags, True) ) # Add sphinx tags to filter context location = (need["docname"], need["lineno"]) if need.get("docname") else None diff --git a/sphinx_needs/needsfile.py b/sphinx_needs/needsfile.py index b910e3960..2511d96c7 100644 --- a/sphinx_needs/needsfile.py +++ b/sphinx_needs/needsfile.py @@ -72,8 +72,7 @@ def generate_needs_schema( } for name in exclude_properties: - if name in properties: - del properties[name] + properties.pop(name, None) return { "$schema": "http://json-schema.org/draft-07/schema#", diff --git a/sphinx_needs/views.py b/sphinx_needs/views.py index 43ab0d08b..f8202b841 100644 --- a/sphinx_needs/views.py +++ b/sphinx_needs/views.py @@ -340,7 +340,7 @@ def _copy_filtered( ) -> NeedsAndPartsListView: """Create a new view with only the needs/parts with the given ids.""" if self._selected_ids is None: - selected_ids = {n: None for n in ids} + selected_ids = dict.fromkeys(ids) else: selected_ids = {n: None for n in ids if n in self._selected_ids} return NeedsAndPartsListView(_indexes=self._indexes, _selected_ids=selected_ids)