CheckRunAnnotation.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2020 Dhruv Manilawala <dhruvmanila@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 23 from typing import Any, Dict 24 25 from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet 26 27 28 class CheckRunAnnotation(NonCompletableGithubObject): 29 """ 30 This class represents check run annotations. 31 The reference can be found here: https://docs.github.com/en/rest/reference/checks#list-check-run-annotations 32 """ 33 34 def _initAttributes(self) -> None: 35 self._annotation_level: Attribute[str] = NotSet 36 self._end_column: Attribute[int] = NotSet 37 self._end_line: Attribute[int] = NotSet 38 self._message: Attribute[str] = NotSet 39 self._path: Attribute[str] = NotSet 40 self._raw_details: Attribute[str] = NotSet 41 self._start_column: Attribute[int] = NotSet 42 self._start_line: Attribute[int] = NotSet 43 self._title: Attribute[str] = NotSet 44 45 def __repr__(self) -> str: 46 return self.get__repr__({"title": self._title.value}) 47 48 @property 49 def annotation_level(self) -> str: 50 return self._annotation_level.value 51 52 @property 53 def end_column(self) -> int: 54 return self._end_column.value 55 56 @property 57 def end_line(self) -> int: 58 return self._end_line.value 59 60 @property 61 def message(self) -> str: 62 return self._message.value 63 64 @property 65 def path(self) -> str: 66 return self._path.value 67 68 @property 69 def raw_details(self) -> str: 70 return self._raw_details.value 71 72 @property 73 def start_column(self) -> int: 74 return self._start_column.value 75 76 @property 77 def start_line(self) -> int: 78 return self._start_line.value 79 80 @property 81 def title(self) -> str: 82 return self._title.value 83 84 def _useAttributes(self, attributes: Dict[str, Any]) -> None: 85 if "annotation_level" in attributes: # pragma no branch 86 self._annotation_level = self._makeStringAttribute(attributes["annotation_level"]) 87 if "end_column" in attributes: # pragma no branch 88 self._end_column = self._makeIntAttribute(attributes["end_column"]) 89 if "end_line" in attributes: # pragma no branch 90 self._end_line = self._makeIntAttribute(attributes["end_line"]) 91 if "message" in attributes: # pragma no branch 92 self._message = self._makeStringAttribute(attributes["message"]) 93 if "path" in attributes: # pragma no branch 94 self._path = self._makeStringAttribute(attributes["path"]) 95 if "raw_details" in attributes: # pragma no branch 96 self._raw_details = self._makeStringAttribute(attributes["raw_details"]) 97 if "start_column" in attributes: # pragma no branch 98 self._start_column = self._makeIntAttribute(attributes["start_column"]) 99 if "start_line" in attributes: # pragma no branch 100 self._start_line = self._makeIntAttribute(attributes["start_line"]) 101 if "title" in attributes: # pragma no branch 102 self._title = self._makeStringAttribute(attributes["title"])