From 42dcc024c4f79fdea81cf703b9df7623c0205c42 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Fri, 18 Aug 2023 15:23:42 +0800 Subject: [PATCH] Merge `Topic` type stub back to source (#2661) --- github/Topic.py | 87 +++++++++++++++--------------------------------- github/Topic.pyi | 31 ----------------- 2 files changed, 27 insertions(+), 91 deletions(-) delete mode 100644 github/Topic.pyi diff --git a/github/Topic.py b/github/Topic.py index 2f5482ff..9b21d335 100644 --- a/github/Topic.py +++ b/github/Topic.py @@ -19,110 +19,77 @@ # along with PyGithub. If not, see . # # # ################################################################################ - +from datetime import datetime from typing import Any, Dict -import github.GithubObject +from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet -class Topic(github.GithubObject.NonCompletableGithubObject): +class Topic(NonCompletableGithubObject): """ This class represents topics as used by https://github.com/topics. The object reference can be found here https://docs.github.com/en/rest/reference/search#search-topics """ + def _initAttributes(self) -> None: + self._name: Attribute[str] = NotSet + self._display_name: Attribute[str] = NotSet + self._short_description: Attribute[str] = NotSet + self._description: Attribute[str] = NotSet + self._created_by: Attribute[str] = NotSet + self._released: Attribute[str] = NotSet + self._created_at: Attribute[datetime] = NotSet + self._updated_at: Attribute[datetime] = NotSet + self._featured: Attribute[bool] = NotSet + self._curated: Attribute[bool] = NotSet + self._score: Attribute[float] = NotSet + def __repr__(self) -> str: return self.get__repr__({"name": self._name.value}) @property - def name(self): - """ - :type: string - """ + def name(self) -> str: return self._name.value @property - def display_name(self): - """ - :type: string - """ + def display_name(self) -> str: return self._display_name.value @property - def short_description(self): - """ - :type: string - """ + def short_description(self) -> str: return self._short_description.value @property - def description(self): - """ - :type: string - """ + def description(self) -> str: return self._description.value @property - def created_by(self): - """ - :type: string - """ + def created_by(self) -> str: return self._created_by.value @property - def released(self): - """ - :type: string - """ + def released(self) -> str: return self._released.value @property - def created_at(self): - """ - :type: datetime.datetime - """ + def created_at(self) -> datetime: return self._created_at.value @property - def updated_at(self): - """ - :type: datetime.datetime - """ + def updated_at(self) -> datetime: return self._updated_at.value @property - def featured(self): - """ - :type: bool - """ + def featured(self) -> bool: return self._featured.value @property - def curated(self): - """ - :type: bool - """ + def curated(self) -> bool: return self._curated.value @property - def score(self): - """ - :type: float - """ + def score(self) -> float: return self._score.value - def _initAttributes(self) -> None: - self._name = github.GithubObject.NotSet - self._display_name = github.GithubObject.NotSet - self._short_description = github.GithubObject.NotSet - self._description = github.GithubObject.NotSet - self._created_by = github.GithubObject.NotSet - self._released = github.GithubObject.NotSet - self._created_at = github.GithubObject.NotSet - self._updated_at = github.GithubObject.NotSet - self._featured = github.GithubObject.NotSet - self._curated = github.GithubObject.NotSet - self._score = github.GithubObject.NotSet - def _useAttributes(self, attributes: Dict[str, Any]) -> None: if "name" in attributes: # pragma no branch self._name = self._makeStringAttribute(attributes["name"]) diff --git a/github/Topic.pyi b/github/Topic.pyi deleted file mode 100644 index 64801e51..00000000 --- a/github/Topic.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from datetime import datetime -from typing import Any, Dict - -from github.GithubObject import NonCompletableGithubObject - -class Topic(NonCompletableGithubObject): - def __repr__(self) -> str: ... - def _initAttributes(self) -> None: ... - def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... - @property - def name(self) -> str: ... - @property - def display_name(self) -> str: ... - @property - def short_description(self) -> str: ... - @property - def description(self) -> str: ... - @property - def created_by(self) -> str: ... - @property - def released(self) -> str: ... - @property - def created_at(self) -> datetime: ... - @property - def updated_at(self) -> datetime: ... - @property - def featured(self) -> bool: ... - @property - def curated(self) -> bool: ... - @property - def score(self) -> float: ...