Skip to content

Commit 724f979

Browse files
MaxDesiatovCatfish-Man
authored andcommitted
Add typing to update_checkout.py (#81160)
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 to a single function so that development experience is slightly improved and we can test this feature in our code before applying it more widely. Editors with support for Python LSP servers can pick it and stop flagging this function or its invocations as type errors.
1 parent a33fe7a commit 724f979

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import traceback
1818
from multiprocessing import Lock, Pool, cpu_count, freeze_support
19+
from typing import Optional
1920

2021
from build_swift.build_swift.constants import SWIFT_SOURCE_ROOT
2122

@@ -74,7 +75,7 @@ def check_parallel_results(results, op):
7475
return fail_count
7576

7677

77-
def confirm_tag_in_repo(tag, repo_name):
78+
def confirm_tag_in_repo(tag, repo_name) -> Optional[str]:
7879
# type: (str, str) -> str | None
7980
"""Confirm that a given tag exists in a git repository. This function
8081
assumes that the repository is already a current working directory before

0 commit comments

Comments
 (0)