<commit_before>from django import forms

import commonware
import happyforms
from tower import ugettext as _, ugettext_lazy as _lazy

import amo
from amo.utils import raise_required
from addons.models import Addon, AddonUpsell
from editors.models import RereviewQueue
from market.models import AddonPremium, Price

from mkt.constants import (BANGO_COUNTRIES, BANGO_OUTPAYMENT_CURRENCIES,
                           FREE_PLATFORMS, PAID_PLATFORMS)
from mkt.site.forms import AddonChoiceField
from mkt.submit.forms import DeviceTypeForm

from .models import AddonPaymentAccount, PaymentAccount


log = commonware.log.getLogger('z.devhub')


def _restore_app(app, save=True):
    """Restore an incomplete app to its former status. The app will be marked
    as its previuos status or PENDING if it was never reviewed.

    """

    log.info('Changing app from incomplete to previous status: %d' % app.pk)
    app.status = (app.highest_status if
                  app.highest_status != amo.STATUS_NULL else
                  amo.STATUS_PENDING)
    if save:
        app.save()


class PremiumForm(DeviceTypeForm, happyforms.Form):
    """
    The premium details for an addon, which is unfortunately
    distributed across a few models.
    """

    # This does a nice Yes/No field like the mockup calls for.
    allow_inapp = forms.ChoiceField(
        choices=((True, 'Yes'), (False, 'No')),
        widget=forms.RadioSelect, required=False)
    price = forms.ModelChoiceField(queryset=Price.objects.active(),
                                   label=_lazy(u'App Price'),
                                   empty_label=None, required=False)

    def __init__(self, *args, **kw):
        self.request = kw.pop('request')<commit_msg>Localize "yes" and "no" (bug 844586)<commit_after>from django import forms

import commonware
import happyforms
from tower import ugettext as _, ugettext_lazy as _lazy

import amo
from amo.utils import raise_required
from addons.models import Addon, AddonUpsell
from editors.models import RereviewQueue
from market.models import AddonPremium, Price

from mkt.constants import (BANGO_COUNTRIES, BANGO_OUTPAYMENT_CURRENCIES,
                           FREE_PLATFORMS, PAID_PLATFORMS)
from mkt.site.forms import AddonChoiceField
from mkt.submit.forms import DeviceTypeForm

from .models import AddonPaymentAccount, PaymentAccount


log = commonware.log.getLogger('z.devhub')


def _restore_app(app, save=True):
    """Restore an incomplete app to its former status. The app will be marked
    as its previuos status or PENDING if it was never reviewed.

    """

    log.info('Changing app from incomplete to previous status: %d' % app.pk)
    app.status = (app.highest_status if
                  app.highest_status != amo.STATUS_NULL else
                  amo.STATUS_PENDING)
    if save:
        app.save()


class PremiumForm(DeviceTypeForm, happyforms.Form):
    """
    The premium details for an addon, which is unfortunately
    distributed across a few models.
    """

    # This does a nice Yes/No field like the mockup calls for.
    allow_inapp = forms.ChoiceField(
        choices=((True, _lazy(u'Yes')), (False, _lazy(u'No'))),
        widget=forms.RadioSelect, required=False)
    price = forms.ModelChoiceField(queryset=Price.objects.active(),
                                   label=_lazy(u'App Price'),
                                   empty_label=None, required=False)

    def __init__(self, *args, **kw):
        self.request = kw.pop('request')
{'fraction_non_alphanumeric': 0.08235630540463254, 'fraction_numerical': 0.0017157563625965113, 'mean_word_length': 3.0206896551724136, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5809571', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1020, 'n_words': 308}