()
| 428 | |
| 429 | |
| 430 | def main() -> None: |
| 431 | modified_files = [f"./{f}" for f in sys.argv[1:]] |
| 432 | errored = False |
| 433 | for fname in async_files + gridfs_files + test_files: |
| 434 | # If the async file was modified, we don't need to check if the sync file was also modified. |
| 435 | if str(fname) in modified_files: |
| 436 | continue |
| 437 | sync_name = str(fname).replace("asynchronous", "synchronous") |
| 438 | test_sync_name = str(fname).replace("/asynchronous", "") |
| 439 | if ( |
| 440 | sync_name in modified_files |
| 441 | or test_sync_name in modified_files |
| 442 | and "OVERRIDE_SYNCHRO_CHECK" not in os.environ |
| 443 | ): |
| 444 | print(f"Refusing to overwrite {test_sync_name}") |
| 445 | errored = True |
| 446 | if errored: |
| 447 | raise ValueError("Aborting synchro due to errors") |
| 448 | |
| 449 | unasync_directory(async_files, _pymongo_base, _pymongo_dest_base, replacements) |
| 450 | unasync_directory(gridfs_files, _gridfs_base, _gridfs_dest_base, replacements) |
| 451 | unasync_directory(test_files, _test_base, _test_dest_base, replacements) |
| 452 | |
| 453 | sync_files = [ |
| 454 | _pymongo_dest_base + f |
| 455 | for f in listdir(_pymongo_dest_base) |
| 456 | if (Path(_pymongo_dest_base) / f).is_file() |
| 457 | ] |
| 458 | |
| 459 | sync_gridfs_files = [ |
| 460 | _gridfs_dest_base + f |
| 461 | for f in listdir(_gridfs_dest_base) |
| 462 | if (Path(_gridfs_dest_base) / f).is_file() |
| 463 | ] |
| 464 | sync_test_files = [ |
| 465 | _test_dest_base + f for f in converted_tests if (Path(_test_dest_base) / f).is_file() |
| 466 | ] |
| 467 | |
| 468 | docstring_translate_files = sync_files + sync_gridfs_files + sync_test_files |
| 469 | |
| 470 | process_files( |
| 471 | sync_files + sync_gridfs_files + sync_test_files, docstring_translate_files, sync_test_files |
| 472 | ) |
| 473 | |
| 474 | |
| 475 | if __name__ == "__main__": |
no test coverage detected