MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / create_similar_file

Function create_similar_file

tests/test_diff.py:186–217  ·  view source on GitHub ↗
(pth: Path, fixtures)

Source from the content-addressed store, hash-verified

184
185
186def create_similar_file(pth: Path, fixtures):
187 struct = []
188
189 filename = "misc.py"
190 file_pth = Path(fixtures.path(filename))
191 assert os.path.exists(file_pth)
192 with file_pth.open("r") as fd:
193 file_content = fd.readlines()
194 del file_pth
195
196 dest1 = pth / "similar_file/file" / filename
197 dest1.parent.mkdir(parents=True)
198 with dest1.open("w") as fd:
199 fd.writelines(file_content)
200
201 dest2 = pth / "similar_file/directory1/subdirectory" / filename
202 dest2.parent.mkdir(parents=True)
203 with dest2.open("w") as fd:
204 fd.writelines(file_content[:5])
205
206 struct.append((
207 ScanLocation(dest1.parent),
208 ScanLocation(dest2.parent),
209 {
210 "operation": "M",
211 "a_ref": filename,
212 "b_ref": filename,
213 "a_mime": "text/x-python",
214 "b_mime": "text/x-python"
215 }
216 ))
217 return struct
218
219
220def get_directory_content(pth): # TODO: use ScanLocation.list_recursive instead

Callers

nothing calls this directly

Calls 3

ScanLocationClass · 0.90
pathMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected