MCPcopy Index your code
hub / github.com/python/mypy / perform_file_operations

Function perform_file_operations

mypy/test/helpers.py:450–464  ·  view source on GitHub ↗
(operations: list[UpdateFile | DeleteFile])

Source from the content-addressed store, hash-verified

448
449
450def perform_file_operations(operations: list[UpdateFile | DeleteFile]) -> None:
451 for op in operations:
452 if isinstance(op, UpdateFile):
453 # Modify/create file
454 write_and_fudge_mtime(op.content, op.target_path)
455 else:
456 # Delete file/directory
457 if os.path.isdir(op.path):
458 # Sanity check to avoid unexpected deletions
459 assert op.path.startswith("tmp")
460 shutil.rmtree(op.path)
461 else:
462 # Use retries to work around potential flakiness on Windows (AppVeyor).
463 path = op.path
464 retry_on_error(lambda: os.remove(path))
465
466
467def check_test_output_files(

Callers 4

perform_stepMethod · 0.90
run_case_onceMethod · 0.90
test_pep561Function · 0.90
run_case_innerMethod · 0.90

Calls 6

isinstanceFunction · 0.85
write_and_fudge_mtimeFunction · 0.85
retry_on_errorFunction · 0.85
isdirMethod · 0.45
startswithMethod · 0.45
removeMethod · 0.45

Tested by 4

perform_stepMethod · 0.72
run_case_onceMethod · 0.72
test_pep561Function · 0.72
run_case_innerMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…