From 39d37d550963a6a64e66ba3d6b9f4b077270a3ad Mon Sep 17 00:00:00 2001 From: Yobmod Date: Sat, 31 Jul 2021 22:26:20 +0100 Subject: replace some TBDs wiht runtime types --- git/index/base.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'git/index/base.py') diff --git a/git/index/base.py b/git/index/base.py index 6452419c..4c8b923a 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -70,7 +70,7 @@ from .util import ( from typing import (Any, BinaryIO, Callable, Dict, IO, Iterable, Iterator, List, NoReturn, Sequence, TYPE_CHECKING, Tuple, Type, Union) -from git.types import Commit_ish, PathLike, TBD +from git.types import Commit_ish, PathLike if TYPE_CHECKING: from subprocess import Popen @@ -181,7 +181,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): self.version, self.entries, self._extension_data, _conten_sha = read_cache(stream) return self - def _entries_sorted(self) -> List[TBD]: + def _entries_sorted(self) -> List[IndexEntry]: """:return: list of entries, in a sorted fashion, first by path, then by stage""" return sorted(self.entries.values(), key=lambda e: (e.path, e.stage)) @@ -427,8 +427,8 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): # END path exception handling # END for each path - def _write_path_to_stdin(self, proc: 'Popen', filepath: PathLike, item: TBD, fmakeexc: Callable[..., GitError], - fprogress: Callable[[PathLike, bool, TBD], None], + def _write_path_to_stdin(self, proc: 'Popen', filepath: PathLike, item: PathLike, fmakeexc: Callable[..., GitError], + fprogress: Callable[[PathLike, bool, PathLike], None], read_from_stdout: bool = True) -> Union[None, str]: """Write path to proc.stdin and make sure it processes the item, including progress. @@ -492,12 +492,13 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): are at stage 3 will not have a stage 3 entry. """ is_unmerged_blob = lambda t: t[0] != 0 - path_map: Dict[PathLike, List[Tuple[TBD, Blob]]] = {} + path_map: Dict[PathLike, List[Tuple[StageType, Blob]]] = {} for stage, blob in self.iter_blobs(is_unmerged_blob): path_map.setdefault(blob.path, []).append((stage, blob)) # END for each unmerged blob for line in path_map.values(): line.sort() + return path_map @ classmethod -- cgit v1.2.1 From 91fce331de16de6039c94cd4d7314184a5763e61 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Mon, 2 Aug 2021 14:56:03 +0100 Subject: increase mypy strictness (warn unused ignored and warn unreachable) --- git/index/base.py | 1 - 1 file changed, 1 deletion(-) (limited to 'git/index/base.py') diff --git a/git/index/base.py b/git/index/base.py index 4c8b923a..102703e6 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -1202,7 +1202,6 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): handle_stderr(proc, checked_out_files) return checked_out_files # END paths handling - assert "Should not reach this point" @ default_index def reset(self, commit: Union[Commit, 'Reference', str] = 'HEAD', working_tree: bool = False, -- cgit v1.2.1