From db39fa7780b1c8e8620b7d4916dc2c0c75d4a0c9 Mon Sep 17 00:00:00 2001 From: ewuerger <ernst.wuerger@gmail.com> Date: Wed, 1 Nov 2023 17:05:16 +0100 Subject: [PATCH] ci: Please pre-commit hooks --- capella_git_hooks/fix_links.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/capella_git_hooks/fix_links.py b/capella_git_hooks/fix_links.py index bb2df99..2150a36 100644 --- a/capella_git_hooks/fix_links.py +++ b/capella_git_hooks/fix_links.py @@ -4,6 +4,8 @@ See https://github.com/eclipse/capella/issues/2725 for more information. """ +from __future__ import annotations + import os import re import subprocess @@ -57,6 +59,7 @@ def get_unmodified_tracked_files() -> list[str]: def search_and_replace( pattern: re.Pattern, value: str, replacement: str ) -> str | None: + """Return the patched value or the unpatched value.""" while match := pattern.search(value): index_match = match.span(1) value = value[: index_match[0]] + replacement + value[index_match[1] :] @@ -66,6 +69,7 @@ def search_and_replace( def fix_semantic_resources( root: ET._Element, root_repl: str, fragment_repl: str ) -> bool: + """Patch the semantic resource file paths and return a bool.""" changed = False danalysis = next(root.iterchildren(DIAGRAM_OVERVIEW_TAG)) for resource in danalysis.iterchildren("semanticResources"):