Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up get requested reviewers and teams for pr #2349

Merged
merged 3 commits into from Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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