<commit_before>"""DVC config objects."""

import copy
import errno
import logging
import os
import re

import configobj
from voluptuous import Schema, Required, Optional, Invalid
from voluptuous import All, Any, Lower, Range, Coerce, Match

from dvc.exceptions import DvcException
from dvc.exceptions import NotDvcRepoError

logger = logging.getLogger(__name__)


class ConfigError(DvcException):
    """DVC config exception."""

    def __init__(self, msg):
        super().__init__("config file error: {}".format(msg))


class NoRemoteError(ConfigError):
    def __init__(self, command, *, config=None):
        has_any_remote = False
        if config:
            has_any_remote = config.list_options(
                Config.SECTION_REMOTE_REGEX, Config.SECTION_REMOTE_URL
            )

        if has_any_remote:
            msg = (
                "no remote specified. Setup default remote with\n"
                "    dvc remote default <remote name>\n"
                "or use:\n"
                "    dvc {} -r <remote name>".format(command)
            )
        else:
            msg = (
                "no remote specified. Create a remote with\n"
                "    dvc remote add <remote name> <remote url>\n"
                "To create a default remote use the -d flag:\n"
                "    dvc remote add -d <remote name> <remote url>"
            )

        super().__init__(msg)


def supported_cache_type(types):
    """Checks if link type config option consists only of valid values.

    Args:
        types (list/string): type(s) of links that dvc should try out.
    """<commit_msg>convert to bool<commit_after>"""DVC config objects."""

import copy
import errno
import logging
import os
import re

import configobj
from voluptuous import Schema, Required, Optional, Invalid
from voluptuous import All, Any, Lower, Range, Coerce, Match

from dvc.exceptions import DvcException
from dvc.exceptions import NotDvcRepoError

logger = logging.getLogger(__name__)


class ConfigError(DvcException):
    """DVC config exception."""

    def __init__(self, msg):
        super().__init__("config file error: {}".format(msg))


class NoRemoteError(ConfigError):
    def __init__(self, command, *, config=None):
        has_any_remote = False
        if config:
            has_any_remote = bool(
                config.list_options(
                    Config.SECTION_REMOTE_REGEX, Config.SECTION_REMOTE_URL
                )
            )

        if has_any_remote:
            msg = (
                "no remote specified. Setup default remote with\n"
                "    dvc remote default <remote name>\n"
                "or use:\n"
                "    dvc {} -r <remote name>".format(command)
            )
        else:
            msg = (
                "no remote specified. Create a remote with\n"
                "    dvc remote add <remote name> <remote url>\n"
                "To create a default remote use the -d flag:\n"
                "    dvc remote add -d <remote name> <remote url>"
            )

        super().__init__(msg)


def supported_cache_type(types):
    """Checks if link type config option consists only of valid values.

    Args:
        types (list/string): type(s) of links that dvc should try out.
    """
{'fraction_non_alphanumeric': 0.0910757946210269, 'fraction_numerical': 0.0, 'mean_word_length': 2.0848256361922712, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6132817', 'n_tokens_mistral': 932, 'n_tokens_neox': 889, 'n_words': 295}