Merge some simple class' type stubs back to source (#2570)

This commit is contained in:
Trim21
2023-07-11 15:57:16 +02:00
committed by GitHub
parent 61f9ae6c4b
commit 8bdfc3a0d7
38 changed files with 302 additions and 711 deletions
+15 -29
View File
@@ -30,6 +30,7 @@
################################################################################
import github.GithubObject
from github.GithubObject import Attribute
class UserKey(github.GithubObject.CompletableGithubObject):
@@ -37,64 +38,49 @@ class UserKey(github.GithubObject.CompletableGithubObject):
This class represents UserKeys. The reference can be found here https://docs.github.com/en/rest/reference/users#keys
"""
def _initAttributes(self) -> None:
self._id: Attribute[int] = github.GithubObject.NotSet
self._key: Attribute[str] = github.GithubObject.NotSet
self._title: Attribute[str] = github.GithubObject.NotSet
self._url: Attribute[str] = github.GithubObject.NotSet
self._verified: Attribute[bool] = github.GithubObject.NotSet
def __repr__(self):
return self.get__repr__({"id": self._id.value, "title": self._title.value})
@property
def id(self):
"""
:type: integer
"""
def id(self) -> int:
self._completeIfNotSet(self._id)
return self._id.value
@property
def key(self):
"""
:type: string
"""
def key(self) -> str:
self._completeIfNotSet(self._key)
return self._key.value
@property
def title(self):
"""
:type: string
"""
def title(self) -> str:
self._completeIfNotSet(self._title)
return self._title.value
@property
def url(self):
"""
:type: string
"""
def url(self) -> str:
self._completeIfNotSet(self._url)
return self._url.value
@property
def verified(self):
"""
:type: bool
"""
def verified(self) -> bool:
self._completeIfNotSet(self._verified)
return self._verified.value
def delete(self):
def delete(self) -> None:
"""
:calls: `DELETE /user/keys/{id} <https://docs.github.com/en/rest/reference/users#get-a-public-ssh-key-for-the-authenticated-user>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
def _initAttributes(self):
self._id = github.GithubObject.NotSet
self._key = github.GithubObject.NotSet
self._title = github.GithubObject.NotSet
self._url = github.GithubObject.NotSet
self._verified = github.GithubObject.NotSet
def _useAttributes(self, attributes):
def _useAttributes(self, attributes) -> None:
if "id" in attributes: # pragma no branch
self._id = self._makeIntAttribute(attributes["id"])
if "key" in attributes: # pragma no branch