|
461 | 461 | "name": "stdout", |
462 | 462 | "output_type": "stream", |
463 | 463 | "text": [ |
464 | | - "Directory contents of /app/data/repos/fastcore/nbs:\n", |
465 | | - "/app/data/repos/fastcore/nbs/000_tour.ipynb\n", |
466 | | - "/app/data/repos/fastcore/nbs/00_test.ipynb\n", |
467 | | - "/app/data/repos/fastcore/nbs/01_basics.ipynb\n", |
468 | | - "/app/data/repos/fastcore/nbs/02_foundation.ipynb\n", |
469 | | - "/app/data/repos/fastcore/nbs/03_xtras.ipynb\n" |
| 464 | + "Directory contents of /path:\n", |
| 465 | + "/path/000_tour.ipynb\n", |
| 466 | + "/path/00_test.ipynb\n", |
| 467 | + "/path/01_basics.ipynb\n", |
| 468 | + "/path/02_foundation.ipynb\n", |
| 469 | + "/path/03_xtras.ipynb\n" |
470 | 470 | ] |
471 | 471 | } |
472 | 472 | ], |
473 | 473 | "source": [ |
474 | | - "print(view('.', (1,5)))" |
| 474 | + "print(view('.', (1,5)).replace(os.getcwd(), '/path'))" |
475 | 475 | ] |
476 | 476 | }, |
477 | 477 | { |
|
508 | 508 | "name": "stdout", |
509 | 509 | "output_type": "stream", |
510 | 510 | "text": [ |
511 | | - "Created file /app/data/repos/fastcore/nbs/test.txt.\n", |
| 511 | + "Created file /path/test.txt.\n", |
512 | 512 | "Contents:\n", |
513 | 513 | " 1 │ Hello, world!\n" |
514 | 514 | ] |
515 | 515 | } |
516 | 516 | ], |
517 | 517 | "source": [ |
518 | | - "print(create('test.txt', 'Hello, world!'))\n", |
| 518 | + "print(create('test.txt', 'Hello, world!').replace(os.getcwd(), '/path'))\n", |
519 | 519 | "f = Path('test.txt')\n", |
520 | 520 | "test_eq(f.exists(), True)\n", |
521 | 521 | "print('Contents:\\n', view(f, nums=True))" |
|
705 | 705 | { |
706 | 706 | "data": { |
707 | 707 | "text/plain": [ |
708 | | - "'Error replacing lines: File not found: /app/data/repos/fastcore/nbs/missing.txt'" |
| 708 | + "'Error replacing lines: File not found: /path/missing.txt'" |
709 | 709 | ] |
710 | 710 | }, |
711 | 711 | "execution_count": null, |
|
714 | 714 | } |
715 | 715 | ], |
716 | 716 | "source": [ |
717 | | - "replace_lines('missing.txt', 1, 2, 'Replaced first two lines')" |
| 717 | + "replace_lines('missing.txt', 1, 2, 'Replaced first two lines').replace(os.getcwd(), '/path')" |
718 | 718 | ] |
719 | 719 | }, |
720 | 720 | { |
|
867 | 867 | "Error: Destination within source range\n", |
868 | 868 | "Error: Invalid range 10-12\n", |
869 | 869 | "Error: Invalid destination 99\n", |
870 | | - "Error: File not found: /app/data/repos/fastcore/nbs/mising.txt\n" |
| 870 | + "Error: File not found: /path/mising.txt\n" |
871 | 871 | ] |
872 | 872 | } |
873 | 873 | ], |
874 | 874 | "source": [ |
875 | 875 | "print(move_lines('move_test.txt', 2, 3, 3)) # dest within source range\n", |
876 | 876 | "print(move_lines('move_test.txt', 10, 12, 1)) # invalid range\n", |
877 | 877 | "print(move_lines('move_test.txt', 1, 2, 99)) # invalid destination\n", |
878 | | - "print(move_lines('mising.txt', 1, 2, 99)) # missing file" |
| 878 | + "print(move_lines('mising.txt', 1, 2, 99).replace(os.getcwd(), '/path')) # missing file" |
879 | 879 | ] |
880 | 880 | }, |
881 | 881 | { |
|
0 commit comments