MCPcopy Index your code
hub / github.com/MinishLab/semble / _write_metadata

Function _write_metadata

tests/test_cache.py:130–154  ·  view source on GitHub ↗
(
    path: Path,
    model_path: str,
    content_type: list[str],
    write_time: float,
    file_paths: list[str] | None = None,
    chunk_size: int | None = None,
)

Source from the content-addressed store, hash-verified

128
129
130def _write_metadata(
131 path: Path,
132 model_path: str,
133 content_type: list[str],
134 write_time: float,
135 file_paths: list[str] | None = None,
136 chunk_size: int | None = None,
137) -> None:
138 from semble.chunking.chunking import _DESIRED_CHUNK_LENGTH_CHARS
139
140 path.mkdir(parents=True, exist_ok=True)
141 (path / "chunks.json").write_text("[]")
142 (path / "bm25_index").write_text("")
143 (path / "semantic_index").write_text("")
144 (path / "metadata.json").write_text(
145 json.dumps(
146 {
147 "model_path": model_path,
148 "content_type": content_type,
149 "time": write_time,
150 "file_paths": file_paths if file_paths is not None else [],
151 "chunk_size": chunk_size if chunk_size is not None else _DESIRED_CHUNK_LENGTH_CHARS,
152 }
153 )
154 )
155
156
157def test_get_validated_cache_invalid_index(tmp_path: Path) -> None:

Calls

no outgoing calls

Tested by

no test coverage detected