MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / _build

Method _build

src/pyspector/ast_cache.py:377–396  ·  view source on GitHub ↗
(
        self,
        file_path: Path,
        content: str,
        file_hash: str,
        mtime: float,
        old_chunks: Dict[str, AstChunk],
    )

Source from the content-addressed store, hash-verified

375 return entry
376
377 def _build(
378 self,
379 file_path: Path,
380 content: str,
381 file_hash: str,
382 mtime: float,
383 old_chunks: Dict[str, AstChunk],
384 ) -> FileCacheEntry:
385 with warnings.catch_warnings():
386 warnings.filterwarnings("ignore", category=SyntaxWarning)
387 tree = ast.parse(content, filename=str(file_path)) # SyntaxError propagates
388
389 full_json, chunks = _build_ast_json_and_chunks(tree, content, old_chunks)
390 return FileCacheEntry(
391 file_path=str(file_path),
392 file_hash=file_hash,
393 mtime=mtime,
394 full_ast_json_z=zlib.compress(full_json.encode(), _ZLIB_LEVEL),
395 chunks=chunks,
396 )
397
398 # ── Disk I/O ─────────────────────────────────────────────────────────────
399

Callers 1

_get_entryMethod · 0.95

Calls 2

FileCacheEntryClass · 0.85

Tested by

no test coverage detected