Skip to content

Commit

Permalink
Speed up get requested reviewers and teams for pr (#2349)
Browse files Browse the repository at this point in the history
  • Loading branch information
tisonkun committed Nov 4, 2022
1 parent 3a6235b commit 6725ece
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions github/PullRequest.py
Expand Up @@ -53,6 +53,7 @@
import github.PullRequestMergeStatus
import github.PullRequestPart
import github.PullRequestReview
import github.Team

from . import Consts

Expand Down Expand Up @@ -355,6 +356,16 @@ def updated_at(self):
self._completeIfNotSet(self._updated_at)
return self._updated_at.value

@property
def requested_reviewers(self):
self._completeIfNotSet(self._requested_reviewers)
return self._requested_reviewers.value

@property
def requested_teams(self):
self._completeIfNotSet(self._requested_teams)
return self._requested_teams.value

@property
def url(self):
"""
Expand Down Expand Up @@ -984,6 +995,8 @@ def _initAttributes(self):
self._updated_at = github.GithubObject.NotSet
self._url = github.GithubObject.NotSet
self._user = github.GithubObject.NotSet
self._requested_reviewers = github.GithubObject.NotSet
self._requested_teams = github.GithubObject.NotSet

def _useAttributes(self, attributes):
if "additions" in attributes: # pragma no branch
Expand Down Expand Up @@ -1101,3 +1114,11 @@ def _useAttributes(self, attributes):
self._user = self._makeClassAttribute(
github.NamedUser.NamedUser, attributes["user"]
)
if "requested_reviewers" in attributes:
self._requested_reviewers = self._makeListOfClassesAttribute(
github.NamedUser.NamedUser, attributes["requested_reviewers"]
)
if "requested_teams" in attributes:
self._requested_teams = self._makeListOfClassesAttribute(
github.Team.Team, attributes["requested_teams"]
)
4 changes: 4 additions & 0 deletions github/PullRequest.pyi
Expand Up @@ -30,6 +30,10 @@ class PullRequest(CompletableGithubObject):
@property
def assignees(self) -> List[NamedUser]: ...
@property
def requested_reviewers(self) -> List[NamedUser]: ...
@property
def requested_teams(self) -> List[Team]: ...
@property
def base(self) -> PullRequestPart: ...
@property
def body(self) -> str: ...
Expand Down

0 comments on commit 6725ece

Please sign in to comment.