<commit_before>from django.db import models

from valuenetwork.valueaccounting.models import Unit
from decimal import *

# Helpers for dealing with Agent polymorphism

def formatAgent(agent):
    if agent.agent_type.party_type == "individual":
        return Person(
            id=agent.id,
            name = agent.name,
            note = agent.description,
            image = agent.image)
    else:
        return Organization(
            id=agent.id,
            name = agent.name,
            note = agent.description,
            image = agent.image,
            is_context = agent.is_context,
            type = agent.agent_type)

def formatAgentList(agent_list):
    mixed_list = []
    for agent in agent_list:
        mixed_list.append(formatAgent(agent))
    return mixed_list

# Django model extensions for exposing OO type layer in Graphene (core doesn't really use inheritance)

class QuantityValue(models.Model):
    numeric_value = models.DecimalField(max_digits=8, decimal_places=2,
        default=Decimal("0.00"))<commit_msg>fixed invalid error message on agents<commit_after>from django.db import models

from valuenetwork.valueaccounting.models import Unit
from decimal import *

# Helpers for dealing with Agent polymorphism

def formatAgent(agent):
    if agent:
        if agent.agent_type.party_type == "individual":
            return Person(
                id=agent.id,
                name = agent.name,
                note = agent.description,
                image = agent.image)
        else:
            return Organization(
                id=agent.id,
                name = agent.name,
                note = agent.description,
                image = agent.image,
                is_context = agent.is_context,
                type = agent.agent_type)

def formatAgentList(agent_list):
    mixed_list = []
    for agent in agent_list:
        mixed_list.append(formatAgent(agent))
    return mixed_list

# Django model extensions for exposing OO type layer in Graphene (core doesn't really use inheritance)

class QuantityValue(models.Model):
    numeric_value = models.DecimalField(max_digits=8, decimal_places=2,
        default=Decimal("0.00"))
{'fraction_non_alphanumeric': 0.07815356489945155, 'fraction_numerical': 0.004570383912248629, 'mean_word_length': 2.3676923076923075, 'pattern_counts': {'":': 2, '<': 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': '938739', 'n_tokens_mistral': 613, 'n_tokens_neox': 576, 'n_words': 158}