MCPcopy Create free account
hub / github.com/FastLED/FastLED / max_file_mtime_flat

Function max_file_mtime_flat

ci/early_exit_cache.py:91–118  ·  view source on GitHub ↗

Return max mtime of source files in root directory only (no recursion). Used to check shared test headers in tests/ root without scanning all subdirs. Much faster than max_file_mtime() for large directory trees. Args: root: Directory to scan (non-recursive). exts: Froze

(root: Path, exts: frozenset = CPP_EXTS)

Source from the content-addressed store, hash-verified

89
90
91def max_file_mtime_flat(root: Path, exts: frozenset = CPP_EXTS) -> float:
92 """Return max mtime of source files in root directory only (no recursion).
93
94 Used to check shared test headers in tests/ root without scanning all subdirs.
95 Much faster than max_file_mtime() for large directory trees.
96
97 Args:
98 root: Directory to scan (non-recursive).
99 exts: Frozenset of file extensions to match (default: C++ extensions).
100
101 Returns:
102 Maximum file mtime (float), or 0.0 if no files match.
103 """
104 max_mtime = 0.0
105 try:
106 with os.scandir(str(root)) as it:
107 for entry in it:
108 try:
109 if entry.is_file(follow_symlinks=False):
110 _, ext = os.path.splitext(entry.name)
111 if ext.lower() in exts:
112 mtime = entry.stat(follow_symlinks=False).st_mtime
113 max_mtime = max(max_mtime, mtime)
114 except OSError:
115 pass
116 except OSError:
117 pass
118 return max_mtime
119
120
121def load_test_names(build_dir: Path) -> list:

Callers 1

ninja_skipFunction · 0.85

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected