<commit_before>from collections import Iterable

def is_nonstring_iterable(obj):
    """
    :param obj: the object to check
    :return: whether the given object is a non-string iterable object
    """
    return isinstance(obj, Iterable) and not isinstance(obj, str)

def to_series(items, conjunction='and'):
    """
    Formats the given items as a series string.
    
    Example:
    
    >>> to_series([1, 2, 3])
    '1, 2 and 3'
    
    :param items: the items to format in a series
    :param conjunction: the series conjunction
    :return: the items series
    :rtype: str
    """
    if not items:
        return ''
    prefix = ', '.join([str(i) for i in items[:-1]])
    suffix = str(items[-1])
    if not prefix:
        return suffix
    else:
        return (' ' + conjunction + ' ').join([prefix, suffix])

class ImmutableDict(dict):
    """
    ImmutableDict is a dictionary that cannot be changed after creation.
    
    An ImmutableDict is *not* hashable and therefore cannot be used as a dictionary
    key or set member. See http://www.python.org/dev/peps/pep-0351 for the rationale.
    """
    
    def __int__(*args, **kwargs):
        super(ImmutableDict, self).__init__(*args, **kwargs)
    
    def __setitem__(self, key, value):
        """
        :raise NotImplementedError: always
        """
        raise NotImplementedError("The dictionary is immutable: %s" % self)

EMPTY_DICT = ImmutableDict()
"""
An immutable empty dictionary.
This constant serves as an efficient method return default value.
"""
<commit_msg>Fix initializer.<commit_after>from collections import Iterable

def is_nonstring_iterable(obj):
    """
    :param obj: the object to check
    :return: whether the given object is a non-string iterable object
    """
    return isinstance(obj, Iterable) and not isinstance(obj, str)

def to_series(items, conjunction='and'):
    """
    Formats the given items as a series string.
    
    Example:
    
    >>> to_series([1, 2, 3])
    '1, 2 and 3'
    
    :param items: the items to format in a series
    :param conjunction: the series conjunction
    :return: the items series
    :rtype: str
    """
    if not items:
        return ''
    prefix = ', '.join([str(i) for i in items[:-1]])
    suffix = str(items[-1])
    if not prefix:
        return suffix
    else:
        return (' ' + conjunction + ' ').join([prefix, suffix])


class ImmutableDict(dict):
    """
    ImmutableDict is a dictionary that cannot be changed after creation.
    
    An ImmutableDict is *not* hashable and therefore cannot be used as a dictionary
    key or set member. See http://www.python.org/dev/peps/pep-0351 for the rationale.
    """
    
    def __init__(self, *args, **kwargs):
        super(ImmutableDict, self).__init__(*args, **kwargs)
    
    def __setitem__(self, key, value):
        """
        :raise NotImplementedError: always
        """
        raise NotImplementedError("The dictionary is immutable: %s" % self)

EMPTY_DICT = ImmutableDict()
"""
An immutable empty dictionary.
This constant serves as an efficient method return default value.
"""

{'fraction_non_alphanumeric': 0.1092896174863388, 'fraction_numerical': 0.007714561234329798, 'mean_word_length': 2.790499390986602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3086553', 'n_tokens_mistral': 926, 'n_tokens_neox': 906, 'n_words': 326}