Skip to content

Commit bc26a98

Browse files
authored
create_baseline_stubs.py: Modernize a few type annotations (#8642)
1 parent 2c7ac09 commit bc26a98

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/create_baseline_stubs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@
88
Run with -h for more help.
99
"""
1010

11+
from __future__ import annotations
12+
1113
import argparse
1214
import os
1315
import re
1416
import shutil
1517
import subprocess
1618
import sys
17-
from typing import Optional, Tuple
1819

1920
if sys.version_info >= (3, 8):
2021
from importlib.metadata import distribution
2122

2223
PYRIGHT_CONFIG = "pyrightconfig.stricter.json"
2324

2425

25-
def search_pip_freeze_output(project: str, output: str) -> Optional[Tuple[str, str]]:
26+
def search_pip_freeze_output(project: str, output: str) -> tuple[str, str] | None:
2627
# Look for lines such as "typed-ast==1.4.2". '-' matches '_' and
2728
# '_' matches '-' in project name, so that "typed_ast" matches
2829
# "typed-ast", and vice versa.
@@ -33,7 +34,7 @@ def search_pip_freeze_output(project: str, output: str) -> Optional[Tuple[str, s
3334
return m.group(1), m.group(2)
3435

3536

36-
def get_installed_package_info(project: str) -> Optional[Tuple[str, str]]:
37+
def get_installed_package_info(project: str) -> tuple[str, str] | None:
3738
"""Find package information from pip freeze output.
3839
3940
Match project name somewhat fuzzily (case sensitive; '-' matches '_', and

0 commit comments

Comments
 (0)