Enable mypy check_untyped_defs (#2607)

This commit is contained in:
Trim21
2023-07-14 14:49:28 +02:00
committed by GitHub
parent 13e178a3ab
commit 8816889a7d
19 changed files with 215 additions and 310 deletions
+15 -11
View File
@@ -19,18 +19,29 @@
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################
from __future__ import annotations
from typing import List
from typing import TYPE_CHECKING
import github.EnvironmentProtectionRuleReviewer
import github.GithubObject
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
if TYPE_CHECKING:
from github.EnvironmentProtectionRuleReviewer import EnvironmentProtectionRuleReviewer
class EnvironmentProtectionRule(github.GithubObject.NonCompletableGithubObject):
class EnvironmentProtectionRule(NonCompletableGithubObject):
"""
This class represents a protection rule for an environment. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments
"""
def _initAttributes(self):
self._id: Attribute[int] = NotSet
self._node_id: Attribute[str] = NotSet
self._type: Attribute[str] = NotSet
self._reviewers: Attribute[list[EnvironmentProtectionRuleReviewer]] = NotSet
self._wait_timer: Attribute[int] = NotSet
def __repr__(self):
return self.get__repr__({"id": self._id.value})
@@ -49,20 +60,13 @@ class EnvironmentProtectionRule(github.GithubObject.NonCompletableGithubObject):
@property
def reviewers(
self,
) -> List[github.EnvironmentProtectionRuleReviewer.EnvironmentProtectionRuleReviewer]:
) -> list[EnvironmentProtectionRuleReviewer]:
return self._reviewers.value
@property
def wait_timer(self) -> int:
return self._wait_timer.value
def _initAttributes(self):
self._id = github.GithubObject.NotSet
self._node_id = github.GithubObject.NotSet
self._type = github.GithubObject.NotSet
self._reviewers = github.GithubObject.NotSet
self._wait_timer = github.GithubObject.NotSet
def _useAttributes(self, attributes):
if "id" in attributes: # pragma no branch
self._id = self._makeIntAttribute(attributes["id"])