1# -*- coding: utf-8 -*- 2 3############################ Copyrights and license ############################ 4# # 5# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> # 6# # 7# This file is part of PyGithub. # 8# http://pygithub.readthedocs.io/ # 9# # 10# PyGithub is free software: you can redistribute it and/or modify it under # 11# the terms of the GNU Lesser General Public License as published by the Free # 12# Software Foundation, either version 3 of the License, or (at your option) # 13# any later version. # 14# # 15# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 16# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 17# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 18# details. # 19# # 20# You should have received a copy of the GNU Lesser General Public License # 21# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 22# # 23################################################################################ 24 25import github.GithubObject 26 27 28class RequiredStatusChecks(github.GithubObject.CompletableGithubObject): 29 """ 30 This class represents Required Status Checks. The reference can be found here https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch 31 """ 32 33 def __repr__(self): 34 return self.get__repr__({"strict": self._strict.value, "url": self._url.value}) 35 36 @property 37 def strict(self): 38 """ 39 :type: bool 40 """ 41 self._completeIfNotSet(self._strict) 42 return self._strict.value 43 44 @property 45 def contexts(self): 46 """ 47 :type: list of string 48 """ 49 self._completeIfNotSet(self._contexts) 50 return self._contexts.value 51 52 @property 53 def url(self): 54 """ 55 :type: string 56 """ 57 self._completeIfNotSet(self._url) 58 return self._url.value 59 60 def _initAttributes(self): 61 self._strict = github.GithubObject.NotSet 62 self._contexts = github.GithubObject.NotSet 63 self._url = github.GithubObject.NotSet 64 65 def _useAttributes(self, attributes): 66 if "strict" in attributes: # pragma no branch 67 self._strict = self._makeBoolAttribute(attributes["strict"]) 68 if "contexts" in attributes: # pragma no branch 69 self._contexts = self._makeListOfStringsAttribute(attributes["contexts"]) 70 if "url" in attributes: # pragma no branch 71 self._url = self._makeStringAttribute(attributes["url"]) 72