diff options
author | Dominic <yobmod@gmail.com> | 2021-08-03 16:40:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-03 16:40:48 +0100 |
commit | fe54118ec07a68d5dc6f6108510cffc55dfca643 (patch) | |
tree | 3025974ca54ef607ee3d4660da4dc242e184f8ea /git/diff.py | |
parent | d8a639865d02a6bb3f93a233d3caa928d18bc622 (diff) | |
parent | 84232f7c71e41e56636f203eb26763a03ab6e945 (diff) | |
download | gitpython-fe54118ec07a68d5dc6f6108510cffc55dfca643.tar.gz |
Merge pull request #1311 from Yobmod/main
Drop 3.6, increase type strictness
Diffstat (limited to 'git/diff.py')
-rw-r--r-- | git/diff.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/git/diff.py b/git/diff.py index 74ca0b64..cea66d7e 100644 --- a/git/diff.py +++ b/git/diff.py @@ -16,7 +16,7 @@ from .objects.util import mode_str_to_int # typing ------------------------------------------------------------------ from typing import Any, Iterator, List, Match, Optional, Tuple, Type, TypeVar, Union, TYPE_CHECKING, cast -from git.types import PathLike, TBD, Literal +from git.types import PathLike, Literal if TYPE_CHECKING: from .objects.tree import Tree @@ -24,6 +24,7 @@ if TYPE_CHECKING: from git.repo.base import Repo from git.objects.base import IndexObject from subprocess import Popen + from git import Git Lit_change_type = Literal['A', 'D', 'C', 'M', 'R', 'T', 'U'] @@ -442,7 +443,7 @@ class Diff(object): return None @ classmethod - def _index_from_patch_format(cls, repo: 'Repo', proc: TBD) -> DiffIndex: + def _index_from_patch_format(cls, repo: 'Repo', proc: Union['Popen', 'Git.AutoInterrupt']) -> DiffIndex: """Create a new DiffIndex from the given text which must be in patch format :param repo: is the repository we are operating on - it is required :param stream: result of 'git diff' as a stream (supporting file protocol) @@ -455,8 +456,8 @@ class Diff(object): # for now, we have to bake the stream text = b''.join(text_list) index: 'DiffIndex' = DiffIndex() - previous_header = None - header = None + previous_header: Union[Match[bytes], None] = None + header: Union[Match[bytes], None] = None a_path, b_path = None, None # for mypy a_mode, b_mode = None, None # for mypy for _header in cls.re_header.finditer(text): |