From cf97ef5ca96683285507aeec319efdb3688666ac Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Tue, 29 Apr 2025 15:29:24 +0100 Subject: [PATCH] Add `typing` to `update_checkout.py` As Python 3.5 added support for type hints and we require Python 3.6 or later, let's try to add a type hint for a function so that development experience is improved. Editors with support for Python LSP servers can pick it and stop flagging this function or its invocations as type errors. --- utils/update_checkout/update_checkout/update_checkout.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/update_checkout/update_checkout/update_checkout.py b/utils/update_checkout/update_checkout/update_checkout.py index 6e9f351c637f3..bcdb8e4d300ec 100755 --- a/utils/update_checkout/update_checkout/update_checkout.py +++ b/utils/update_checkout/update_checkout/update_checkout.py @@ -16,6 +16,7 @@ import sys import traceback from multiprocessing import Lock, Pool, cpu_count, freeze_support +from typing import Optional from build_swift.build_swift.constants import SWIFT_SOURCE_ROOT @@ -74,7 +75,7 @@ def check_parallel_results(results, op): return fail_count -def confirm_tag_in_repo(tag, repo_name): +def confirm_tag_in_repo(tag, repo_name) -> Optional[str]: # type: (str, str) -> str | None """Confirm that a given tag exists in a git repository. This function assumes that the repository is already a current working directory before