Skip to content

Commit c447bf5

Browse files
authored
utils: add typing annotations to migration.py/utils.py (#83293)
These typing annotations are supported since Python 3.6, while the oldest Python we have to support is 3.7 on Amazon Linux 2.
1 parent 15ceabc commit c447bf5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

utils/build_swift/build_swift/migration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"""
1313

1414

15+
from argparse import ArgumentParser
1516
import itertools
1617
import subprocess
1718

@@ -97,7 +98,7 @@ def _process_disambiguation_arguments(args, unknown_args):
9798
return args, unknown_args
9899

99100

100-
def parse_args(parser, args, namespace=None):
101+
def parse_args(parser: ArgumentParser, args, namespace=None):
101102
"""Parses a given argument list with the given argparse.ArgumentParser.
102103
103104
Return a processed arguments object. Any unknown arguments are stored in

utils/swift_build_support/swift_build_support/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sys
1717
import time
1818

19-
19+
from typing import NoReturn
2020
from build_swift.build_swift.constants import SWIFT_BUILD_ROOT
2121

2222

@@ -30,7 +30,7 @@ def fatal_error(message, stream=sys.stderr):
3030
sys.exit(1)
3131

3232

33-
def exit_rejecting_arguments(message, parser=None):
33+
def exit_rejecting_arguments(message, parser=None) -> NoReturn:
3434
print(message, file=sys.stderr)
3535
if parser:
3636
parser.print_usage(sys.stderr)

0 commit comments

Comments
 (0)