MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / inventory

Method inventory

scripts/test-impact/coverage_live_v2.py:291–337  ·  view source on GitHub ↗

Bound scans while children run; never follow raw tree symlinks.

(self)

Source from the content-addressed store, hash-verified

289 dst_dir_fd=self.directory, follow_symlinks=False)
290
291 def inventory(self):
292 """Bound scans while children run; never follow raw tree symlinks."""
293 self.check()
294 root = os.path.join(self.path, "raw")
295 pending = [root]
296 files, total, count = [], 0, 1 # listing counts as one profile slot
297 try:
298 info = os.stat("listing.profraw", dir_fd=self.directory, follow_symlinks=False)
299 except FileNotFoundError:
300 info = None
301 if info is not None:
302 if not stat.S_ISREG(info.st_mode):
303 _error("input", "listing profile is not a regular file")
304 if info.st_size > self.args.max_profile_bytes:
305 _error("resource_limit", "listing profile byte limit exceeded")
306 total = info.st_size
307 if total > self.args.max_total_profile_bytes:
308 _error("resource_limit", "aggregate raw byte limit exceeded")
309 while pending:
310 directory = pending.pop()
311 fd = _directory(directory)
312 try:
313 with os.scandir(fd) as entries:
314 for entry in entries:
315 count += 1
316 if count > self.args.max_profile_files:
317 _error("resource_limit", "raw entry count limit exceeded")
318 info = entry.stat(follow_symlinks=False)
319 path = os.path.join(directory, entry.name)
320 if stat.S_ISDIR(info.st_mode) and directory == root:
321 if entry.name not in self.allowed_suites:
322 self.uncertainty.append({"path": path, "reason": "unknown_suite_destination"})
323 _error("input", "raw suite directory is outside requested scope")
324 pending.append(path)
325 elif stat.S_ISREG(info.st_mode):
326 if info.st_size > self.args.max_profile_bytes:
327 _error("resource_limit", "raw file byte limit exceeded")
328 total += info.st_size
329 if total > self.args.max_total_profile_bytes:
330 _error("resource_limit", "aggregate raw byte limit exceeded")
331 files.append(path)
332 else:
333 self.uncertainty.append({"path": path, "reason": "unsupported_raw_entry"})
334 _error("input", "unsupported raw tree entry")
335 finally:
336 os.close(fd)
337 return sorted(files)
338
339
340def _group_exists(pid):

Callers 3

collectFunction · 0.95
_runFunction · 0.45
_observationsFunction · 0.45

Calls 4

checkMethod · 0.95
_errorFunction · 0.85
_directoryFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected