Skip to content

Commit

Permalink
Document why __fspath__() isn't supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
asnare committed Jul 10, 2024
1 parent 3c970d9 commit 1f53446
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/databricks/labs/blueprint/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@ def __reduce__(self) -> NoReturn:

def __fspath__(self):
# Cannot support this: Workspace objects aren't accessible via the filesystem.
#
# This method is part of the os.PathLike protocol. Functions which accept a PathLike argument use os.fsname()
# to convert (via this method) the object into a file system path that can be used with the low-level os.*
# methods.
#
# Relevant online documentation:
# - PEP 519 (https://peps.python.org/pep-0519/)
# - os.fspath (https://docs.python.org/3/library/os.html#os.fspath)
# TODO: Allow this to work when within an appropriate Databricks Runtime that mounts Workspace paths via FUSE.
msg = f"Workspace paths are not path-like: {self}"
raise NotImplementedError(msg)

Expand Down

0 comments on commit 1f53446

Please sign in to comment.