<commit_before>from __future__ import unicode_literals

import argparse
import logging

from dvc.command.base import append_doc_link
from dvc.command.base import CmdBaseNoRepo
from dvc.config import Config


logger = logging.getLogger(__name__)


class CmdConfig(CmdBaseNoRepo):
    def __init__(self, args):
        super(CmdConfig, self).__init__(args)

        self.config = Config(validate=False)

    def run(self):
        section, opt = self.args.name.lower().strip().split(".", 1)

        if self.args.unset:
            self.config.unset(section, opt, level=self.args.level)
        elif self.args.value is None:
            logger.info(self.config.get(section, opt, level=self.args.level))
        else:
            self.config.set(
                section, opt, self.args.value, level=self.args.level
            )

        return 0


parent_config_parser = argparse.ArgumentParser(add_help=False)
parent_config_parser.add_argument(
    "--global",
    dest="level",
    action="store_const",
    const=Config.LEVEL_GLOBAL,
    help="Use global config.",
)
parent_config_parser.add_argument(
    "--system",
    dest="level",
    action="store_const",
    const=Config.LEVEL_SYSTEM,
    help="Use system config.",
)
parent_config_parser.add_argument(
    "--local",
    dest="level",
    action="store_const",
    const=Config.LEVEL_LOCAL,
    help="Use local config.",
)
parent_config_parser.set_defaults(level=Config.LEVEL_REPO)


def add_parser(subparsers, parent_parser):<commit_msg>dvc: warn to run `dvc checkout --relink` in cache.type change<commit_after>from __future__ import unicode_literals

import argparse
import logging

from dvc.command.base import append_doc_link
from dvc.command.base import CmdBaseNoRepo
from dvc.config import Config


logger = logging.getLogger(__name__)


class CmdConfig(CmdBaseNoRepo):
    def __init__(self, args):
        super(CmdConfig, self).__init__(args)

        self.config = Config(validate=False)

    def run(self):
        section, opt = self.args.name.lower().strip().split(".", 1)

        if self.args.unset:
            self.config.unset(section, opt, level=self.args.level)
        elif self.args.value is None:
            logger.info(self.config.get(section, opt, level=self.args.level))
        else:
            self.config.set(
                section, opt, self.args.value, level=self.args.level
            )

        is_write = self.args.unset or self.args.value is not None
        if is_write and self.args.name == "cache.type":
            logger.warning(
                "You have changed cache.type, this doesn't update link types "
                "of any previously checked out files automatically. "
                "That can be done with:\n"
                "             dvc checkout --relink"
            )

        return 0


parent_config_parser = argparse.ArgumentParser(add_help=False)
parent_config_parser.add_argument(
    "--global",
    dest="level",
    action="store_const",
    const=Config.LEVEL_GLOBAL,
    help="Use global config.",
)
parent_config_parser.add_argument(
    "--system",
    dest="level",
    action="store_const",
    const=Config.LEVEL_SYSTEM,
    help="Use system config.",
)
parent_config_parser.add_argument(
    "--local",
    dest="level",
    action="store_const",
    const=Config.LEVEL_LOCAL,
    help="Use local config.",
)
parent_config_parser.set_defaults(level=Config.LEVEL_REPO)


def add_parser(subparsers, parent_parser):
{'fraction_non_alphanumeric': 0.11284722222222222, 'fraction_numerical': 0.0011574074074074073, 'mean_word_length': 2.9284090909090907, 'pattern_counts': {'":': 1, '<': 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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6472231', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1039, 'n_words': 219}