<commit_before>from springfield import Entity


def entity_from_mongo(kls, values):
    """
    Construct an Entity of type `kls` from a Mongo document.
    """
    entity = kls()
    if hasattr(values, '__values__'):
        for key, val in values.__values__.items():
            if key == '_id':
                key = 'id'

            if key in entity.__fields__:
                entity.set(key, val)
    else:
        for key, val in values.items():
            if key == '_id':
                key = 'id'

            if key in entity.__fields__:
                entity.set(key, val)<commit_msg>Use a more standard variable name for the class argument.<commit_after>from springfield import Entity


def entity_from_mongo(cls, values):
    """
    Construct an Entity of type `cls` from a Mongo document.
    """
    entity = cls()
    if hasattr(values, '__values__'):
        for key, val in values.__values__.items():
            if key == '_id':
                key = 'id'

            if key in entity.__fields__:
                entity.set(key, val)
    else:
        for key, val in values.items():
            if key == '_id':
                key = 'id'

            if key in entity.__fields__:
                entity.set(key, val)
{'fraction_non_alphanumeric': 0.10530546623794212, 'fraction_numerical': 0.0, 'mean_word_length': 1.700650759219089, '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': '7629101', 'n_tokens_mistral': 359, 'n_tokens_neox': 342, 'n_words': 118}