fix new mypy errors

This commit is contained in:
Jörg Thalheim 2019-11-10 13:30:23 +00:00
parent c20b1dd0b7
commit 6faa57ee38
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4

View file

@ -75,8 +75,9 @@ def prefetch_git(repo: Repo) -> Tuple[LockedVersion, Path]:
cmd += [repo.url.geturl()]
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode != 0:
stderr = result.stderr.decode("utf-8")
raise NurError(
f"Failed to prefetch git repository {repo.url.geturl()}: {result.stderr}"
f"Failed to prefetch git repository {repo.url.geturl()}: {stderr}"
)
metadata = json.loads(result.stdout)
@ -104,7 +105,9 @@ def prefetch_github(repo: Repo) -> Tuple[LockedVersion, Optional[Path]]:
def prefetch_gitlab(repo: Repo) -> Tuple[LockedVersion, Optional[Path]]:
gitlab_path = Path(repo.url.path)
gl_repo = GitlabRepo(repo.url.hostname, list(gitlab_path.parts[1:]))
hostname = repo.url.hostname
assert hostname is not None, f"Expect a hostname for Gitlab repo: {repo.name}"
gl_repo = GitlabRepo(hostname, list(gitlab_path.parts[1:]))
commit = gl_repo.latest_commit()
locked_version = repo.locked_version
if locked_version is not None: