<commit_before>import logging
import pathlib
import sysconfig
from typing import List, Optional

from pip._internal.models.scheme import SCHEME_KEYS, Scheme

from . import _distutils, _sysconfig
from .base import (
    USER_CACHE_DIR,
    get_major_minor_version,
    get_src_prefix,
    site_packages,
    user_site,
)

__all__ = [
    "USER_CACHE_DIR",
    "get_bin_prefix",
    "get_bin_user",
    "get_major_minor_version",
    "get_platlib",
    "get_prefixed_libs",
    "get_purelib",
    "get_scheme",
    "get_src_prefix",
    "init_backend",
    "site_packages",
    "user_site",
]


logger = logging.getLogger(__name__)


def _default_base(*, user):
    # type: (bool) -> str
    if user:
        base = sysconfig.get_config_var("userbase")
    else:
        base = sysconfig.get_config_var("base")
    assert base is not None
    return base


def _warn_if_mismatch(old, new, *, key):
    # type: (pathlib.Path, pathlib.Path, str) -> None
    if old == new:
        return
    message = (
        "Value for %s does not match. Please report this: <URL HERE>"
        "\ndistutils: %s"
        "\nsysconfig: %s"
    )
    logger.warning(message, key, old, new)


def get_scheme(
    dist_name,  # type: str
    user=False,  # type: bool
    home=None,  # type: Optional[str]
    root=None,  # type: Optional[str]
    isolated=False,  # type: bool
    prefix=None,  # type: Optional[str]
):
    # type: (...) -> Scheme
    old = _distutils.get_scheme(
        dist_name,
        user=user,
        home=home,
        root=root,
        isolated=isolated,
        prefix=prefix,
    )
    new = _sysconfig.get_scheme(
        dist_name,
        user=user,
        home=home,
        root=root,
        isolated=isolated,
        prefix=prefix,
    )

    base = prefix or home or _default_base(user=user)
    for k in SCHEME_KEYS:<commit_msg>Provide issue URL to report<commit_after>import logging
import pathlib
import sysconfig
from typing import List, Optional

from pip._internal.models.scheme import SCHEME_KEYS, Scheme

from . import _distutils, _sysconfig
from .base import (
    USER_CACHE_DIR,
    get_major_minor_version,
    get_src_prefix,
    site_packages,
    user_site,
)

__all__ = [
    "USER_CACHE_DIR",
    "get_bin_prefix",
    "get_bin_user",
    "get_major_minor_version",
    "get_platlib",
    "get_prefixed_libs",
    "get_purelib",
    "get_scheme",
    "get_src_prefix",
    "init_backend",
    "site_packages",
    "user_site",
]


logger = logging.getLogger(__name__)


def _default_base(*, user):
    # type: (bool) -> str
    if user:
        base = sysconfig.get_config_var("userbase")
    else:
        base = sysconfig.get_config_var("base")
    assert base is not None
    return base


def _warn_if_mismatch(old, new, *, key):
    # type: (pathlib.Path, pathlib.Path, str) -> None
    if old == new:
        return
    issue_url = "https://github.com/pypa/pip/issues/9617"
    message = (
        "Value for %s does not match. Please report this to %s"
        "\ndistutils: %s"
        "\nsysconfig: %s"
    )
    logger.warning(message, key, issue_url, old, new)


def get_scheme(
    dist_name,  # type: str
    user=False,  # type: bool
    home=None,  # type: Optional[str]
    root=None,  # type: Optional[str]
    isolated=False,  # type: bool
    prefix=None,  # type: Optional[str]
):
    # type: (...) -> Scheme
    old = _distutils.get_scheme(
        dist_name,
        user=user,
        home=home,
        root=root,
        isolated=isolated,
        prefix=prefix,
    )
    new = _sysconfig.get_scheme(
        dist_name,
        user=user,
        home=home,
        root=root,
        isolated=isolated,
        prefix=prefix,
    )

    base = prefix or home or _default_base(user=user)
    for k in SCHEME_KEYS:
{'fraction_non_alphanumeric': 0.11278792692613185, 'fraction_numerical': 0.0010590415673815197, 'mean_word_length': 2.5641509433962266, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 1, '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': '4318962', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1302, 'n_words': 294}