7
7
import venv
8
8
import zipfile
9
9
from argparse import ArgumentParser , Namespace
10
+ from collections .abc import Generator
10
11
from concurrent .futures import ThreadPoolExecutor
11
12
from functools import lru_cache , partial
12
13
from pathlib import Path
13
- from typing import Generator , List , NamedTuple , Optional , Tuple , Union , cast
14
+ from typing import NamedTuple , Optional , Union , cast
14
15
from urllib .request import urlopen , urlretrieve
15
16
16
17
PYPI_INSTANCE = "https://pypi.org/pypi"
@@ -54,7 +55,7 @@ def get_pypi_download_url(package: str, version: Optional[str]) -> str:
54
55
return cast (str , source ["url" ])
55
56
56
57
57
- def get_top_packages () -> List [str ]:
58
+ def get_top_packages () -> list [str ]:
58
59
with urlopen (PYPI_TOP_PACKAGES ) as page :
59
60
result = json .load (page )
60
61
@@ -150,7 +151,7 @@ def git_switch_branch(
150
151
subprocess .run (args , cwd = repo )
151
152
152
153
153
- def init_repos (options : Namespace ) -> Tuple [Path , ...]:
154
+ def init_repos (options : Namespace ) -> tuple [Path , ...]:
154
155
options .output .mkdir (exist_ok = True )
155
156
156
157
if options .top_packages :
@@ -206,7 +207,7 @@ def format_repo_with_version(
206
207
git_switch_branch (black_version .version , repo = black_repo )
207
208
git_switch_branch (current_branch , repo = repo , new = True , from_branch = from_branch )
208
209
209
- format_cmd : List [Union [Path , str ]] = [
210
+ format_cmd : list [Union [Path , str ]] = [
210
211
black_runner (black_version .version , black_repo ),
211
212
(black_repo / "black.py" ).resolve (),
212
213
"." ,
@@ -222,7 +223,7 @@ def format_repo_with_version(
222
223
return current_branch
223
224
224
225
225
- def format_repos (repos : Tuple [Path , ...], options : Namespace ) -> None :
226
+ def format_repos (repos : tuple [Path , ...], options : Namespace ) -> None :
226
227
black_versions = tuple (
227
228
BlackVersion (* version .split (":" )) for version in options .versions
228
229
)
0 commit comments