MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _create_carefully

Function _create_carefully

tools/python-3.11.9-amd64/Lib/mailbox.py:2113–2119  ·  view source on GitHub ↗

Create a file if it doesn't exist and open for reading and writing.

(path)

Source from the content-addressed store, hash-verified

2111 os.remove(f.name + '.lock')
2112
2113def _create_carefully(path):
2114 """Create a file if it doesn't exist and open for reading and writing."""
2115 fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0o666)
2116 try:
2117 return open(path, 'rb+')
2118 finally:
2119 os.close(fd)
2120
2121def _create_temporary(path):
2122 """Create a temp file based on path and open for reading and writing."""

Callers 3

_create_tmpMethod · 0.85
addMethod · 0.85
_create_temporaryFunction · 0.85

Calls 3

openFunction · 0.70
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected