Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mypy/modulefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from enum import Enum, unique
from typing import Final, TypeAlias as _TypeAlias

from pathspec import PathSpec
from pathspec import GitIgnoreSpec
from pathspec.patterns.gitignore import GitIgnorePatternError

from mypy import pyinfo
Expand Down Expand Up @@ -724,7 +724,7 @@ def matches_gitignore(subpath: str, fscache: FileSystemCache, verbose: bool) ->


@functools.lru_cache
def find_gitignores(dir: str) -> list[tuple[str, PathSpec]]:
def find_gitignores(dir: str) -> list[tuple[str, GitIgnoreSpec]]:
parent_dir = os.path.dirname(dir)
if parent_dir == dir or os.path.exists(os.path.join(dir, ".git")):
parent_gitignores = []
Expand All @@ -733,7 +733,7 @@ def find_gitignores(dir: str) -> list[tuple[str, PathSpec]]:
with open(git_info_exclude) as f:
exclude_lines = f.readlines()
try:
parent_gitignores = [(dir, PathSpec.from_lines("gitignore", exclude_lines))]
parent_gitignores = [(dir, GitIgnoreSpec.from_lines("gitignore", exclude_lines))]
except GitIgnorePatternError:
print(f"error: could not parse {git_info_exclude}", file=sys.stderr)
else:
Expand All @@ -744,7 +744,7 @@ def find_gitignores(dir: str) -> list[tuple[str, PathSpec]]:
with open(gitignore) as f:
lines = f.readlines()
try:
return parent_gitignores + [(dir, PathSpec.from_lines("gitignore", lines))]
return parent_gitignores + [(dir, GitIgnoreSpec.from_lines("gitignore", lines))]
except GitIgnorePatternError:
print(f"error: could not parse {gitignore}", file=sys.stderr)
return parent_gitignores
Expand Down
Loading