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

Function add_catch_all_gitignore

mypy/build.py:1883–1894  ·  view source on GitHub ↗

Add catch-all .gitignore to an existing directory. No-op if the .gitignore already exists.

(target_dir: str)

Source from the content-addressed store, hash-verified

1881
1882
1883def add_catch_all_gitignore(target_dir: str) -> None:
1884 """Add catch-all .gitignore to an existing directory.
1885
1886 No-op if the .gitignore already exists.
1887 """
1888 gitignore = os_path_join(target_dir, ".gitignore")
1889 try:
1890 with open(gitignore, "x") as f:
1891 print("# Automatically created by mypy", file=f)
1892 print("*", file=f)
1893 except FileExistsError:
1894 pass
1895
1896
1897def exclude_from_backups(target_dir: str) -> None:

Callers 1

build_innerFunction · 0.85

Calls 2

os_path_joinFunction · 0.90
printFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…