diff options
author | yobmod <yobmod@gmail.com> | 2021-03-02 21:46:17 +0000 |
---|---|---|
committer | yobmod <yobmod@gmail.com> | 2021-03-02 21:46:17 +0000 |
commit | 2fd9f6ee5c8b4ae4e01a40dc398e2768d838210d (patch) | |
tree | 93a63a1bee90204f68cf41dc08484ad4adab7ad4 /git/exc.py | |
parent | 71e28b8e2ac1b8bc8990454721740b2073829110 (diff) | |
download | gitpython-2fd9f6ee5c8b4ae4e01a40dc398e2768d838210d.tar.gz |
add types to git.compat and git.diff
Diffstat (limited to 'git/exc.py')
-rw-r--r-- | git/exc.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -12,10 +12,11 @@ from git.compat import safe_decode from git.repo.base import Repo from git.types import PathLike -from typing import IO, List, Optional, Sequence, Tuple, Union +from typing import IO, List, Optional, Tuple, Union # ------------------------------------------------------------------ + class GitError(Exception): """ Base class for all package exceptions """ @@ -44,7 +45,7 @@ class CommandError(GitError): #: "'%s' failed%s" _msg = "Cmd('%s') failed%s" - def __init__(self, command: Union[List[str], Tuple[str, ...], str], + def __init__(self, command: Union[List[str], Tuple[str, ...], str], status: Union[str, None, Exception] = None, stderr: Optional[IO[str]] = None, stdout: Optional[IO[str]] = None) -> None: if not isinstance(command, (tuple, list)): @@ -84,7 +85,7 @@ class GitCommandNotFound(CommandError): class GitCommandError(CommandError): """ Thrown if execution of the git command fails with non-zero status code. """ - def __init__(self, command: Union[List[str], Tuple[str, ...], str], + def __init__(self, command: Union[List[str], Tuple[str, ...], str], status: Union[str, None, Exception] = None, stderr: Optional[IO[str]] = None, stdout: Optional[IO[str]] = None, @@ -106,7 +107,9 @@ class CheckoutError(GitError): were checked out successfully and hence match the version stored in the index""" - def __init__(self, message: str, failed_files: List[PathLike], valid_files: List[PathLike], failed_reasons: List[str]) -> None: + def __init__(self, message: str, failed_files: List[PathLike], valid_files: List[PathLike], + failed_reasons: List[str]) -> None: + Exception.__init__(self, message) self.failed_files = failed_files self.failed_reasons = failed_reasons |