Less open file permissions (#21922)
* Less open file permissions
* add test back
* remove params test for permissions
* remove umask
* bump cereal
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: dddab597bc
commatwo_master
parent
88878cc2cd
commit
6f92abc815
14 changed files with 15 additions and 107 deletions
@ -1 +1 @@ |
||||
Subproject commit 9327e4fbec1a1b4e0658a18db4a6f332c1f53688 |
||||
Subproject commit e137c5731eb0264497c1f3b151fa030af5bb940a |
@ -1,26 +0,0 @@ |
||||
import os |
||||
from atomicwrites import AtomicWriter |
||||
|
||||
|
||||
def atomic_write_in_dir(path, **kwargs): |
||||
"""Creates an atomic writer using a temporary file in the same directory |
||||
as the destination file. |
||||
""" |
||||
writer = AtomicWriter(path, **kwargs) |
||||
return writer._open(_get_fileobject_func(writer, os.path.dirname(path))) |
||||
|
||||
|
||||
def _get_fileobject_func(writer, temp_dir): |
||||
def _get_fileobject(): |
||||
file_obj = writer.get_fileobject(dir=temp_dir) |
||||
os.chmod(file_obj.name, 0o644) |
||||
return file_obj |
||||
return _get_fileobject |
||||
|
||||
|
||||
def mkdirs_exists_ok(path): |
||||
try: |
||||
os.makedirs(path) |
||||
except OSError: |
||||
if not os.path.isdir(path): |
||||
raise |
Loading…
Reference in new issue