<commit_before>from dvc.command.common.base import CmdBase
from dvc.logger import Logger

import dvc.data_cloud as cloud


class CmdDataPull(CmdBase):
    def __init__(self, settings):
        super(CmdDataPull, self).__init__(settings)

    def run(self):
        self.cloud.pull(self.parsed_args.targets, self.parsed_args.jobs)


class CmdDataPush(CmdBase):
    def __init__(self, settings):
        super(CmdDataPush, self).__init__(settings)

    def run(self):
        self.cloud.push(self.parsed_args.targets, self.parsed_args.jobs)


class CmdDataStatus(CmdBase):
    def __init__(self, settings):
        super(CmdDataStatus, self).__init__(settings)

    def _show(self, status):
        for s in status:
            target, ret = s

            if ret == cloud.STATUS_UNKNOWN or ret == cloud.STATUS_OK:
                continue

            prefix_map = {
                cloud.STATUS_DELETED  : 'deleted: ',
                cloud.STATUS_MODIFIED : 'modified:',
                cloud.STATUS_NEW      : 'new file:',
            }

            Logger.info('\t{}\t{}'.format(prefix_map[ret], target.data.dvc))

    def run(self):<commit_msg>pull/push: generalize CmdDataBase class<commit_after>from dvc.command.common.base import CmdBase
from dvc.logger import Logger

import dvc.data_cloud as cloud

class CmdDataBase(CmdBase):
    def __init__(self, settings, cmd):
        super(CmdDataBase, self).__init__(settings)
        self.cmd = cmd

    def run(self):
        getattr(self.cloud, self.cmd)(self.parsed_args.targets, self.parsed_args.jobs)


class CmdDataPull(CmdDataBase):
    def __init__(self, settings):
        super(CmdDataPull, self).__init__(settings, 'pull')


class CmdDataPush(CmdDataBase):
    def __init__(self, settings):
        super(CmdDataPush, self).__init__(settings, 'push')


class CmdDataStatus(CmdBase):
    def __init__(self, settings):
        super(CmdDataStatus, self).__init__(settings)

    def _show(self, status):
        for s in status:
            target, ret = s

            if ret == cloud.STATUS_UNKNOWN or ret == cloud.STATUS_OK:
                continue

            prefix_map = {
                cloud.STATUS_DELETED  : 'deleted: ',
                cloud.STATUS_MODIFIED : 'modified:',
                cloud.STATUS_NEW      : 'new file:',
            }

            Logger.info('\t{}\t{}'.format(prefix_map[ret], target.data.dvc))

    def run(self):
{'fraction_non_alphanumeric': 0.11244813278008299, 'fraction_numerical': 0.0, 'mean_word_length': 2.5508100147275403, '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': '6505288', 'n_tokens_mistral': 761, 'n_tokens_neox': 732, 'n_words': 151}