<commit_before>"""Metadata objects for a bundle.

Copyright (c) 2015 Civic Knowledge. This file is licensed under the terms of
the Revised BSD License, included in this distribution as LICENSE.txt

"""

from collections import Mapping, OrderedDict, MutableMapping
import copy
import logging

from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm import object_session

from ambry.orm.config import Config
from ambry.orm.exc import MetadataError

from ambry.util import get_logger
logger = get_logger(__name__, level=logging.DEBUG)


class AttrDict(OrderedDict):
    def __init__(self, *argz, **kwz):

        super(AttrDict, self).__init__(*argz, **kwz)

    def __setitem__(self, k, v):
        super(AttrDict, self).__setitem__(k, AttrDict(v) if isinstance(v, Mapping) else v)

    def __getitem__(self, key):
        return super(AttrDict, self).__getitem__(key)

    def __getattr__(self, k):

        if not (k.startswith('__') or k.startswith('_OrderedDict__')):
            return self[k]
        else:
            return super(AttrDict, self).__getattr__(k)

    def __setattr__(self, k, v):
        if k.startswith('_OrderedDict__'):<commit_msg>Property tree logger changed to INFO level. CivicKnowledge/ambry#82.<commit_after>"""Metadata objects for a bundle.

Copyright (c) 2015 Civic Knowledge. This file is licensed under the terms of
the Revised BSD License, included in this distribution as LICENSE.txt

"""

from collections import Mapping, OrderedDict, MutableMapping
import copy
import logging

from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm import object_session

from ambry.orm.config import Config
from ambry.orm.exc import MetadataError

from ambry.util import get_logger
logger = get_logger(__name__, level=logging.INFO)


class AttrDict(OrderedDict):
    def __init__(self, *argz, **kwz):

        super(AttrDict, self).__init__(*argz, **kwz)

    def __setitem__(self, k, v):
        super(AttrDict, self).__setitem__(k, AttrDict(v) if isinstance(v, Mapping) else v)

    def __getitem__(self, key):
        return super(AttrDict, self).__getitem__(key)

    def __getattr__(self, k):

        if not (k.startswith('__') or k.startswith('_OrderedDict__')):
            return self[k]
        else:
            return super(AttrDict, self).__getattr__(k)

    def __setattr__(self, k, v):
        if k.startswith('_OrderedDict__'):
{'fraction_non_alphanumeric': 0.09899328859060402, 'fraction_numerical': 0.0041946308724832215, 'mean_word_length': 3.979123173277662, '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': '5493702', 'n_tokens_mistral': 768, 'n_tokens_neox': 732, 'n_words': 222}