RepositoryAdvisoryVulnerabilityPackage.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 from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet 27 28 29 class RepositoryAdvisoryVulnerabilityPackage(NonCompletableGithubObject): 30 """ 31 This class represents an identifier for a package that is vulnerable tao parent SecurityAdvisory. 32 The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories 33 """ 34 35 def _initAttributes(self) -> None: 36 self._ecosystem: Attribute[str] = NotSet 37 self._name: Attribute[str | None] = NotSet 38 39 @property 40 def ecosystem(self) -> str: 41 """ 42 :type: string 43 """ 44 return self._ecosystem.value 45 46 @property 47 def name(self) -> str | None: 48 """ 49 :type: string or None 50 """ 51 return self._name.value 52 53 def _useAttributes(self, attributes: dict[str, Any]) -> None: 54 if "ecosystem" in attributes: # pragma no branch 55 self._ecosystem = self._makeStringAttribute(attributes["ecosystem"]) 56 if "name" in attributes: # pragma no branch 57 self._name = self._makeStringAttribute(attributes["name"])