Create a file if it doesn't exist and open for reading and writing.
(path)
| 2111 | os.remove(f.name + '.lock') |
| 2112 | |
| 2113 | def _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 | |
| 2121 | def _create_temporary(path): |
| 2122 | """Create a temp file based on path and open for reading and writing.""" |
no test coverage detected