Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make storage syncers extend from a base class #4742

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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