|
14 | 14 | TYPE_CHECKING, |
15 | 15 | Any, |
16 | 16 | Dict, |
| 17 | + Iterator, |
17 | 18 | List, |
18 | 19 | NamedTuple, |
19 | 20 | Optional, |
|
44 | 45 |
|
45 | 46 |
|
46 | 47 | @contextlib.contextmanager |
47 | | -def workdir(path: str): |
| 48 | +def workdir(path: str) -> Iterator[None]: |
48 | 49 | oldpath = os.getcwd() |
49 | 50 | os.chdir(path) |
50 | 51 | try: |
@@ -145,7 +146,7 @@ def fetch_git_repo(git_url: str, commit: str) -> str: |
145 | 146 | return clone_dir |
146 | 147 |
|
147 | 148 |
|
148 | | -def update_workspace_keys(pkg, workspace): |
| 149 | +def update_workspace_keys(pkg: dict[str, Any], workspace: dict[str, Any]) -> None: |
149 | 150 | for key, item in pkg.items(): |
150 | 151 | # There cannot be a 'workspace' key if the item is not a dict. |
151 | 152 | if not isinstance(item, dict): |
@@ -209,7 +210,9 @@ async def get_git_repo_packages(git_url: str, commit: str) -> _GitPackagesType: |
209 | 210 | git_repo_dir = fetch_git_repo(git_url, commit) |
210 | 211 | packages: _GitPackagesType = {} |
211 | 212 |
|
212 | | - def get_cargo_toml_packages(root_dir: str, workspace: Optional[_TomlType] = None): |
| 213 | + def get_cargo_toml_packages( |
| 214 | + root_dir: str, workspace: Optional[_TomlType] = None |
| 215 | + ) -> None: |
213 | 216 | assert not os.path.isabs(root_dir) and os.path.isdir(root_dir) |
214 | 217 |
|
215 | 218 | with workdir(root_dir): |
@@ -446,7 +449,7 @@ async def generate_sources( |
446 | 449 | return sources |
447 | 450 |
|
448 | 451 |
|
449 | | -def main(): |
| 452 | +def main() -> None: |
450 | 453 | parser = argparse.ArgumentParser() |
451 | 454 | parser.add_argument("cargo_lock", help="Path to the Cargo.lock file") |
452 | 455 | parser.add_argument( |
|
0 commit comments