Skip to content

Commit

Permalink
Drop wrong variable annotations in BlobFilter.__call__
Browse files Browse the repository at this point in the history
This fixes two mypy errors by removing the annotations of the
filter_parts and blob_parts local variables as lists. They only
need to be sequences (more precisely, they only need to be sized
and iterable, they don't even need to support subscripting in the
way __call__ uses them), and mypy is able to infer their type.
  • Loading branch information
EliahKagan committed Mar 8, 2024
1 parent 4dfd480 commit 4913088
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git/index/typ.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def __call__(self, stage_blob: Tuple[StageType, Blob]) -> bool:
path: Path = pathlike if isinstance(pathlike, Path) else Path(pathlike)
# TODO: Change to use `PosixPath.is_relative_to` once Python 3.8 is no
# longer supported.
filter_parts: List[str] = path.parts
blob_parts: List[str] = blob_path.parts
filter_parts = path.parts
blob_parts = blob_path.parts
if len(filter_parts) > len(blob_parts):
continue
if all(i == j for i, j in zip(filter_parts, blob_parts)):
Expand Down

0 comments on commit 4913088

Please sign in to comment.