Skip to content

Commit

Permalink
RFC: find and fix errors and some warning reported by pylint
Browse files Browse the repository at this point in the history
Fixes #219

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
  • Loading branch information
efiop committed Sep 17, 2017
1 parent f88bdc2 commit 17f0c0d
Show file tree
Hide file tree
Showing 12 changed files with 361 additions and 182 deletions.
6 changes: 6 additions & 0 deletions dvc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
"""
DVC
----
Make your data science projects reproducible and shareable.
"""
VERSION = '0.8.7'
__version__ = VERSION
6 changes: 0 additions & 6 deletions dvc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,6 @@ def parse_args(argv=None):
type=int,
default=cpu_count(),
help='Number of jobs to run simultaneously.')
import_parser.add_argument('-c',
'--continue',
dest='cont',
action='store_true',
default=False,
help='Resume downloading file from url')
import_parser.set_defaults(func=CmdImportFile)

# Lock
Expand Down
4 changes: 0 additions & 4 deletions dvc/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ def parsed_args(self):
def config(self):
return self._settings.config

@property
def dvc_home(self):
return self._settings.dvc_home

@property
def git(self):
return self._settings.git
Expand Down
2 changes: 1 addition & 1 deletion dvc/command/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def set(self):
self.configobj.write()
except Exception as exc:
Logger.error('Failed to set \'{}\' to \'{}\': {}'.format(self.parsed_args.name,
value,
self.parsed_args.value,
exc))
return 1

Expand Down
1 change: 1 addition & 0 deletions dvc/command/import_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from urlparse import urlparse
except ImportError:
# Python 3
# pylint: disable=no-name-in-module, import-error
from urllib.parse import urlparse

from dvc.command.base import CmdBase, DvcLock
Expand Down
2 changes: 1 addition & 1 deletion dvc/command/repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, msg):

class CmdRepro(CmdRun):
def __init__(self, settings):
super(CmdRun, self).__init__(settings)
super(CmdRepro, self).__init__(settings)

self._code = []
pass
Expand Down
24 changes: 18 additions & 6 deletions dvc/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
DVC config objects.
"""
import os
import configparser

Expand All @@ -6,16 +9,18 @@


class ConfigError(DvcException):
""" DVC config exception """
def __init__(self, msg):
DvcException.__init__(self, 'Config file error: {}'.format(msg))


class ConfigI(object):
CONFIG_DIR = '.dvc'
""" Basic config instance """
CONFIG_DIR = '.dvc'
TARGET_FILE_DEFAULT = 'target'
CONFIG = 'config'
STATE_DIR = 'state'
CACHE_DIR = 'cache'
CONFIG = 'config'
STATE_DIR = 'state'
CACHE_DIR = 'cache'

def __init__(self, data_dir=None, cloud=None, conf_parser=None):
self._data_dir = None
Expand All @@ -24,24 +29,29 @@ def __init__(self, data_dir=None, cloud=None, conf_parser=None):
self.set(data_dir, cloud, conf_parser)

def set(self, data_dir, cloud=None, conf_parser=None):
""" Set config params """
self._data_dir = data_dir
self._cloud = cloud
self._conf_parser = conf_parser

@property
def data_dir(self):
""" Directory with data files """
return self._data_dir

@property
def cache_dir(self):
""" Directory with cached data files """
return os.path.join(self.CONFIG_DIR, self.CACHE_DIR)

@property
def state_dir(self):
""" Directory with state files """
return os.path.join(self.CONFIG_DIR, self.STATE_DIR)

@property
def cloud(self):
""" Cloud config """
return self._cloud

@property
Expand All @@ -50,11 +60,13 @@ def conf_parser(self):


class Config(ConfigI):
""" Parsed config object """
def __init__(self, conf_file=ConfigI.CONFIG, conf_pseudo_file=None):
"""
Params:
conf_file (String): configuration file
conf_pseudo_file (String): for unit testing, something that supports readline; supersedes conf_file
conf_pseudo_file (String): for unit testing, something that supports readline;
supersedes conf_file
"""
self._conf_file = conf_file
self._config = configparser.SafeConfigParser()
Expand All @@ -73,8 +85,8 @@ def __init__(self, conf_file=ConfigI.CONFIG, conf_pseudo_file=None):
super(Config, self).__init__(self._config['Global']['DataDir'],
self._config['Global']['Cloud'],
self._config)
pass

@property
def file(self):
""" Config file object """
return self._conf_file
Loading

0 comments on commit 17f0c0d

Please sign in to comment.