summaryrefslogtreecommitdiff
path: root/git/diff.py
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-07-24 17:10:32 +0100
committerYobmod <yobmod@gmail.com>2021-07-24 17:10:32 +0100
commite6345d60a7926bd413d3d7238ba06f7c81a7faf9 (patch)
tree3f776c6a46bafaec663483adf05d6f96cead7a50 /git/diff.py
parent0c1446da2d1ce0382cbc65d7a2aad4483783ae74 (diff)
downloadgitpython-e6345d60a7926bd413d3d7238ba06f7c81a7faf9.tar.gz
Replace all Typeguard with cast, revert update to typing-extensions==3.10.0
Diffstat (limited to 'git/diff.py')
-rw-r--r--git/diff.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/git/diff.py b/git/diff.py
index 98a5cfd9..74ca0b64 100644
--- a/git/diff.py
+++ b/git/diff.py
@@ -15,8 +15,8 @@ from .objects.util import mode_str_to_int
# typing ------------------------------------------------------------------
-from typing import Any, Iterator, List, Match, Optional, Tuple, Type, TypeVar, Union, TYPE_CHECKING
-from git.types import PathLike, TBD, Literal, TypeGuard
+from typing import Any, Iterator, List, Match, Optional, Tuple, Type, TypeVar, Union, TYPE_CHECKING, cast
+from git.types import PathLike, TBD, Literal
if TYPE_CHECKING:
from .objects.tree import Tree
@@ -28,9 +28,9 @@ if TYPE_CHECKING:
Lit_change_type = Literal['A', 'D', 'C', 'M', 'R', 'T', 'U']
-def is_change_type(inp: str) -> TypeGuard[Lit_change_type]:
- # return True
- return inp in ['A', 'D', 'C', 'M', 'R', 'T', 'U']
+# def is_change_type(inp: str) -> TypeGuard[Lit_change_type]:
+# # return True
+# return inp in ['A', 'D', 'C', 'M', 'R', 'T', 'U']
# ------------------------------------------------------------------------
@@ -517,8 +517,8 @@ class Diff(object):
# Change type can be R100
# R: status letter
# 100: score (in case of copy and rename)
- assert is_change_type(_change_type[0]), f"Unexpected value for change_type received: {_change_type[0]}"
- change_type: Lit_change_type = _change_type[0]
+ # assert is_change_type(_change_type[0]), f"Unexpected value for change_type received: {_change_type[0]}"
+ change_type: Lit_change_type = cast(Lit_change_type, _change_type[0])
score_str = ''.join(_change_type[1:])
score = int(score_str) if score_str.isdigit() else None
path = path.strip()