From c5f8783da7820a8f7cb7294bcc1a552b0c90cbdf Mon Sep 17 00:00:00 2001 From: Trim21 Date: Fri, 1 Sep 2023 01:31:34 +0800 Subject: [PATCH] Merge `IssueEvent` type stub back to source (#2684) --- github/IssueEvent.py | 141 ++++++++++++++---------------------------- github/IssueEvent.pyi | 49 --------------- 2 files changed, 46 insertions(+), 144 deletions(-) delete mode 100644 github/IssueEvent.pyi diff --git a/github/IssueEvent.py b/github/IssueEvent.py index 9d0c16aa..fa7ad19e 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -28,187 +28,138 @@ # along with PyGithub. If not, see . # # # ################################################################################ +from __future__ import annotations -from typing import Any, Dict +from datetime import datetime +from typing import Any import github.GithubObject import github.Issue +import github.Label +import github.Milestone import github.NamedUser +from github.GithubObject import Attribute, CompletableGithubObject, NotSet -class IssueEvent(github.GithubObject.CompletableGithubObject): +class IssueEvent(CompletableGithubObject): """ This class represents IssueEvents. The reference can be found here https://docs.github.com/en/rest/reference/issues#events """ + def _initAttributes(self) -> None: + self._actor: Attribute[github.NamedUser.NamedUser] = NotSet + self._commit_id: Attribute[str] = NotSet + self._created_at: Attribute[datetime] = NotSet + self._event: Attribute[str] = NotSet + self._id: Attribute[int] = NotSet + self._issue: Attribute[github.Issue.Issue] = NotSet + self._url: Attribute[str] = NotSet + self._node_id: Attribute[str] = NotSet + self._commit_url: Attribute[str] = NotSet + self._label: Attribute[github.Label.Label] = NotSet + self._assignee: Attribute[github.NamedUser.NamedUser] = NotSet + self._assigner: Attribute[github.NamedUser.NamedUser] = NotSet + self._review_requester: Attribute[github.NamedUser.NamedUser] = NotSet + self._requested_reviewer: Attribute[github.NamedUser.NamedUser] = NotSet + self._milestone: Attribute[github.Milestone.Milestone] = NotSet + self._rename: Attribute[dict] = NotSet + self._dismissed_review: Attribute[dict] = NotSet + self._lock_reason: Attribute[str] = NotSet + def __repr__(self) -> str: return self.get__repr__({"id": self._id.value}) @property - def actor(self): - """ - :type: :class:`github.NamedUser.NamedUser` - """ + def actor(self) -> github.NamedUser.NamedUser: self._completeIfNotSet(self._actor) return self._actor.value @property - def commit_id(self): - """ - :type: string - """ + def commit_id(self) -> str: self._completeIfNotSet(self._commit_id) return self._commit_id.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 event(self): - """ - :type: string - """ + def event(self) -> str: self._completeIfNotSet(self._event) return self._event.value @property - def id(self): - """ - :type: integer - """ + def id(self) -> int: self._completeIfNotSet(self._id) return self._id.value @property - def issue(self): - """ - :type: :class:`github.Issue.Issue` - """ + def issue(self) -> github.Issue.Issue: self._completeIfNotSet(self._issue) return self._issue.value @property - def url(self): - """ - :type: string - """ + def url(self) -> str: self._completeIfNotSet(self._url) return self._url.value @property - def node_id(self): - """ - :type: string - """ + def node_id(self) -> str: self._completeIfNotSet(self._node_id) return self._node_id.value @property - def commit_url(self): - """ - :type: string - """ + def commit_url(self) -> str: self._completeIfNotSet(self._commit_url) return self._commit_url.value @property - def label(self): - """ - :type: :class:`github.Label.Label` - """ + def label(self) -> github.Label.Label: self._completeIfNotSet(self._label) return self._label.value @property - def assignee(self): - """ - :type: :class:`github.NamedUser.NamedUser` - """ + def assignee(self) -> github.NamedUser.NamedUser: self._completeIfNotSet(self._assignee) return self._assignee.value @property - def assigner(self): - """ - :type: :class:`github.NamedUser.NamedUser` - """ + def assigner(self) -> github.NamedUser.NamedUser: self._completeIfNotSet(self._assigner) return self._assigner.value @property - def review_requester(self): - """ - :type: :class:`github.NamedUser.NamedUser` - """ + def review_requester(self) -> github.NamedUser.NamedUser: self._completeIfNotSet(self._review_requester) return self._review_requester.value @property - def requested_reviewer(self): - """ - :type: :class:`github.NamedUser.NamedUser` - """ + def requested_reviewer(self) -> github.NamedUser.NamedUser: self._completeIfNotSet(self._requested_reviewer) return self._requested_reviewer.value @property - def milestone(self): - """ - :type: :class:`github.Milestone.Milestone` - """ + def milestone(self) -> github.Milestone.Milestone: self._completeIfNotSet(self._milestone) return self._milestone.value @property - def rename(self): - """ - :type: dict - """ + def rename(self) -> dict: self._completeIfNotSet(self._rename) return self._rename.value @property - def dismissed_review(self): - """ - :type: dict - """ + def dismissed_review(self) -> dict: self._completeIfNotSet(self._dismissed_review) return self._dismissed_review.value @property - def lock_reason(self): - """ - :type: string - """ + def lock_reason(self) -> str: self._completeIfNotSet(self._lock_reason) return self._lock_reason.value - def _initAttributes(self) -> None: - self._actor = github.GithubObject.NotSet - self._commit_id = github.GithubObject.NotSet - self._created_at = github.GithubObject.NotSet - self._event = github.GithubObject.NotSet - self._id = github.GithubObject.NotSet - self._issue = github.GithubObject.NotSet - self._url = github.GithubObject.NotSet - self._node_id = github.GithubObject.NotSet - self._commit_url = github.GithubObject.NotSet - self._label = github.GithubObject.NotSet - self._assignee = github.GithubObject.NotSet - self._assigner = github.GithubObject.NotSet - self._review_requester = github.GithubObject.NotSet - self._requested_reviewer = github.GithubObject.NotSet - self._milestone = github.GithubObject.NotSet - self._rename = github.GithubObject.NotSet - self._dismissed_review = github.GithubObject.NotSet - self._lock_reason = github.GithubObject.NotSet - - def _useAttributes(self, attributes: Dict[str, Any]) -> None: + def _useAttributes(self, attributes: dict[str, Any]) -> None: if "actor" in attributes: # pragma no branch self._actor = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["actor"]) if "commit_id" in attributes: # pragma no branch diff --git a/github/IssueEvent.pyi b/github/IssueEvent.pyi deleted file mode 100644 index 03720ade..00000000 --- a/github/IssueEvent.pyi +++ /dev/null @@ -1,49 +0,0 @@ -from datetime import datetime -from typing import Any, Dict, Optional, Union - -from github.GithubObject import CompletableGithubObject -from github.Issue import Issue -from github.Label import Label -from github.Milestone import Milestone -from github.NamedUser import NamedUser - -class IssueEvent(CompletableGithubObject): - def __repr__(self) -> str: ... - def _initAttributes(self) -> None: ... - def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... - @property - def actor(self) -> NamedUser: ... - @property - def assignee(self) -> Optional[NamedUser]: ... - @property - def assigner(self) -> Optional[NamedUser]: ... - @property - def commit_id(self) -> Optional[str]: ... - @property - def commit_url(self) -> Optional[str]: ... - @property - def created_at(self) -> datetime: ... - @property - def dismissed_review(self) -> Optional[Dict[str, Union[str, int]]]: ... - @property - def event(self) -> str: ... - @property - def id(self) -> int: ... - @property - def issue(self) -> Issue: ... - @property - def label(self) -> Optional[Label]: ... - @property - def lock_reason(self) -> Optional[str]: ... - @property - def milestone(self) -> Optional[Milestone]: ... - @property - def node_id(self) -> str: ... - @property - def rename(self) -> Optional[Dict[str, str]]: ... - @property - def requested_reviewer(self) -> Optional[NamedUser]: ... - @property - def review_requester(self) -> Optional[NamedUser]: ... - @property - def url(self) -> str: ...