diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6d0a31f54..8eed69498 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.14.2 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/google/yamlfmt - rev: v0.16.0 + rev: v0.20.0 hooks: - id: yamlfmt - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.18.2 hooks: - id: mypy files: sphinx_needs/.* diff --git a/sphinx_needs/needsfile.py b/sphinx_needs/needsfile.py index f8354704c..ae5db296b 100644 --- a/sphinx_needs/needsfile.py +++ b/sphinx_needs/needsfile.py @@ -79,8 +79,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 9e872c5bc..403184fd2 100644 --- a/sphinx_needs/views.py +++ b/sphinx_needs/views.py @@ -337,7 +337,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)