Add catch-all .gitignore to an existing directory. No-op if the .gitignore already exists.
(target_dir: str)
| 1881 | |
| 1882 | |
| 1883 | def 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 | |
| 1897 | def exclude_from_backups(target_dir: str) -> None: |
no test coverage detected
searching dependent graphs…