mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 07:18:31 +01:00
27 lines
812 B
Python
27 lines
812 B
Python
import posixpath
|
|
|
|
try:
|
|
from urlparse import urlparse
|
|
except ImportError:
|
|
from urllib.parse import urlparse
|
|
|
|
from dvc.dependency.s3 import DependencyS3
|
|
from dvc.remote.gs import RemoteGS
|
|
from dvc.config import Config
|
|
|
|
|
|
class DependencyGS(DependencyS3):
|
|
REGEX = RemoteGS.REGEX
|
|
|
|
def __init__(self, stage, path, info=None, remote=None):
|
|
super(DependencyGS, self).__init__(stage, path)
|
|
self.info = info
|
|
self.remote = remote if remote else RemoteGS(stage.project, {})
|
|
bucket = remote.bucket if remote else urlparse(path).netloc
|
|
key = urlparse(path).path.lstrip('/')
|
|
if remote:
|
|
key = posixpath.join(remote.prefix, key)
|
|
self.path_info = {'scheme': 'gs',
|
|
'bucket': bucket,
|
|
'key': key}
|