<commit_before># encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Contact: <NAME> (<EMAIL>)
#

from __future__ import absolute_import, division, unicode_literals

from copy import copy, deepcopy
from decimal import Decimal

from mo_dots.lists import is_list, FlatList, is_sequence, is_many, LIST
from mo_dots.nones import Null, NullType
from mo_dots.utils import CLASS
from mo_dots.utils import get_logger
from mo_future import (
    generator_types,
    iteritems,
    long,
    text,
    MutableMapping,
    OrderedDict,
)
from mo_imports import expect

(
    _getdefault,
    coalesce,
    hash_value,
    listwrap,
    literal_field,
    from_data,
    to_data,
    null_types,
    list_to_data,
    dict_to_data,
) = expect(
    "_getdefault",
    "coalesce",
    "hash_value",
    "listwrap",
    "literal_field",
    "from_data",
    "to_data",
    "null_types",
    "list_to_data",
    "dict_to_data",
)


_get = object.__getattribute__
_set = object.__setattr__
_new = object.__new__

SLOT = str("_internal_value")
DEBUG = False


class Data(object):
    """
    Please see https://github.com/klahnakoski/mo-dots/tree/dev/docs#data-replaces-pythons-dict
    """

    __slots__ = [SLOT]

    def __init__(self, *args, **kwargs):
        """
        CONSTRUCT DATA WITH GIVEN PROPERTY VALUES
        """
        if args:
            get_logger().error("only keywords are allowed")
        _set(self, SLOT, kwargs)

    def __bool__(self):
        d = _get(self, SLOT)
        if _get(d, CLASS) is dict:
            return bool(d)
        else:
            return d != None

    def __nonzero__(self):
        d = _get(self, SLOT)
        if _get(d, CLASS) is dict:
            return True if d else False
        else:
            return d != None

    def __contains__(self, item):
        value = Data.__getitem__(self, item)
        if _get(value, CLASS) in data_types or value:
            return True
        return False

    def __iter__(self):
        d = _get(self, SLOT)
        return d.__iter__()

    def __getitem__(self, key):
        if key == None:<commit_msg>lib updates<commit_after># encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Contact: <NAME> (<EMAIL>)
#

from __future__ import absolute_import, division, unicode_literals

from copy import copy, deepcopy
from decimal import Decimal

from mo_dots.lists import is_list, FlatList, is_sequence, is_many, LIST
from mo_dots.nones import Null, NullType
from mo_dots.utils import CLASS
from mo_dots.utils import get_logger
from mo_future import (
    generator_types,
    iteritems,
    long,
    text,
    MutableMapping,
    OrderedDict,
)
from mo_imports import expect

(
    _getdefault,
    coalesce,
    hash_value,
    listwrap,
    literal_field,
    from_data,
    to_data,
    null_types,
    list_to_data,
    dict_to_data,
) = expect(
    "_getdefault",
    "coalesce",
    "hash_value",
    "listwrap",
    "literal_field",
    "from_data",
    "to_data",
    "null_types",
    "list_to_data",
    "dict_to_data",
)


_get = object.__getattribute__
_set = object.__setattr__
_new = object.__new__

SLOT = str("_internal_value")
DEBUG = False


class Data(object):
    """
    Please see https://github.com/klahnakoski/mo-dots/tree/dev/docs#data-replaces-pythons-dict
    """

    __slots__ = [SLOT]

    def __init__(self, *args, **kwargs):
        """
        CONSTRUCT DATA WITH GIVEN PROPERTY VALUES
        """
        if args:
            raise Exception("only keywords are allowed")
        _set(self, SLOT, kwargs)

    def __bool__(self):
        d = _get(self, SLOT)
        if _get(d, CLASS) is dict:
            return bool(d)
        else:
            return d != None

    def __nonzero__(self):
        d = _get(self, SLOT)
        if _get(d, CLASS) is dict:
            return True if d else False
        else:
            return d != None

    def __contains__(self, item):
        value = Data.__getitem__(self, item)
        if _get(value, CLASS) in data_types or value:
            return True
        return False

    def __iter__(self):
        d = _get(self, SLOT)
        return d.__iter__()

    def __getitem__(self, key):
        if key == None:
{'fraction_non_alphanumeric': 0.09829154648324828, 'fraction_numerical': 0.002218770800976259, 'mean_word_length': 2.5, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2608590', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1468, 'n_words': 425}