summaryrefslogtreecommitdiff
path: root/git/exc.py
diff options
context:
space:
mode:
authoryobmod <yobmod@gmail.com>2021-03-02 21:46:17 +0000
committeryobmod <yobmod@gmail.com>2021-03-02 21:46:17 +0000
commit2fd9f6ee5c8b4ae4e01a40dc398e2768d838210d (patch)
tree93a63a1bee90204f68cf41dc08484ad4adab7ad4 /git/exc.py
parent71e28b8e2ac1b8bc8990454721740b2073829110 (diff)
downloadgitpython-2fd9f6ee5c8b4ae4e01a40dc398e2768d838210d.tar.gz
add types to git.compat and git.diff
Diffstat (limited to 'git/exc.py')
-rw-r--r--git/exc.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/git/exc.py b/git/exc.py
index bd019c7f..c02b2b3a 100644
--- a/git/exc.py
+++ b/git/exc.py
@@ -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