Merge Code* type stub back to source (#2615)

Co-authored-by: Enrico Minack <github@enrico.minack.dev>
This commit is contained in:
Trim21
2023-07-18 16:37:39 +02:00
committed by GitHub
co-authored by Enrico Minack
parent 0779bf33c6
commit 80ae3f398b
11 changed files with 104 additions and 428 deletions
+15 -31
View File
@@ -19,19 +19,25 @@
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################
from typing import Any, Dict
import github.GithubObject
from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet
class CodeScanAlertInstanceLocation(github.GithubObject.NonCompletableGithubObject):
class CodeScanAlertInstanceLocation(NonCompletableGithubObject):
"""
This class represents code scanning alert instance locations.
The reference can be found here https://docs.github.com/en/rest/reference/code-scanning.
"""
def __str__(self):
def _initAttributes(self) -> None:
self._path: Attribute[str] = NotSet
self._start_line: Attribute[int] = NotSet
self._start_column: Attribute[int] = NotSet
self._end_line: Attribute[int] = NotSet
self._end_column: Attribute[int] = NotSet
def __str__(self) -> str:
return f"{self.path} @ l{self.start_line}:c{self.start_column}-l{self.end_line}:c{self.end_column}"
def __repr__(self) -> str:
@@ -46,47 +52,25 @@ class CodeScanAlertInstanceLocation(github.GithubObject.NonCompletableGithubObje
)
@property
def path(self):
"""
:type: str
"""
def path(self) -> str:
return self._path.value
@property
def start_line(self):
"""
:type: int
"""
def start_line(self) -> int:
return self._start_line.value
@property
def start_column(self):
"""
:type: int
"""
def start_column(self) -> int:
return self._start_column.value
@property
def end_line(self):
"""
:type: int
"""
def end_line(self) -> int:
return self._end_line.value
@property
def end_column(self):
"""
:type: int
"""
def end_column(self) -> int:
return self._end_column.value
def _initAttributes(self) -> None:
self._path = github.GithubObject.NotSet
self._start_line = github.GithubObject.NotSet
self._start_column = github.GithubObject.NotSet
self._end_line = github.GithubObject.NotSet
self._end_column = github.GithubObject.NotSet
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
if "path" in attributes: # pragma no branch
self._path = self._makeStringAttribute(attributes["path"])