From 2c8b596364ee6614231be233603a5a814af29cf0 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Fri, 18 Aug 2023 14:46:07 +0800 Subject: [PATCH] Merge `License` type stub back to source (#2659) --- github/License.py | 90 +++++++++++++++------------------------------- github/License.pyi | 30 ---------------- 2 files changed, 29 insertions(+), 91 deletions(-) delete mode 100644 github/License.pyi diff --git a/github/License.py b/github/License.py index c095c7a2..85446331 100644 --- a/github/License.py +++ b/github/License.py @@ -19,122 +19,90 @@ # along with PyGithub. If not, see . # # # ################################################################################ +from __future__ import annotations -from typing import Any, Dict +from typing import Any -import github.GithubObject +from github.GithubObject import Attribute, CompletableGithubObject, NotSet -class License(github.GithubObject.CompletableGithubObject): +class License(CompletableGithubObject): """ This class represents Licenses. The reference can be found here https://docs.github.com/en/rest/reference/licenses """ + def _initAttributes(self) -> None: + self._key: Attribute[str] = NotSet + self._name: Attribute[str] = NotSet + self._spdx_id: Attribute[str] = NotSet + self._url: Attribute[str] = NotSet + self._html_url: Attribute[str] = NotSet + self._description: Attribute[str] = NotSet + self._implementation: Attribute[str] = NotSet + self._body: Attribute[str] = NotSet + self._permissions: Attribute[list[str]] = NotSet + self._conditions: Attribute[list[str]] = NotSet + self._limitations: Attribute[list[str]] = NotSet + def __repr__(self) -> str: return self.get__repr__({"name": self._name.value}) @property - def key(self): - """ - :type: string - """ + def key(self) -> str: self._completeIfNotSet(self._key) return self._key.value @property - def name(self): - """ - :type: string - """ + def name(self) -> str: self._completeIfNotSet(self._name) return self._name.value @property - def spdx_id(self): - """ - :type: string - """ + def spdx_id(self) -> str: self._completeIfNotSet(self._spdx_id) return self._spdx_id.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 description(self): - """ - :type: string - """ + def description(self) -> str: self._completeIfNotSet(self._description) return self._description.value @property - def implementation(self): - """ - :type: string - """ + def implementation(self) -> str: self._completeIfNotSet(self._implementation) return self._implementation.value @property - def body(self): - """ - :type: string - """ + def body(self) -> str: self._completeIfNotSet(self._body) return self._body.value @property - def permissions(self): - """ - :type: list of string - """ + def permissions(self) -> list[str]: self._completeIfNotSet(self._permissions) return self._permissions.value @property - def conditions(self): - """ - :type: list of string - """ + def conditions(self) -> list[str]: self._completeIfNotSet(self._conditions) return self._conditions.value @property - def limitations(self): - """ - :type: list of string - """ + def limitations(self) -> list[str]: self._completeIfNotSet(self._limitations) return self._limitations.value - def _initAttributes(self) -> None: - self._key = github.GithubObject.NotSet - self._name = github.GithubObject.NotSet - self._spdx_id = github.GithubObject.NotSet - self._url = github.GithubObject.NotSet - self._html_url = github.GithubObject.NotSet - self._description = github.GithubObject.NotSet - self._implementation = github.GithubObject.NotSet - self._body = github.GithubObject.NotSet - self._permissions = github.GithubObject.NotSet - self._conditions = github.GithubObject.NotSet - self._limitations = github.GithubObject.NotSet - - def _useAttributes(self, attributes: Dict[str, Any]) -> None: + def _useAttributes(self, attributes: dict[str, Any]) -> None: if "key" in attributes: # pragma no branch self._key = self._makeStringAttribute(attributes["key"]) if "name" in attributes: # pragma no branch diff --git a/github/License.pyi b/github/License.pyi deleted file mode 100644 index b8956f86..00000000 --- a/github/License.pyi +++ /dev/null @@ -1,30 +0,0 @@ -from typing import Any, Dict, List - -from github.GithubObject import CompletableGithubObject - -class License(CompletableGithubObject): - def __repr__(self) -> str: ... - def _initAttributes(self) -> None: ... - def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... - @property - def body(self) -> str: ... - @property - def conditions(self) -> List[str]: ... - @property - def description(self) -> str: ... - @property - def html_url(self) -> str: ... - @property - def implementation(self) -> str: ... - @property - def key(self) -> str: ... - @property - def limitations(self) -> List[str]: ... - @property - def name(self) -> str: ... - @property - def permissions(self) -> List[str]: ... - @property - def url(self) -> str: ... - @property - def spdx_id(self) -> str: ...