Delete a file safely. If it's not present, no-op.
(filename)
| 598 | |
| 599 | |
| 600 | def safe_delete(filename): |
| 601 | # type: (Text) -> None |
| 602 | """Delete a file safely. |
| 603 | |
| 604 | If it's not present, no-op. |
| 605 | """ |
| 606 | try: |
| 607 | os.unlink(filename) |
| 608 | except OSError as e: |
| 609 | if e.errno != errno.ENOENT: |
| 610 | raise |
| 611 | |
| 612 | |
| 613 | def safe_rmtree(directory): |
no outgoing calls