harbor run -t openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-4808harbor download openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-4808Title: Implement a Python module junkfile/checks.py to determine path existence and permissions (5 pure functions)
Body: I’m building a small Python module to check filesystem path existence and permissions, with five pure functions in junkfile/checks.py. The functions should rely only on the standard library and be deterministic across platforms as much as possible.
What to implement
Exact behavior requirements
Implementation details and edge cases
Notes for alignment with tests
Example skeleton (to illustrate usage)
# junkfile/checks.py
from __future__ import annotations
import os
def check_exists(path: str) -> bool:
"""Return True if the given path exists in the filesystem."""
return os.path.exists(path)
def check_is_readable(path: str) -> bool:
"""Return True if path exists and is readable by the current user."""
return os.path.exists(path) and os.access(path, os.R_OK)
def check_is_writable(path: str) -> bool:
"""Return True if path exists and is writable by the current user."""
return os.path.exists(path) and os.access(path, os.W_OK)
def check_is_executable(path: str) -> bool:
"""Return True if path exists and is executable by the current user."""
return os.path.exists(path) and os.access(path, os.X_OK)
def check_permission(path: str) -> bool:
"""Return True if path exists and has read, write, and execute permissions."""
required = os.R_OK | os.W_OK | os.X_OK
return os.path.exists(path) and (os.access(path, required))
Notes