mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
fix use of uneeded perms arg
This commit is contained in:
parent
c2d1a57581
commit
aa53fe653c
1 changed files with 4 additions and 4 deletions
|
@ -78,7 +78,7 @@ def run(cmd, *args, input=None, capture_output=True, timeout=None, check=False,
|
||||||
|
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
def atomic_write(path: Union[Path, str], contents: Union[dict, str, bytes], overwrite: bool=True, permissions: str=OUTPUT_PERMISSIONS) -> None:
|
def atomic_write(path: Union[Path, str], contents: Union[dict, str, bytes], overwrite: bool=True) -> None:
|
||||||
"""Safe atomic write to filesystem by writing to temp file + atomic rename"""
|
"""Safe atomic write to filesystem by writing to temp file + atomic rename"""
|
||||||
|
|
||||||
mode = 'wb+' if isinstance(contents, bytes) else 'w'
|
mode = 'wb+' if isinstance(contents, bytes) else 'w'
|
||||||
|
@ -105,8 +105,8 @@ def atomic_write(path: Union[Path, str], contents: Union[dict, str, bytes], over
|
||||||
elif isinstance(contents, (bytes, str)):
|
elif isinstance(contents, (bytes, str)):
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
|
||||||
# set permissions
|
# set file permissions
|
||||||
os.chmod(path, int(permissions, base=8))
|
os.chmod(path, int(OUTPUT_PERMISSIONS, base=8))
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
def chmod_file(path: str, cwd: str='.') -> None:
|
def chmod_file(path: str, cwd: str='.') -> None:
|
||||||
|
@ -118,7 +118,7 @@ def chmod_file(path: str, cwd: str='.') -> None:
|
||||||
|
|
||||||
if not root.is_dir():
|
if not root.is_dir():
|
||||||
# path is just a plain file
|
# path is just a plain file
|
||||||
os.chmod(root, int(permissions, base=8))
|
os.chmod(root, int(OUTPUT_PERMISSIONS, base=8))
|
||||||
else:
|
else:
|
||||||
for subpath in Path(path).glob('**/*'):
|
for subpath in Path(path).glob('**/*'):
|
||||||
if subpath.is_dir():
|
if subpath.is_dir():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue