Skip to content

Commit c074271

Browse files
committed
ref(github): Use explicit field picks instead of dict comprehension
1 parent 5b01fd6 commit c074271

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/sentry/integrations/github/client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,6 @@ class CachedRepo(TypedDict):
557557
default_branch: str | None
558558
archived: bool | None
559559

560-
# Fields from the GitHub API response needed by get_repositories().
561-
_CACHED_REPO_FIELDS = ("id", "name", "full_name", "default_branch", "archived")
562-
563560
def get_accessible_repos_cached(self, ttl: int = 300) -> list[CachedRepo]:
564561
"""
565562
Return all repos accessible to this installation.
@@ -575,7 +572,16 @@ def get_accessible_repos_cached(self, ttl: int = 300) -> list[CachedRepo]:
575572
return cached
576573

577574
all_repos = self.get_repos()
578-
repos = [{k: r.get(k) for k in self._CACHED_REPO_FIELDS} for r in all_repos]
575+
repos: list[GitHubBaseClient.CachedRepo] = [
576+
{
577+
"id": r["id"],
578+
"name": r["name"],
579+
"full_name": r["full_name"],
580+
"default_branch": r.get("default_branch"),
581+
"archived": r.get("archived"),
582+
}
583+
for r in all_repos
584+
]
579585
cache.set(cache_key, repos, ttl)
580586
return repos
581587

0 commit comments

Comments
 (0)