<commit_before>from __future__ import unicode_literals

import argparse
import logging

from dvc.command.base import CmdBase, append_doc_link


logger = logging.getLogger(__name__)


class CmdDataBase(CmdBase):
    UP_TO_DATE_MSG = "Everything is up to date."

    def do_run(self, target):
        pass

    def run(self):
        if not self.args.targets:
            return self.do_run()

        ret = 0
        for target in self.args.targets:
            if self.do_run(target):
                ret = 1
        return ret

    @classmethod
    def check_up_to_date(cls, processed_files_count):
        if processed_files_count == 0:
            logger.info(cls.UP_TO_DATE_MSG)


class CmdDataPull(CmdDataBase):
    def do_run(self, target=None):
        try:
            processed_files_count = self.repo.pull(
                target=target,
                jobs=self.args.jobs,
                remote=self.args.remote,
                show_checksums=self.args.show_checksums,
                all_branches=self.args.all_branches,
                all_tags=self.args.all_tags,
                with_deps=self.args.with_deps,
                force=self.args.force,
                recursive=self.args.recursive,
            )
        except Exception:
            logger.exception("failed to pull data from the cloud")
            return 1
        self.check_up_to_date(processed_files_count)
        return 0


class CmdDataPush(CmdDataBase):
    def do_run(self, target=None):
        try:
            processed_files_count = self.repo.push(
                target=target,
                jobs=self.args.jobs,
                remote=self.args.remote,
                show_checksums=self.args.show_checksums,
                all_branches=self.args.all_branches,
                all_tags=self.args.all_tags,
                with_deps=self.args.with_deps,
                recursive=self.args.recursive,
            )
        except Exception:
            logger.exception("failed to push data to the cloud")
            return 1
        self.check_up_to_date(processed_files_count)
        return 0


class CmdDataFetch(CmdDataBase):
    def do_run(self, target=None):
        try:
            processed_files_count = self.repo.fetch(
                target=target,
                jobs=self.args.jobs,
                remote=self.args.remote,
                show_checksums=self.args.show_checksums,
                all_branches=self.args.all_branches,
                all_tags=self.args.all_tags,
                with_deps=self.args.with_deps,
                recursive=self.args.recursive,
            )
        except Exception:
            logger.exception("failed to fetch data from the cloud")
            return 1
        self.check_up_to_date(processed_files_count)
        return 0


def shared_parent_parser():
    from dvc.cli import get_parent_parser

    # Parent parser used in pull/push/status
    shared_parent_parser = argparse.ArgumentParser(
        add_help=False, parents=[get_parent_parser()]
    )
    shared_parent_parser.add_argument(
        "-j",
        "--jobs",
        type=int,
        default=None,
        help="Number of jobs to run simultaneously.",
    )
    shared_parent_parser.add_argument(
        "--show-checksums",
        action="store_true",
        default=False,
        help="Show checksums instead of file names.",
    )
    shared_parent_parser.add_argument(
        "targets",
        nargs="*",
        default=None,
        help="Limit the scope to these DVC-files. With -R a directory to search DVC-files can be specified.",
    )

    return shared_parent_parser


def add_parser(subparsers, _parent_parser):
    from dvc.command.status import CmdDataStatus

    # Pull
    PULL_HELP = "Pull data files from a DVC remote storage."

    pull_parser = subparsers.add_parser(
        "pull",
        parents=[shared_parent_parser()],
        description=append_doc_link(PULL_HELP, "pull"),
        help=PULL_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    pull_parser.add_argument(
        "-r", "--remote", help="Remote repository to pull from."
    )
    pull_parser.add_argument(
        "-a",
        "--all-branches",
        action="store_true",
        default=False,<commit_msg>fixed: splited helper text in data sync<commit_after>from __future__ import unicode_literals

import argparse
import logging

from dvc.command.base import CmdBase, append_doc_link


logger = logging.getLogger(__name__)


class CmdDataBase(CmdBase):
    UP_TO_DATE_MSG = "Everything is up to date."

    def do_run(self, target):
        pass

    def run(self):
        if not self.args.targets:
            return self.do_run()

        ret = 0
        for target in self.args.targets:
            if self.do_run(target):
                ret = 1
        return ret

    @classmethod
    def check_up_to_date(cls, processed_files_count):
        if processed_files_count == 0:
            logger.info(cls.UP_TO_DATE_MSG)


class CmdDataPull(CmdDataBase):
    def do_run(self, target=None):
        try:
            processed_files_count = self.repo.pull(
                target=target,
                jobs=self.args.jobs,
                remote=self.args.remote,
                show_checksums=self.args.show_checksums,
                all_branches=self.args.all_branches,
                all_tags=self.args.all_tags,
                with_deps=self.args.with_deps,
                force=self.args.force,
                recursive=self.args.recursive,
            )
        except Exception:
            logger.exception("failed to pull data from the cloud")
            return 1
        self.check_up_to_date(processed_files_count)
        return 0


class CmdDataPush(CmdDataBase):
    def do_run(self, target=None):
        try:
            processed_files_count = self.repo.push(
                target=target,
                jobs=self.args.jobs,
                remote=self.args.remote,
                show_checksums=self.args.show_checksums,
                all_branches=self.args.all_branches,
                all_tags=self.args.all_tags,
                with_deps=self.args.with_deps,
                recursive=self.args.recursive,
            )
        except Exception:
            logger.exception("failed to push data to the cloud")
            return 1
        self.check_up_to_date(processed_files_count)
        return 0


class CmdDataFetch(CmdDataBase):
    def do_run(self, target=None):
        try:
            processed_files_count = self.repo.fetch(
                target=target,
                jobs=self.args.jobs,
                remote=self.args.remote,
                show_checksums=self.args.show_checksums,
                all_branches=self.args.all_branches,
                all_tags=self.args.all_tags,
                with_deps=self.args.with_deps,
                recursive=self.args.recursive,
            )
        except Exception:
            logger.exception("failed to fetch data from the cloud")
            return 1
        self.check_up_to_date(processed_files_count)
        return 0


def shared_parent_parser():
    from dvc.cli import get_parent_parser

    # Parent parser used in pull/push/status
    shared_parent_parser = argparse.ArgumentParser(
        add_help=False, parents=[get_parent_parser()]
    )
    shared_parent_parser.add_argument(
        "-j",
        "--jobs",
        type=int,
        default=None,
        help="Number of jobs to run simultaneously.",
    )
    shared_parent_parser.add_argument(
        "--show-checksums",
        action="store_true",
        default=False,
        help="Show checksums instead of file names.",
    )
    shared_parent_parser.add_argument(
        "targets",
        nargs="*",
        default=None,
        help="""Limit the scope to these DVC-files.
        With -R a directory to search DVC-files in can be specified.""",
    )

    return shared_parent_parser


def add_parser(subparsers, _parent_parser):
    from dvc.command.status import CmdDataStatus

    # Pull
    PULL_HELP = "Pull data files from a DVC remote storage."

    pull_parser = subparsers.add_parser(
        "pull",
        parents=[shared_parent_parser()],
        description=append_doc_link(PULL_HELP, "pull"),
        help=PULL_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    pull_parser.add_argument(
        "-r", "--remote", help="Remote repository to pull from."
    )
    pull_parser.add_argument(
        "-a",
        "--all-branches",
        action="store_true",
        default=False,
{'fraction_non_alphanumeric': 0.08563439356868228, 'fraction_numerical': 0.0020971688220901784, 'mean_word_length': 1.9867780097425192, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6780656', 'n_tokens_mistral': 2611, 'n_tokens_neox': 2459, 'n_words': 488}