Skip to content

Commit

Permalink
chore: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Nov 13, 2024
1 parent b571a9e commit 7614a38
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/githarbor/providers/githubrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def get_workflow_run(self, run_id: str) -> WorkflowRun:
created_at=run.created_at,
updated_at=run.updated_at,
started_at=run.run_started_at,
completed_at=run.run_attempt,
# completed_at=run.run_concluded_at,
)
except GithubException as e:
msg = f"Workflow run {id} not found: {e!s}"
Expand Down Expand Up @@ -364,10 +364,14 @@ def iter_files(
pattern: str | None = None,
) -> Iterator[str]:
contents = self._repo.get_contents(path, ref=ref or self.default_branch)
assert isinstance(contents, list)
kwargs = {"ref": ref} if ref else {}
while contents:
content = contents.pop(0)
if content.type == "dir":
contents.extend(self._repo.get_contents(content.path, ref=ref))
c = self._repo.get_contents(content.path, **kwargs)
assert isinstance(c, list)
contents.extend(c)
elif not pattern or fnmatch.fnmatch(content.path, pattern):
yield content.path

Expand All @@ -376,7 +380,7 @@ def get_contributors(
sort_by: Literal["commits", "name", "date"] = "commits",
limit: int | None = None,
) -> list[User]:
contributors = self._repo.get_contributors()
contributors = list(self._repo.get_contributors())
if sort_by == "name":
contributors = sorted(contributors, key=lambda c: c.login)
elif sort_by == "date":
Expand Down Expand Up @@ -405,7 +409,10 @@ def compare_branches(
include_stats: bool = True,
) -> dict[str, Any]:
comparison = self._repo.compare(base, head)
result = {"ahead_by": comparison.ahead_by, "behind_by": comparison.behind_by}
result: dict[str, Any] = {
"ahead_by": comparison.ahead_by,
"behind_by": comparison.behind_by,
}

if include_commits:
result["commits"] = [self.get_commit(c.sha) for c in comparison.commits]
Expand Down

0 comments on commit 7614a38

Please sign in to comment.