<commit_before>from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
from django.utils.timezone import now
from django.utils.encoding import python_2_unicode_compatible
from django.db.models.signals import post_save, post_init
from django.dispatch import receiver

from eemeter.evaluation import Period
from eemeter.project import Project as EEMeterProject
from eemeter.consumption import ConsumptionData as EEMeterConsumptionData
from eemeter.location import Location
from eemeter.meter import DataCollection
from eemeter.meter import DefaultResidentialMeter
from eemeter.config.yaml_parser import dump
from eemeter.models.temperature_sensitivity import AverageDailyTemperatureSensitivityModel

from warnings import warn
from datetime import timedelta, datetime
import numpy as np
import json
from collections import defaultdict, OrderedDict
import itertools

# This is perhaps unneccessary...callers of `run_meter` could just
# pass the class name directly. For now, though, the existing code
# depends on being about to pass 'residential' as a meter type.
#
# Also: this could live in a separate settings file
METER_CLASS_CHOICES = {
    'residential': 'DefaultResidentialMeter',
}

FUEL_TYPE_CHOICES = [
    ('E', 'electricity'),
    ('NG', 'natural_gas'),
]

ENERGY_UNIT_CHOICES = [
    ('KWH', 'kWh'),
    ('THM', 'therm'),
]

PROJECT_ATTRIBUTE_DATA_TYPE_CHOICES = [
    ('BOOLEAN', 'boolean_value'),
    ('CHAR', 'char_value'),
    ('DATE', 'date_value'),
    ('DATETIME', 'datetime_value'),
    ('FLOAT', 'float_value'),
    ('INTEGER', 'integer_value'),
]

def _json_clean(value):
    if value is None or np.isnan(value) or np.isinf(value):
        return None
    else:
        return value


@python_2_unicode_compatible
class ProjectOwner(models.Model):
    user = models.OneToOneField(User)<commit_msg>Bug fix -- wasn't supposed to be a string<commit_after>from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
from django.utils.timezone import now
from django.utils.encoding import python_2_unicode_compatible
from django.db.models.signals import post_save, post_init
from django.dispatch import receiver

from eemeter.evaluation import Period
from eemeter.project import Project as EEMeterProject
from eemeter.consumption import ConsumptionData as EEMeterConsumptionData
from eemeter.location import Location
from eemeter.meter import DataCollection
from eemeter.meter import DefaultResidentialMeter
from eemeter.config.yaml_parser import dump
from eemeter.models.temperature_sensitivity import AverageDailyTemperatureSensitivityModel

from warnings import warn
from datetime import timedelta, datetime
import numpy as np
import json
from collections import defaultdict, OrderedDict
import itertools

# This is perhaps unneccessary...callers of `run_meter` could just
# pass the class name directly. For now, though, the existing code
# depends on being about to pass 'residential' as a meter type.
#
# Also: this could live in a separate settings file
METER_CLASS_CHOICES = {
    'residential': DefaultResidentialMeter,
}

FUEL_TYPE_CHOICES = [
    ('E', 'electricity'),
    ('NG', 'natural_gas'),
]

ENERGY_UNIT_CHOICES = [
    ('KWH', 'kWh'),
    ('THM', 'therm'),
]

PROJECT_ATTRIBUTE_DATA_TYPE_CHOICES = [
    ('BOOLEAN', 'boolean_value'),
    ('CHAR', 'char_value'),
    ('DATE', 'date_value'),
    ('DATETIME', 'datetime_value'),
    ('FLOAT', 'float_value'),
    ('INTEGER', 'integer_value'),
]

def _json_clean(value):
    if value is None or np.isnan(value) or np.isinf(value):
        return None
    else:
        return value


@python_2_unicode_compatible
class ProjectOwner(models.Model):
    user = models.OneToOneField(User)
{'fraction_non_alphanumeric': 0.08763157894736842, 'fraction_numerical': 0.0010526315789473684, 'mean_word_length': 5.140549273021001, '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': '3905266', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1097, 'n_words': 350}