mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-25 23:09:49 +01:00
Since all of our filesystems are fsspec-compliant, there's no need for compat wrapper.
28 lines
682 B
Python
28 lines
682 B
Python
import threading
|
|
|
|
from funcy import cached_property, wrap_prop
|
|
|
|
from dvc.scheme import Schemes
|
|
|
|
# pylint:disable=abstract-method
|
|
from .base import ObjectFileSystem
|
|
|
|
|
|
class GSFileSystem(ObjectFileSystem):
|
|
scheme = Schemes.GS
|
|
REQUIRES = {"gcsfs": "gcsfs"}
|
|
PARAM_CHECKSUM = "etag"
|
|
|
|
def _prepare_credentials(self, **config):
|
|
login_info = {"consistency": None}
|
|
login_info["project"] = config.get("projectname")
|
|
login_info["token"] = config.get("credentialpath")
|
|
return login_info
|
|
|
|
@wrap_prop(threading.Lock())
|
|
@cached_property
|
|
def fs(self):
|
|
from gcsfs import GCSFileSystem
|
|
|
|
return GCSFileSystem(**self.fs_args)
|