<commit_before>import getpass
import json
import os
from collections import Mapping, OrderedDict, Sequence
from configparser import RawConfigParser
from copy import copy
from locale import getpreferredencoding
from subprocess import check_output, CalledProcessError, DEVNULL

from .command import command
from .const import DEFAULT_COMMANDS_MODULE
from .exc import ConfigError, ConfigKeyError, ConfigTypeError, ConfigValueError
from .util import abort, abs_path, load_object

try:
    # Python 3.5 and up
    from collections import _OrderedDictItemsView, _OrderedDictValuesView
except ImportError:
    # Python 3.4 and below
    from collections import ItemsView, ValuesView

    class _OrderedDictItemsView(ItemsView):

        def __reversed__(self):
            for key in reversed(self._mapping):
                yield (key, self._mapping[key])

    class _OrderedDictValuesView(ValuesView):

        def __reversed__(self):
            for key in reversed(self._mapping):
                yield self._mapping[key]


__all__ = ['show_config']


NO_DEFAULT = object()


class RawConfig(OrderedDict):

    def __init__(self, *defaults, **overrides):
        self._parent = None
        super().__init__()
        self._update_dotted(*defaults)
        self._update_dotted(overrides)

    def __getitem__(self, name):
        try:
            value = super().__getitem__(name)
        except KeyError:
            raise ConfigKeyError(name) from None
        if not isinstance(value, RawConfig):
            value = self._interpolate(value)
        if isinstance(value, JSONValue):
            value = value.load()
        return value

    def __setitem__(self, name, value):
        super().__setitem__(name, value)
        if isinstance(value, RawConfig):
            value._parent = self

    def __getattr__(self, name):
        # This will be called only when the named attribute isn't found
        # on the config instance. Attributes have priority over config
        # keys with the same name.
        if name.startswith('_OrderedDict__'):
            return super().__getattribute__(name)
        return self[name]

    def __setattr__(self, name, value):
        # Public names are added as dict items. Private names are set as
        # attributes.
        if name.startswith('_'):
            return super().__setattr__(name, value)
        self[name] = value

    def __delattr__(self, name):
        try:
            super().__delattr__(name)
        except AttributeError:
            del self[name]

    def __copy__(self):
        config = self._make_empty()
        for k, v in self.items():
            config[k] = copy(v)
        return config

    def copy(self, *args, **kwargs):
        clone = copy(self)
        for overrides in args:<commit_msg>When copying config objects, skip interpolation<commit_after>import getpass
import json
import os
from collections import Mapping, OrderedDict, Sequence
from configparser import RawConfigParser
from copy import copy
from locale import getpreferredencoding
from subprocess import check_output, CalledProcessError, DEVNULL

from .command import command
from .const import DEFAULT_COMMANDS_MODULE
from .exc import ConfigError, ConfigKeyError, ConfigTypeError, ConfigValueError
from .util import abort, abs_path, load_object

try:
    # Python 3.5 and up
    from collections import _OrderedDictItemsView, _OrderedDictValuesView
except ImportError:
    # Python 3.4 and below
    from collections import ItemsView, ValuesView

    class _OrderedDictItemsView(ItemsView):

        def __reversed__(self):
            for key in reversed(self._mapping):
                yield (key, self._mapping[key])

    class _OrderedDictValuesView(ValuesView):

        def __reversed__(self):
            for key in reversed(self._mapping):
                yield self._mapping[key]


__all__ = ['show_config']


NO_DEFAULT = object()


class RawConfig(OrderedDict):

    def __init__(self, *defaults, **overrides):
        self._parent = None
        super().__init__()
        self._update_dotted(*defaults)
        self._update_dotted(overrides)

    def __getitem__(self, name):
        try:
            value = super().__getitem__(name)
        except KeyError:
            raise ConfigKeyError(name) from None
        if not isinstance(value, RawConfig):
            value = self._interpolate(value)
        if isinstance(value, JSONValue):
            value = value.load()
        return value

    def __setitem__(self, name, value):
        super().__setitem__(name, value)
        if isinstance(value, RawConfig):
            value._parent = self

    def __getattr__(self, name):
        # This will be called only when the named attribute isn't found
        # on the config instance. Attributes have priority over config
        # keys with the same name.
        if name.startswith('_OrderedDict__'):
            return super().__getattribute__(name)
        return self[name]

    def __setattr__(self, name, value):
        # Public names are added as dict items. Private names are set as
        # attributes.
        if name.startswith('_'):
            return super().__setattr__(name, value)
        self[name] = value

    def __delattr__(self, name):
        try:
            super().__delattr__(name)
        except AttributeError:
            del self[name]

    def __copy__(self):
        config = self._make_empty()
        for k in self:
            v = super().__getitem__(k)
            config[k] = copy(v)
        return config

    def copy(self, *args, **kwargs):
        clone = copy(self)
        for overrides in args:
{'fraction_non_alphanumeric': 0.07967914438502674, 'fraction_numerical': 0.00142602495543672, 'mean_word_length': 2.62, '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': '731008', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1476, 'n_words': 473}