Skip to content

Commit 9c73aff

Browse files
committed
cargo: Add missing type hints
1 parent e43da95 commit 9c73aff

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cargo/flatpak-cargo-generator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
TYPE_CHECKING,
1515
Any,
1616
Dict,
17+
Iterator,
1718
List,
1819
NamedTuple,
1920
Optional,
@@ -44,7 +45,7 @@
4445

4546

4647
@contextlib.contextmanager
47-
def workdir(path: str):
48+
def workdir(path: str) -> Iterator[None]:
4849
oldpath = os.getcwd()
4950
os.chdir(path)
5051
try:
@@ -145,7 +146,7 @@ def fetch_git_repo(git_url: str, commit: str) -> str:
145146
return clone_dir
146147

147148

148-
def update_workspace_keys(pkg, workspace):
149+
def update_workspace_keys(pkg: dict[str, Any], workspace: dict[str, Any]) -> None:
149150
for key, item in pkg.items():
150151
# There cannot be a 'workspace' key if the item is not a dict.
151152
if not isinstance(item, dict):
@@ -209,7 +210,9 @@ async def get_git_repo_packages(git_url: str, commit: str) -> _GitPackagesType:
209210
git_repo_dir = fetch_git_repo(git_url, commit)
210211
packages: _GitPackagesType = {}
211212

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:
213216
assert not os.path.isabs(root_dir) and os.path.isdir(root_dir)
214217

215218
with workdir(root_dir):
@@ -446,7 +449,7 @@ async def generate_sources(
446449
return sources
447450

448451

449-
def main():
452+
def main() -> None:
450453
parser = argparse.ArgumentParser()
451454
parser.add_argument("cargo_lock", help="Path to the Cargo.lock file")
452455
parser.add_argument(

0 commit comments

Comments
 (0)