from pathlib import Path from watchfiles import Change base = Path(__file__).parent.parent.absolute() def filter(change: Change, path: str) -> bool: if "__pycache__" in path: return False if Path(path).absolute().is_relative_to((base / "data").absolute()): return False if Path(path).absolute().is_relative_to((base / ".git").absolute()): return False if ( Path(path) .absolute() .is_relative_to((base / "assets" / "oracle" / "image").absolute()) ): # 还要解决坏枪的这个问题 return False if Path(path).absolute().is_relative_to((base / "htmlcov").absolute()): return False if Path(path).absolute().is_relative_to((base / "test").absolute()): return False if Path(path).absolute().is_relative_to((base / ".pytest_cache").absolute()): return False if Path(path).absolute().is_relative_to((base / ".ruff_cache").absolute()): return False if path.endswith(".coverage"): return False print(path) return True