Skip to content

Commit

Permalink
Merge pull request #4742 from rtfd/davidfischer/storage-syncers
Browse files Browse the repository at this point in the history
Make storage syncers extend from a base class
  • Loading branch information
davidfischer committed Oct 16, 2018
2 parents d11402d + f885e05 commit 5b5edab
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions readthedocs/builds/syncers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@
log = logging.getLogger(__name__)


class LocalSyncer(object):
class BaseSyncer(object):

"""A base object for syncers and pullers"""

@classmethod
def copy(cls, path, target, is_file=False, **kwargs):
raise NotImplementedError


class LocalSyncer(BaseSyncer):

@classmethod
def copy(cls, path, target, is_file=False, **__):
def copy(cls, path, target, is_file=False, **kwargs):
"""A copy command that works with files or directories."""
log.info("Local Copy %s to %s", path, target)
if is_file:
Expand All @@ -41,10 +50,10 @@ def copy(cls, path, target, is_file=False, **__):
shutil.copytree(path, target)


class RemoteSyncer(object):
class RemoteSyncer(BaseSyncer):

@classmethod
def copy(cls, path, target, is_file=False, **__):
def copy(cls, path, target, is_file=False, **kwargs):
"""
A better copy command that works with files or directories.
Expand Down Expand Up @@ -77,10 +86,10 @@ def copy(cls, path, target, is_file=False, **__):
log.debug("Copy error to app servers: cmd=%s", sync_cmd)


class DoubleRemotePuller(object):
class DoubleRemotePuller(BaseSyncer):

@classmethod
def copy(cls, path, target, host, is_file=False, **__):
def copy(cls, path, target, host, is_file=False, **kwargs): # pylint: disable=arguments-differ
"""
A better copy command that works from the webs.
Expand Down Expand Up @@ -114,10 +123,10 @@ def copy(cls, path, target, host, is_file=False, **__):
log.debug("Copy error to app servers: cmd=%s", sync_cmd)


class RemotePuller(object):
class RemotePuller(BaseSyncer):

@classmethod
def copy(cls, path, target, host, is_file=False, **__):
def copy(cls, path, target, host, is_file=False, **kwargs): # pylint: disable=arguments-differ
"""
A better copy command that works from the webs.
Expand Down

0 comments on commit 5b5edab

Please sign in to comment.