diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py
index 57e27419..6a02312b 100644
--- a/github/RepositoryKey.py
+++ b/github/RepositoryKey.py
@@ -32,92 +32,70 @@
# along with PyGithub. If not, see . #
# #
################################################################################
-
+from datetime import datetime
from typing import Any, Dict
-import github.GithubObject
+from github.GithubObject import Attribute, CompletableGithubObject, NotSet
-class RepositoryKey(github.GithubObject.CompletableGithubObject):
+class RepositoryKey(CompletableGithubObject):
"""
This class represents RepositoryKeys. The reference can be found here https://docs.github.com/en/rest/reference/repos#deploy-keys
"""
+ def _initAttributes(self) -> None:
+ self._created_at: Attribute[datetime] = NotSet
+ self._id: Attribute[int] = NotSet
+ self._key: Attribute[str] = NotSet
+ self._title: Attribute[str] = NotSet
+ self._url: Attribute[str] = NotSet
+ self._verified: Attribute[bool] = NotSet
+ self._read_only: Attribute[bool] = NotSet
+
def __repr__(self) -> str:
return self.get__repr__({"id": self._id.value, "title": self._title.value})
@property
- def created_at(self):
- """
- :type: datetime.datetime
- """
+ def created_at(self) -> datetime:
self._completeIfNotSet(self._created_at)
return self._created_at.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
@property
- def read_only(self):
- """
- :type: bool
- """
+ def read_only(self) -> bool:
self._completeIfNotSet(self._read_only)
return self._read_only.value
- def delete(self):
+ def delete(self) -> None:
"""
:calls: `DELETE /repos/{owner}/{repo}/keys/{id} `_
- :rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
- def _initAttributes(self) -> None:
- self._created_at = github.GithubObject.NotSet
- 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
- self._read_only = github.GithubObject.NotSet
-
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
if "created_at" in attributes: # pragma no branch
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
diff --git a/github/RepositoryKey.pyi b/github/RepositoryKey.pyi
deleted file mode 100644
index 44a942b6..00000000
--- a/github/RepositoryKey.pyi
+++ /dev/null
@@ -1,24 +0,0 @@
-from datetime import datetime
-from typing import Any, Dict
-
-from github.GithubObject import CompletableGithubObject
-
-class RepositoryKey(CompletableGithubObject):
- def __repr__(self) -> str: ...
- def _initAttributes(self) -> None: ...
- def _useAttributes(self, attributes: Dict[str, Any]) -> None: ...
- @property
- def created_at(self) -> datetime: ...
- def delete(self) -> None: ...
- @property
- def id(self) -> int: ...
- @property
- def key(self) -> str: ...
- @property
- def read_only(self) -> bool: ...
- @property
- def title(self) -> str: ...
- @property
- def url(self) -> str: ...
- @property
- def verified(self) -> bool: ...