typing fixes - DiffIndex generic type and IndexFile items by Andrej730 · Pull Request #1925 · gitpython-developers/GitPython (original) (raw)
Example issue with DiffIndex:
repo = git.Repo(path_dir) diff = repo.index.diff(None) modified_files = [d for d in repo.index.diff(None)] reveal_type(modified_files) # list[Unknown] instead of list[Diff]
Example issue with IndexFile:
path: os.PathLike = ... repo = git.Repo(path_dir)
Argument of type "PathLike[Unknown]"
cannot be assigned to parameter "items" of type "Sequence[git.types.PathLike | Blob | BaseIndexEntry | Submodule]" in function "add"
"PathLike[Unknown]" is incompatible with "Sequence[git.types.PathLike | Blob | BaseIndexEntry | Submodule]"
repo.index.add(path)