try to delete path, but never fail
(path)
| 248 | |
| 249 | |
| 250 | def rm_rf(path): |
| 251 | """ |
| 252 | try to delete path, but never fail |
| 253 | """ |
| 254 | try: |
| 255 | if islink(path) or isfile(path): |
| 256 | # Note that we have to check if the destination is a link because |
| 257 | # exists('/path/to/dead-link') will return False, although |
| 258 | # islink('/path/to/dead-link') is True. |
| 259 | unlink(path) |
| 260 | elif isdir(path): |
| 261 | rmtree(path) |
| 262 | except OSError: |
| 263 | pass |
| 264 | |
| 265 | |
| 266 | def yield_lines(path): |
no outgoing calls
no test coverage detected