MCPcopy
hub / github.com/pex-tool/pex / safe_delete

Function safe_delete

pex/common.py:600–610  ·  view source on GitHub ↗

Delete a file safely. If it's not present, no-op.

(filename)

Source from the content-addressed store, hash-verified

598
599
600def 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
613def safe_rmtree(directory):

Callers 10

mainFunction · 0.90
named_temporary_fileFunction · 0.90
buildMethod · 0.90
runMethod · 0.90
syncMethod · 0.90
write_pthFunction · 0.90
assert_scieFunction · 0.90
safe_removeMethod · 0.90
mktempMethod · 0.90

Calls

no outgoing calls

Tested by 3

write_pthFunction · 0.72
assert_scieFunction · 0.72