mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: fix import conflicts
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+1
-3
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.remote import Remote
|
||||
|
||||
|
||||
@@ -7,9 +8,6 @@ class Cache(object):
|
||||
CACHE_DIR = 'cache'
|
||||
|
||||
def __init__(self, project):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
|
||||
config = project.config._config[Config.SECTION_CACHE]
|
||||
|
||||
local = config.get(Config.SECTION_CACHE_LOCAL, None)
|
||||
|
||||
+2
-5
@@ -6,7 +6,8 @@ import boto3
|
||||
|
||||
from dvc.logger import Logger
|
||||
from dvc.progress import progress
|
||||
from dvc.cloud.base import DataCloudBase
|
||||
from dvc.cloud.base import DataCloudBase, DataCloudError
|
||||
from dvc.config import Config
|
||||
|
||||
|
||||
def sizeof_fmt(num, suffix='B'):
|
||||
@@ -56,13 +57,9 @@ class DataCloudAWS(DataCloudBase):
|
||||
|
||||
@property
|
||||
def profile(self):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
return self._cloud_settings.cloud_config.get(Config.SECTION_AWS_PROFILE, None)
|
||||
|
||||
def connect(self):
|
||||
#FIXME
|
||||
from dvc.cloud.base import DataCloudError
|
||||
session = boto3.Session(profile_name=self.profile)
|
||||
self.s3 = session.resource('s3')
|
||||
bucket = self.s3.Bucket(self.storage_bucket)
|
||||
|
||||
+2
-8
@@ -2,8 +2,10 @@ import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.logger import Logger
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.remote.local import RemoteLOCAL
|
||||
|
||||
|
||||
STATUS_UNKNOWN = 0
|
||||
@@ -45,8 +47,6 @@ class DataCloudBase(object):
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
config = self._cloud_settings.cloud_config
|
||||
return config.get(Config.SECTION_REMOTE_URL, None)
|
||||
|
||||
@@ -72,9 +72,6 @@ class DataCloudBase(object):
|
||||
|
||||
Precedence: Storage, then cloud specific
|
||||
"""
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
|
||||
if self._cloud_settings.global_storage_path:
|
||||
return self._cloud_settings.global_storage_path
|
||||
|
||||
@@ -132,9 +129,6 @@ class DataCloudBase(object):
|
||||
path, local = arg
|
||||
ret = [path]
|
||||
|
||||
#FIXME
|
||||
from dvc.remote.local import RemoteLOCAL
|
||||
|
||||
if not RemoteLOCAL.is_dir_cache(path):
|
||||
return ret
|
||||
|
||||
|
||||
@@ -7,17 +7,16 @@ from dvc.dependency.s3 import DependencyS3
|
||||
from dvc.dependency.gs import DependencyGS
|
||||
from dvc.dependency.local import DependencyLOCAL
|
||||
|
||||
#FIXME PARAM_MD5, PARAM_ETAG
|
||||
#from dvc.remote.local import RemoteLOCAL
|
||||
#from dvc.remote.s3 import RemoteS3
|
||||
from dvc.remote.local import RemoteLOCAL
|
||||
from dvc.remote.s3 import RemoteS3
|
||||
|
||||
|
||||
DEPS = [DependencyS3, DependencyGS, DependencyLOCAL]
|
||||
|
||||
SCHEMA = {
|
||||
DependencyBase.PARAM_PATH: str,
|
||||
schema.Optional('md5'): schema.Or(str, None),
|
||||
schema.Optional('etag'): schema.Or(str, None),
|
||||
schema.Optional(RemoteLOCAL.PARAM_MD5): schema.Or(str, None),
|
||||
schema.Optional(RemoteS3.PARAM_ETAG): schema.Or(str, None),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ from dvc.dependency.base import *
|
||||
from dvc.logger import Logger
|
||||
from dvc.utils import remove
|
||||
from dvc.cloud.local import DataCloudLOCAL
|
||||
from dvc.config import Config
|
||||
from dvc.remote.local import RemoteLOCAL
|
||||
|
||||
|
||||
class DependencyLOCAL(DependencyBase):
|
||||
@@ -16,10 +18,6 @@ class DependencyLOCAL(DependencyBase):
|
||||
IsNotFileOrDirError = DependencyIsNotFileOrDirError
|
||||
|
||||
def __init__(self, stage, path, info=None):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
from dvc.remote.local import RemoteLOCAL
|
||||
|
||||
self.stage = stage
|
||||
self.project = stage.project
|
||||
if not os.path.isabs(path):
|
||||
|
||||
+3
-1
@@ -22,7 +22,6 @@ class OutputLOCAL(DependencyLOCAL):
|
||||
|
||||
@property
|
||||
def md5(self):
|
||||
#FIXME
|
||||
return self.info.get(self.project.cache.local.PARAM_MD5, None)
|
||||
|
||||
@property
|
||||
@@ -67,6 +66,9 @@ class OutputLOCAL(DependencyLOCAL):
|
||||
self.project.logger.debug(msg.format(self.rel_path))
|
||||
return
|
||||
|
||||
if self.project.scm.is_tracked(self.path):
|
||||
raise OutputAlreadyTrackedError(self.rel_path)
|
||||
|
||||
self.info = self.project.cache.local.save(self.path_info)
|
||||
|
||||
def remove(self):
|
||||
|
||||
+2
-2
@@ -1,5 +1,7 @@
|
||||
import re
|
||||
|
||||
from dvc.config import Config
|
||||
|
||||
|
||||
class RemoteBase(object):
|
||||
REGEX = None
|
||||
@@ -9,8 +11,6 @@ class RemoteBase(object):
|
||||
|
||||
@classmethod
|
||||
def supported(cls, config):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
url = config[Config.SECTION_REMOTE_URL]
|
||||
return cls.match(url) != None
|
||||
|
||||
|
||||
+1
-3
@@ -7,6 +7,7 @@ except ImportError:
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from dvc.remote.base import RemoteBase
|
||||
from dvc.config import Config
|
||||
|
||||
|
||||
class RemoteGS(RemoteBase):
|
||||
@@ -14,9 +15,6 @@ class RemoteGS(RemoteBase):
|
||||
PARAM_ETAG = 'etag'
|
||||
|
||||
def __init__(self, project, config):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
|
||||
self.project = project
|
||||
self.url = config.get[Config.SECTION_REMOTE_URL]
|
||||
self.projectname = config.get(Config.SECTION_GCP_PROJECTNAME, None)
|
||||
|
||||
+1
-9
@@ -8,6 +8,7 @@ from dvc.remote.base import RemoteBase
|
||||
from dvc.state import State
|
||||
from dvc.logger import Logger
|
||||
from dvc.utils import remove, move
|
||||
from dvc.config import Config
|
||||
|
||||
|
||||
class RemoteLOCAL(RemoteBase):
|
||||
@@ -23,9 +24,6 @@ class RemoteLOCAL(RemoteBase):
|
||||
}
|
||||
|
||||
def __init__(self, project, config):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
|
||||
self.project = project
|
||||
self.link_state = project.link_state
|
||||
self.cache_dir = config[Config.SECTION_REMOTE_URL]
|
||||
@@ -212,17 +210,11 @@ class RemoteLOCAL(RemoteBase):
|
||||
return {self.PARAM_MD5: md5}
|
||||
|
||||
def save(self, path_info):
|
||||
#FIXME
|
||||
from dvc.output.base import OutputAlreadyTrackedError
|
||||
|
||||
if path_info['scheme'] != 'local':
|
||||
raise NotImplementedError
|
||||
|
||||
path = path_info['path']
|
||||
|
||||
if self.project.scm.is_tracked(path):
|
||||
raise OutputAlreadyTrackedError(os.path.relpath(path))
|
||||
|
||||
if os.path.isdir(path):
|
||||
return self._save_dir(path_info)
|
||||
else:
|
||||
|
||||
+1
-4
@@ -6,6 +6,7 @@ try:
|
||||
except ImportError:
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.remote.base import RemoteBase
|
||||
|
||||
|
||||
@@ -14,10 +15,6 @@ class RemoteS3(RemoteBase):
|
||||
PARAM_ETAG = 'etag'
|
||||
|
||||
def __init__(self, project, config):
|
||||
#FIXME
|
||||
from dvc.config import Config
|
||||
|
||||
|
||||
self.project = project
|
||||
self.url = config[Config.SECTION_REMOTE_URL]
|
||||
self.region = config.get(Config.SECTION_AWS_REGION, None)
|
||||
|
||||
Reference in New Issue
Block a user