Skip to content

Commit

Permalink
Merge pull request #548 from DagsHub/bug/hooks-bugs
Browse files Browse the repository at this point in the history
Bug: 2 install_hooks bugs
  • Loading branch information
kbolashev authored Nov 11, 2024
2 parents d97e56c + d17603c commit ac6290e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions dagshub/streaming/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,19 @@ class DagshubPath:
# TODO: this couples this class hard to the fs, need to decouple later
fs: "DagsHubFilesystem" # Actual type is DagsHubFilesystem, but imports are wonky
absolute_path: Optional[Path]
"""
Absolute path in the OS filesystem
"""
relative_path: Optional[Path]
"""
Path relative to the root of the repository the fs is hooked to.
"""
original_path: Optional[Path]
"""
Original path requested by the user almost as-is (except for transformation to Path)
Required to keep listdir working correctly, since its behavior changes based on how it's being called
(relative vs. absolute path)
"""

def __post_init__(self):
# Handle storage paths - translate s3:/bla-bla to .dagshub/storage/s3/bla-bla
Expand All @@ -35,9 +46,7 @@ def __post_init__(self):
for storage_schema in storage_schemas:
if str_path.startswith(f"{storage_schema}:/"):
str_path = str_path[len(storage_schema) + 2 :]
self.relative_path = (
Path(".dagshub/storage") / storage_schema / str_path
)
self.relative_path = Path(".dagshub/storage") / storage_schema / str_path
self.absolute_path = self.fs.project_root / self.relative_path

@cached_property
Expand Down
2 changes: 1 addition & 1 deletion dagshub/streaming/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def encode_results(res):
parsed_path = self._parse_path(str_path)
if parsed_path.is_in_repo:
if parsed_path.is_passthrough_path:
return self.listdir(parsed_path.original_path)
return self.__listdir(parsed_path.original_path)
else:
dircontents: Set[str] = set()
error = None
Expand Down

0 comments on commit ac6290e

Please sign in to comment.