Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: support version-aware filesystems #133

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/dvc_objects/fs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from fsspec.spec import AbstractFileSystem
from typing_extensions import Literal

from .path import Path


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -88,7 +90,7 @@ def root_marker(self) -> str:
return self.fs.root_marker

@cached_property
def path(self):
def path(self) -> "Path":
from .path import Path

def _getcwd():
Expand All @@ -107,6 +109,10 @@ def unstrip_protocol(self, path: str) -> str:
def fs(self) -> "AbstractFileSystem": # pylint: disable=method-hidden
raise NotImplementedError

@cached_property
def version_aware(self) -> bool:
return getattr(self.fs, "version_aware", False)

Comment on lines +112 to +115
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since our goal is moving towards fsspec, we need to either add it to the spec (probably not worth it) or just do the getattr manually. If we only have a handful of places - might want to go with the latter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record: discussed that this indeed makes sense to have for now.

@staticmethod
def _get_kwargs_from_urls(urlpath: str) -> "Dict[str, Any]":
from fsspec.utils import infer_storage_options
Expand Down