From 22c208ac1ced1b7fac3d4314f45bfaa159d672dc Mon Sep 17 00:00:00 2001 From: Trim21 Date: Fri, 18 Aug 2023 03:35:41 +0800 Subject: [PATCH] Merge `RequiredStatusChecks` type stub back to source (#2647) --- github/RequiredStatusChecks.py | 34 +++++++++++++-------------------- github/RequiredStatusChecks.pyi | 14 -------------- 2 files changed, 13 insertions(+), 35 deletions(-) delete mode 100644 github/RequiredStatusChecks.pyi diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py index cc96b0c4..e12420d6 100644 --- a/github/RequiredStatusChecks.py +++ b/github/RequiredStatusChecks.py @@ -19,50 +19,42 @@ # 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 RequiredStatusChecks(github.GithubObject.CompletableGithubObject): +class RequiredStatusChecks(CompletableGithubObject): """ This class represents Required Status Checks. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-status-checks-protection """ + def _initAttributes(self) -> None: + self._strict: Attribute[bool] = NotSet + self._contexts: Attribute[list[str]] = NotSet + self._url: Attribute[str] = NotSet + def __repr__(self) -> str: return self.get__repr__({"strict": self._strict.value, "url": self._url.value}) @property - def strict(self): - """ - :type: bool - """ + def strict(self) -> bool: self._completeIfNotSet(self._strict) return self._strict.value @property - def contexts(self): - """ - :type: list of string - """ + def contexts(self) -> list[str]: self._completeIfNotSet(self._contexts) return self._contexts.value @property - def url(self): - """ - :type: string - """ + def url(self) -> str: self._completeIfNotSet(self._url) return self._url.value - def _initAttributes(self) -> None: - self._strict = github.GithubObject.NotSet - self._contexts = 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 "strict" in attributes: # pragma no branch self._strict = self._makeBoolAttribute(attributes["strict"]) if "contexts" in attributes: # pragma no branch diff --git a/github/RequiredStatusChecks.pyi b/github/RequiredStatusChecks.pyi deleted file mode 100644 index a5058afb..00000000 --- a/github/RequiredStatusChecks.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from typing import Any, Dict, List - -from github.GithubObject import CompletableGithubObject - -class RequiredStatusChecks(CompletableGithubObject): - def __repr__(self) -> str: ... - def _initAttributes(self) -> None: ... - def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... - @property - def contexts(self) -> List[str]: ... - @property - def strict(self) -> bool: ... - @property - def url(self) -> str: ...