RepositoryAdvisoryCreditDetailed.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2023 Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com> # 4 # # 5 # This file is part of PyGithub. # 6 # http://pygithub.readthedocs.io/ # 7 # # 8 # PyGithub is free software: you can redistribute it and/or modify it under # 9 # the terms of the GNU Lesser General Public License as published by the Free # 10 # Software Foundation, either version 3 of the License, or (at your option) # 11 # any later version. # 12 # # 13 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 15 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 16 # details. # 17 # # 18 # You should have received a copy of the GNU Lesser General Public License # 19 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 20 # # 21 ################################################################################ 22 from __future__ import annotations 23 24 from typing import Any 25 26 import github.NamedUser 27 from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet 28 29 30 class RepositoryAdvisoryCreditDetailed(NonCompletableGithubObject): 31 """ 32 This class represents a credit that is assigned to a SecurityAdvisory. 33 The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories 34 """ 35 36 @property 37 def state(self) -> str: 38 """ 39 :type: string 40 """ 41 return self._state.value 42 43 @property 44 def type(self) -> str: 45 """ 46 :type: string 47 """ 48 return self._type.value 49 50 @property 51 def user(self) -> github.NamedUser.NamedUser: 52 """ 53 :type: :class:`github.NamedUser.NamedUser` 54 """ 55 return self._user.value 56 57 def _initAttributes(self) -> None: 58 self._state: Attribute[str] = NotSet 59 self._type: Attribute[str] = NotSet 60 self._user: Attribute[github.NamedUser.NamedUser] = NotSet 61 62 def _useAttributes(self, attributes: dict[str, Any]) -> None: 63 if "state" in attributes: # pragma no branch 64 self._state = self._makeStringAttribute(attributes["state"]) 65 if "type" in attributes: # pragma no branch 66 self._type = self._makeStringAttribute(attributes["type"]) 67 if "user" in attributes: # pragma no branch 68 self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])