mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Merge some simple class' type stubs back to source (#2570)
This commit is contained in:
+22
-30
@@ -27,63 +27,55 @@
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
################################################################################
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import github.GithubObject
|
||||
import github.NamedUser
|
||||
import github.Repository
|
||||
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from github.NamedUser import NamedUser
|
||||
from github.Repository import Repository
|
||||
|
||||
|
||||
class PullRequestPart(github.GithubObject.NonCompletableGithubObject):
|
||||
class PullRequestPart(NonCompletableGithubObject):
|
||||
"""
|
||||
This class represents PullRequestParts
|
||||
"""
|
||||
|
||||
def _initAttributes(self) -> None:
|
||||
self._label: Attribute[str] = NotSet
|
||||
self._ref: Attribute[str] = NotSet
|
||||
self._repo: Attribute[Repository] = NotSet
|
||||
self._sha: Attribute[str] = NotSet
|
||||
self._user: Attribute[NamedUser] = NotSet
|
||||
|
||||
def __repr__(self):
|
||||
return self.get__repr__({"sha": self._sha.value})
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
def label(self) -> str:
|
||||
return self._label.value
|
||||
|
||||
@property
|
||||
def ref(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
def ref(self) -> str:
|
||||
return self._ref.value
|
||||
|
||||
@property
|
||||
def repo(self):
|
||||
"""
|
||||
:type: :class:`github.Repository.Repository`
|
||||
"""
|
||||
def repo(self) -> Repository:
|
||||
return self._repo.value
|
||||
|
||||
@property
|
||||
def sha(self):
|
||||
"""
|
||||
:type: string
|
||||
"""
|
||||
def sha(self) -> str:
|
||||
return self._sha.value
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
"""
|
||||
:type: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
def user(self) -> NamedUser:
|
||||
return self._user.value
|
||||
|
||||
def _initAttributes(self):
|
||||
self._label = github.GithubObject.NotSet
|
||||
self._ref = github.GithubObject.NotSet
|
||||
self._repo = github.GithubObject.NotSet
|
||||
self._sha = github.GithubObject.NotSet
|
||||
self._user = github.GithubObject.NotSet
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
def _useAttributes(self, attributes) -> None:
|
||||
if "label" in attributes: # pragma no branch
|
||||
self._label = self._makeStringAttribute(attributes["label"])
|
||||
if "ref" in attributes: # pragma no branch
|
||||
|
||||
Reference in New Issue
Block a user