Skip to content

Commit 5aa8c34

Browse files
committed
Improve type of repo.blame_incremental()
1 parent ecb1f79 commit 5aa8c34

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

git/repo/base.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -811,24 +811,24 @@ def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterat
811811
should get a continuous range spanning all line numbers in the file.
812812
"""
813813

814-
data = self.git.blame(rev, '--', file, p=True, incremental=True, stdout_as_string=False, **kwargs)
815-
commits: Dict[str, Commit] = {}
814+
data: bytes = self.git.blame(rev, '--', file, p=True, incremental=True, stdout_as_string=False, **kwargs)
815+
commits: Dict[bytes, Commit] = {}
816816

817817
stream = (line for line in data.split(b'\n') if line)
818818
while True:
819819
try:
820820
line = next(stream) # when exhausted, causes a StopIteration, terminating this function
821821
except StopIteration:
822822
return
823-
split_line: Tuple[str, str, str, str] = line.split()
824-
hexsha, orig_lineno_str, lineno_str, num_lines_str = split_line
825-
lineno = int(lineno_str)
826-
num_lines = int(num_lines_str)
827-
orig_lineno = int(orig_lineno_str)
823+
split_line = line.split()
824+
hexsha, orig_lineno_b, lineno_b, num_lines_b = split_line
825+
lineno = int(lineno_b)
826+
num_lines = int(num_lines_b)
827+
orig_lineno = int(orig_lineno_b)
828828
if hexsha not in commits:
829829
# Now read the next few lines and build up a dict of properties
830830
# for this commit
831-
props = {}
831+
props: Dict[bytes, bytes] = {}
832832
while True:
833833
try:
834834
line = next(stream)
@@ -1126,7 +1126,7 @@ def clone(self, path: PathLike, progress: Optional[Callable] = None,
11261126

11271127
@ classmethod
11281128
def clone_from(cls, url: PathLike, to_path: PathLike, progress: Optional[Callable] = None,
1129-
env: Optional[Mapping[str, Any]] = None,
1129+
env: Optional[Mapping[str, str]] = None,
11301130
multi_options: Optional[List[str]] = None, **kwargs: Any) -> 'Repo':
11311131
"""Create a clone from the given URL
11321132

0 commit comments

Comments
 (0)