MCPcopy Index your code
hub / github.com/python/mypy / matches_gitignore

Function matches_gitignore

mypy/modulefinder.py:710–723  ·  view source on GitHub ↗
(subpath: str, fscache: FileSystemCache, verbose: bool)

Source from the content-addressed store, hash-verified

708
709
710def matches_gitignore(subpath: str, fscache: FileSystemCache, verbose: bool) -> bool:
711 dir, _ = os.path.split(subpath)
712 for gi_path, gi_spec in find_gitignores(dir):
713 relative_path = os.path.relpath(subpath, gi_path)
714 if fscache.isdir(relative_path):
715 relative_path = relative_path + "/"
716 if gi_spec.match_file(relative_path):
717 if verbose:
718 print(
719 f"TRACE: Excluding {relative_path} (matches .gitignore) in {gi_path}",
720 file=sys.stderr,
721 )
722 return True
723 return False
724
725
726@functools.lru_cache

Callers 2

find_sources_in_dirMethod · 0.90

Calls 4

find_gitignoresFunction · 0.85
printFunction · 0.85
splitMethod · 0.80
isdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…