mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Speed up get requested reviewers and teams for pr (#2349)
This commit is contained in:
@@ -53,6 +53,7 @@ import github.PullRequestComment
|
||||
import github.PullRequestMergeStatus
|
||||
import github.PullRequestPart
|
||||
import github.PullRequestReview
|
||||
import github.Team
|
||||
|
||||
from . import Consts
|
||||
|
||||
@@ -355,6 +356,16 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
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):
|
||||
"""
|
||||
@@ -984,6 +995,8 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
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
|
||||
@@ -1101,3 +1114,11 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
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"]
|
||||
)
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user