<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime

from django.db import models
from django.utils.translation import ugettext_lazy as _

from valuenetwork.valueaccounting.models import EconomicResource, EconomicEvent

class FaircoinAddress(models.Model):
    resource = models.OneToOneField(EconomicResource, on_delete=models.CASCADE,
        verbose_name=_('resource'), related_name='faircoin_address')
    address = models.CharField(_("faircoin address"), max_length=96,
        null=False, editable=False)

TX_STATE_CHOICES = (
    ('new', _('New')),
    ('pending', _('Pending')),
    ('broadcast', _('Broadcast')),
    ('confirmed', _('Confirmed')),
    ('external', _('External')),
    ('error', _('Error')),
)

class FaircoinTransaction(models.Model):
    event = models.OneToOneField(EconomicEvent, on_delete=models.CASCADE,
            verbose_name=_('event'), related_name='faircoin_transaction')
    tx_hash = models.CharField(_("faircoin transaction hash"), max_length=96,
        blank=True, null=True, editable=False)
    tx_state = models.CharField(_('faircoin transaction state'),
        max_length=12, choices=TX_STATE_CHOICES, blank=True, null=True)
    to_address = models.CharField(_('to address'), max_length=128, blank=True, null=True)

    def is_old_blockchain(self):
        fc2_launch_date = datetime(2017, 7, 18)
        if self.event.event_date < fc2_launch_date:
            return True
        else:
            return False<commit_msg>Date fields compares with datetime.date<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date

from django.db import models
from django.utils.translation import ugettext_lazy as _

from valuenetwork.valueaccounting.models import EconomicResource, EconomicEvent

class FaircoinAddress(models.Model):
    resource = models.OneToOneField(EconomicResource, on_delete=models.CASCADE,
        verbose_name=_('resource'), related_name='faircoin_address')
    address = models.CharField(_("faircoin address"), max_length=96,
        null=False, editable=False)

TX_STATE_CHOICES = (
    ('new', _('New')),
    ('pending', _('Pending')),
    ('broadcast', _('Broadcast')),
    ('confirmed', _('Confirmed')),
    ('external', _('External')),
    ('error', _('Error')),
)

class FaircoinTransaction(models.Model):
    event = models.OneToOneField(EconomicEvent, on_delete=models.CASCADE,
            verbose_name=_('event'), related_name='faircoin_transaction')
    tx_hash = models.CharField(_("faircoin transaction hash"), max_length=96,
        blank=True, null=True, editable=False)
    tx_state = models.CharField(_('faircoin transaction state'),
        max_length=12, choices=TX_STATE_CHOICES, blank=True, null=True)
    to_address = models.CharField(_('to address'), max_length=128, blank=True, null=True)

    def is_old_blockchain(self):
        fc2_launch_date = date(2017, 7, 18)
        if self.event.event_date < fc2_launch_date:
            return True
        else:
            return False
{'fraction_non_alphanumeric': 0.12801302931596092, 'fraction_numerical': 0.012377850162866449, 'mean_word_length': 4.445035460992908, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3053533', 'n_tokens_mistral': 982, 'n_tokens_neox': 926, 'n_words': 191}