diff options
Diffstat (limited to 'git/diff.py')
-rw-r--r-- | git/diff.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/git/diff.py b/git/diff.py index 21b66640..f07bd93a 100644 --- a/git/diff.py +++ b/git/diff.py @@ -26,8 +26,13 @@ if TYPE_CHECKING: Lit_change_type = Literal['A', 'D', 'M', 'R', 'T'] + +def is_change_type(inp: str) -> TypeGuard[Lit_change_type]: + return inp in Lit_change_type.__args__ # type: ignore + # ------------------------------------------------------------------------ + __all__ = ('Diffable', 'DiffIndex', 'Diff', 'NULL_TREE') # Special object to compare against the empty tree in diffs @@ -503,13 +508,10 @@ class Diff(object): a_blob_id: Union[str, None] b_blob_id: Union[str, None] old_mode, new_mode, a_blob_id, b_blob_id, _change_type = meta.split(None, 4) - # Change type can be R100 + # _Change_type can be R100 # R: status letter # 100: score (in case of copy and rename) - def is_change_type(inp: str) -> TypeGuard[Lit_change_type]: - return inp in Lit_change_type.__args__ # type: ignore - assert is_change_type(_change_type[0]) change_type: Lit_change_type = _change_type[0] score_str = ''.join(_change_type[1:]) |