Skip to content

Commit

Permalink
quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed May 14, 2024
1 parent 99273e3 commit d097527
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/1.0.0/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

def check_path(path):
out = f"""
if not pathlib.Path({path}).exists():
if not pathlib.Path("{path}").exists():
raise Exception(f"Path [{path}] does not exist")
"""
return textwrap.dedent(out)


def check_empty(path, force=False):
out = f"""
if any(pathlib.Path({path}).iterdir()):
if any(pathlib.Path("{path}").iterdir()):
if not {force}:
raise Exception(
f"Path [{path}] is not empty, skipping... Use [force=True] to override"
Expand All @@ -34,7 +34,7 @@ def chown(path, uid, gid, force=False):
out = f"""
{check_path(path)}
{check_empty(path, force)}
os.chown({path}, {int(uid)}, {int(gid)})
os.chown("{path}", {int(uid)}, {int(gid)})
"""
return textwrap.dedent(out)

Expand All @@ -48,6 +48,6 @@ def chmod(path, mode, force=False):
out = f"""
{check_path(path)}
{check_empty(path, force)}
os.chmod({path}, {int(mode, 8)})
os.chmod("{path}", {int(mode, 8)})
"""
return textwrap.dedent(out)

0 comments on commit d097527

Please sign in to comment.