diff --git a/github/GitCommit.py b/github/GitCommit.py
index 4a57e86e..73422526 100644
--- a/github/GitCommit.py
+++ b/github/GitCommit.py
@@ -27,101 +27,79 @@
# along with PyGithub. If not, see . #
# #
################################################################################
+from __future__ import annotations
-from typing import Any, Dict
+from typing import Any
import github.GitAuthor
import github.GithubObject
import github.GitTree
+from github.GithubObject import Attribute, CompletableGithubObject, NotSet
-class GitCommit(github.GithubObject.CompletableGithubObject):
+class GitCommit(CompletableGithubObject):
"""
This class represents GitCommits. The reference can be found here https://docs.github.com/en/rest/reference/git#commits
"""
+ def _initAttributes(self) -> None:
+ self._author: Attribute[github.GitAuthor.GitAuthor] = NotSet
+ self._committer: Attribute[github.GitAuthor.GitAuthor] = NotSet
+ self._html_url: Attribute[str] = NotSet
+ self._message: Attribute[str] = NotSet
+ self._parents: Attribute[list[GitCommit]] = NotSet
+ self._sha: Attribute[str] = NotSet
+ self._tree: Attribute[github.GitTree.GitTree] = NotSet
+ self._url: Attribute[str] = NotSet
+
def __repr__(self) -> str:
return self.get__repr__({"sha": self._sha.value})
@property
- def author(self):
- """
- :type: :class:`github.GitAuthor.GitAuthor`
- """
+ def author(self) -> github.GitAuthor.GitAuthor:
self._completeIfNotSet(self._author)
return self._author.value
@property
- def committer(self):
- """
- :type: :class:`github.GitAuthor.GitAuthor`
- """
+ def committer(self) -> github.GitAuthor.GitAuthor:
self._completeIfNotSet(self._committer)
return self._committer.value
@property
- def html_url(self):
- """
- :type: string
- """
+ def html_url(self) -> str:
self._completeIfNotSet(self._html_url)
return self._html_url.value
@property
- def message(self):
- """
- :type: string
- """
+ def message(self) -> str:
self._completeIfNotSet(self._message)
return self._message.value
@property
- def parents(self):
- """
- :type: list of :class:`github.GitCommit.GitCommit`
- """
+ def parents(self) -> list[GitCommit]:
self._completeIfNotSet(self._parents)
return self._parents.value
@property
- def sha(self):
- """
- :type: string
- """
+ def sha(self) -> str:
self._completeIfNotSet(self._sha)
return self._sha.value
@property
- def tree(self):
- """
- :type: :class:`github.GitTree.GitTree`
- """
+ def tree(self) -> github.GitTree.GitTree:
self._completeIfNotSet(self._tree)
return self._tree.value
@property
- def url(self):
- """
- :type: string
- """
+ def url(self) -> str:
self._completeIfNotSet(self._url)
return self._url.value
@property
- def _identity(self):
+ def _identity(self) -> str:
return self.sha
- def _initAttributes(self) -> None:
- self._author = github.GithubObject.NotSet
- self._committer = github.GithubObject.NotSet
- self._html_url = github.GithubObject.NotSet
- self._message = github.GithubObject.NotSet
- self._parents = github.GithubObject.NotSet
- self._sha = github.GithubObject.NotSet
- self._tree = github.GithubObject.NotSet
- self._url = github.GithubObject.NotSet
-
- def _useAttributes(self, attributes: Dict[str, Any]) -> None:
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
if "author" in attributes: # pragma no branch
self._author = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["author"])
if "committer" in attributes: # pragma no branch
diff --git a/github/GitCommit.pyi b/github/GitCommit.pyi
deleted file mode 100644
index 360f91a2..00000000
--- a/github/GitCommit.pyi
+++ /dev/null
@@ -1,28 +0,0 @@
-from typing import Any, Dict, List
-
-from github.GitAuthor import GitAuthor
-from github.GithubObject import CompletableGithubObject
-from github.GitTree import GitTree
-
-class GitCommit(CompletableGithubObject):
- def __repr__(self) -> str: ...
- @property
- def _identity(self) -> str: ...
- def _initAttributes(self) -> None: ...
- def _useAttributes(self, attributes: Dict[str, Any]) -> None: ...
- @property
- def author(self) -> GitAuthor: ...
- @property
- def committer(self) -> GitAuthor: ...
- @property
- def html_url(self) -> str: ...
- @property
- def message(self) -> str: ...
- @property
- def parents(self) -> List[GitCommit]: ...
- @property
- def sha(self) -> str: ...
- @property
- def tree(self) -> GitTree: ...
- @property
- def url(self) -> str: ...
diff --git a/github/Invitation.py b/github/Invitation.py
index 33f69e11..5ed6a36d 100644
--- a/github/Invitation.py
+++ b/github/Invitation.py
@@ -21,95 +21,80 @@
# along with PyGithub. If not, see . #
# #
################################################################################
+from __future__ import annotations
-from typing import Any, Dict
+from datetime import datetime
+from typing import TYPE_CHECKING, Any
import github.GithubObject
+import github.NamedUser
+import github.Repository
+from github.GithubObject import Attribute, CompletableGithubObject, NotSet
+
+if TYPE_CHECKING:
+ from github.NamedUser import NamedUser
+ from github.Repository import Repository
-class Invitation(github.GithubObject.CompletableGithubObject):
+class Invitation(CompletableGithubObject):
"""
This class represents repository invitations. The reference can be found here https://docs.github.com/en/rest/reference/repos#invitations
"""
+ def _initAttributes(self) -> None:
+ self._id: Attribute[int] = NotSet
+ self._permissions: Attribute[str] = NotSet
+ self._created_at: Attribute[datetime] = NotSet
+ self._invitee: Attribute[NamedUser] = NotSet
+ self._inviter: Attribute[NamedUser] = NotSet
+ self._url: Attribute[str] = NotSet
+ self._html_url: Attribute[str] = NotSet
+ self._repository: Attribute[Repository] = NotSet
+
def __repr__(self) -> str:
return self.get__repr__({"id": self._id.value})
@property
- def id(self):
- """
- :type: integer
- """
+ def id(self) -> int:
self._completeIfNotSet(self._id)
return self._id.value
@property
- def permissions(self):
- """
- :type: string
- """
+ def permissions(self) -> str:
self._completeIfNotSet(self._permissions)
return self._permissions.value
@property
- def created_at(self):
- """
- :type: string
- """
+ def created_at(self) -> datetime:
self._completeIfNotSet(self._created_at)
return self._created_at.value
@property
- def invitee(self):
- """
- :type: NamedUser
- """
+ def invitee(self) -> NamedUser:
self._completeIfNotSet(self._invitee)
return self._invitee.value
@property
- def inviter(self):
- """
- :type: NamedUser
- """
+ def inviter(self) -> NamedUser:
self._completeIfNotSet(self._inviter)
return self._inviter.value
@property
- def url(self):
- """
- :type: string
- """
+ def url(self) -> str:
self._completeIfNotSet(self._url)
return self._url.value
@property
- def html_url(self):
- """
- :type: string
- """
+ def html_url(self) -> str:
self._completeIfNotSet(self._html_url)
return self._html_url.value
@property
- def repository(self):
- """
- :type: Repository
- """
+ def repository(self) -> Repository:
self._completeIfNotSet(self._repository)
return self._repository.value
- def _initAttributes(self) -> None:
- self._id = github.GithubObject.NotSet
- self._permissions = github.GithubObject.NotSet
- self._created_at = github.GithubObject.NotSet
- self._invitee = github.GithubObject.NotSet
- self._inviter = github.GithubObject.NotSet
- self._url = github.GithubObject.NotSet
- self._html_url = github.GithubObject.NotSet
- self._repository = github.GithubObject.NotSet
-
- def _useAttributes(self, attributes: Dict[str, Any]) -> None:
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
if "repository" in attributes: # pragma no branch
self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
if "created_at" in attributes: # pragma no branch
diff --git a/github/Invitation.pyi b/github/Invitation.pyi
deleted file mode 100644
index ea8a9f61..00000000
--- a/github/Invitation.pyi
+++ /dev/null
@@ -1,26 +0,0 @@
-from typing import Any, Dict
-
-from github.GithubObject import CompletableGithubObject
-from github.NamedUser import NamedUser
-from github.Repository import Repository
-
-class Invitation(CompletableGithubObject):
- def __repr__(self) -> str: ...
- def _initAttributes(self) -> None: ...
- def _useAttributes(self, attributes: Dict[str, Any]) -> None: ...
- @property
- def created_at(self) -> str: ...
- @property
- def html_url(self) -> str: ...
- @property
- def id(self) -> int: ...
- @property
- def invitee(self) -> NamedUser: ...
- @property
- def inviter(self) -> NamedUser: ...
- @property
- def permissions(self) -> str: ...
- @property
- def repository(self) -> Repository: ...
- @property
- def url(self) -> str: ...
diff --git a/github/Membership.py b/github/Membership.py
index f9278ae1..3938a16e 100644
--- a/github/Membership.py
+++ b/github/Membership.py
@@ -37,77 +37,66 @@
# along with PyGithub. If not, see . #
# #
################################################################################
+from __future__ import annotations
-from typing import Any, Dict
+from typing import TYPE_CHECKING, Any
-import github.GithubObject
+import github.NamedUser
+import github.Organization
+from github.GithubObject import Attribute, CompletableGithubObject, NotSet
+
+if TYPE_CHECKING:
+ from github.NamedUser import NamedUser
+ from github.Organization import Organization
-class Membership(github.GithubObject.CompletableGithubObject):
+class Membership(CompletableGithubObject):
"""
This class represents Membership of an organization. The reference can be found here https://docs.github.com/en/rest/reference/orgs
"""
+ def _initAttributes(self) -> None:
+ self._url: Attribute[str] = NotSet
+ self._state: Attribute[str] = NotSet
+ self._role: Attribute[str] = NotSet
+ self._organization_url: Attribute[str] = NotSet
+ self._organization: Attribute[Organization] = NotSet
+ self._user: Attribute[NamedUser] = NotSet
+
def __repr__(self) -> str:
return self.get__repr__({"url": self._url.value})
@property
- def url(self):
- """
- :type: string
- """
+ def url(self) -> str:
self._completeIfNotSet(self._url)
return self._url.value
@property
- def state(self):
- """
- :type: string
- """
+ def state(self) -> str:
self._completeIfNotSet(self._state)
return self._state.value
@property
- def role(self):
- """
- :type: string
- """
+ def role(self) -> str:
self._completeIfNotSet(self._role)
return self._role.value
@property
- def organization_url(self):
- """
- :type: string
- """
+ def organization_url(self) -> str:
self._completeIfNotSet(self._organization_url)
return self._organization_url.value
@property
- def organization(self):
- """
- :type: :class:`github.Organization.Organization`
- """
+ def organization(self) -> Organization:
self._completeIfNotSet(self._organization)
return self._organization.value
@property
- def user(self):
- """
- :type: :class:`github.NamedUser.NamedUser`
- """
+ def user(self) -> NamedUser:
self._completeIfNotSet(self._user)
return self._user.value
- def _initAttributes(self) -> None:
- self._url = github.GithubObject.NotSet
- self._state = github.GithubObject.NotSet
- self._role = github.GithubObject.NotSet
- self._organization_url = github.GithubObject.NotSet
- self._organization = github.GithubObject.NotSet
- self._user = github.GithubObject.NotSet
-
- def _useAttributes(self, attributes: Dict[str, Any]) -> None:
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
if "url" in attributes: # pragma no branch
self._url = self._makeStringAttribute(attributes["url"])
if "state" in attributes: # pragma no branch
diff --git a/github/Membership.pyi b/github/Membership.pyi
deleted file mode 100644
index 925c252f..00000000
--- a/github/Membership.pyi
+++ /dev/null
@@ -1,20 +0,0 @@
-from typing import Any, Dict
-
-from github.GithubObject import CompletableGithubObject
-from github.NamedUser import NamedUser
-from github.Organization import Organization
-
-class Membership(CompletableGithubObject):
- def __repr__(self) -> str: ...
- def _initAttributes(self) -> None: ...
- def _useAttributes(self, attributes: Dict[str, Any]) -> None: ...
- @property
- def url(self) -> str: ...
- @property
- def role(self) -> str: ...
- @property
- def organization_url(self) -> str: ...
- @property
- def organization(self) -> Organization: ...
- @property
- def user(self) -> NamedUser: ...
diff --git a/github/WorkflowStep.py b/github/WorkflowStep.py
index 52de8a23..3de59912 100644
--- a/github/WorkflowStep.py
+++ b/github/WorkflowStep.py
@@ -19,76 +19,58 @@
# 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 WorkflowStep(github.GithubObject.CompletableGithubObject):
+class WorkflowStep(CompletableGithubObject):
"""
This class represents steps in a Workflow Job. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs
"""
+ def _initAttributes(self) -> None:
+ self._completed_at: Attribute[datetime] = NotSet
+ self._conclusion: Attribute[str] = NotSet
+ self._name: Attribute[str] = NotSet
+ self._number: Attribute[int] = NotSet
+ self._started_at: Attribute[datetime] = NotSet
+ self._status: Attribute[str] = NotSet
+
def __repr__(self) -> str:
return self.get__repr__({"number": self._number.value, "name": self._name.value})
@property
- def completed_at(self):
- """
- :type: datetime.datetime
- """
+ def completed_at(self) -> datetime:
self._completeIfNotSet(self._completed_at)
return self._completed_at.value
@property
- def conclusion(self):
- """
- :type: string
- """
+ def conclusion(self) -> str:
self._completeIfNotSet(self._conclusion)
return self._conclusion.value
@property
- def name(self):
- """
- :type: string
- """
+ def name(self) -> str:
self._completeIfNotSet(self._name)
return self._name.value
@property
- def number(self):
- """
- :type: integer
- """
+ def number(self) -> int:
self._completeIfNotSet(self._number)
return self._number.value
@property
- def started_at(self):
- """
- :type: datetime.datetime
- """
+ def started_at(self) -> datetime:
self._completeIfNotSet(self._started_at)
return self._started_at.value
@property
- def status(self):
- """
- :type: string
- """
+ def status(self) -> str:
self._completeIfNotSet(self._status)
return self._status.value
- def _initAttributes(self) -> None:
- self._completed_at = github.GithubObject.NotSet
- self._conclusion = github.GithubObject.NotSet
- self._name = github.GithubObject.NotSet
- self._number = github.GithubObject.NotSet
- self._started_at = github.GithubObject.NotSet
- self._status = github.GithubObject.NotSet
-
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
if "completed_at" in attributes: # pragma no branch
self._completed_at = self._makeDatetimeAttribute(attributes["completed_at"])
diff --git a/github/WorkflowStep.pyi b/github/WorkflowStep.pyi
deleted file mode 100644
index 1d90ff7a..00000000
--- a/github/WorkflowStep.pyi
+++ /dev/null
@@ -1,21 +0,0 @@
-from datetime import datetime
-from typing import Any, Dict
-
-from github.GithubObject import CompletableGithubObject
-
-class WorkflowStep(CompletableGithubObject):
- def __repr__(self) -> str: ...
- def _initAttributes(self) -> None: ...
- def _useAttributes(self, attributes: Dict[str, Any]) -> None: ...
- @property
- def completed_at(self) -> datetime: ...
- @property
- def conclusion(self) -> str: ...
- @property
- def name(self) -> str: ...
- @property
- def number(self) -> int: ...
- @property
- def started_at(self) -> datetime: ...
- @property
- def status(self) -> str: ...