<commit_before>"""
Forms for running a Pipeline.
"""

from django import forms
from pipeline.models import Pipeline, PipelineFamily
from librarian.models import SymbolicDataset

class PipelineSelectionForm(forms.Form):
    """Form for selecting a Pipeline to run."""
    pipeline = forms.ChoiceField()

    def __init__(self, *args, **kwargs):
        self.family_pk = kwargs.pop("pipeline_family_pk")
        super(PipelineSelectionForm, self).__init__(*args, **kwargs)

        pipeline = PipelineFamily.objects.get(pk=self.family_pk)
        self.family_name = pipeline.name
        choices = [(rev.pk, str(rev)) for rev in pipeline.members.order_by("revision_number")]
        self.fields["pipeline"].choices = choices<commit_msg>Made pipeline revision default to latest verison (closes #168)<commit_after>"""
Forms for running a Pipeline.
"""

from django import forms
from pipeline.models import Pipeline, PipelineFamily
from librarian.models import SymbolicDataset

class PipelineSelectionForm(forms.Form):
    """Form for selecting a Pipeline to run."""
    pipeline = forms.ChoiceField()

    def __init__(self, *args, **kwargs):
        self.family_pk = kwargs.pop("pipeline_family_pk")
        super(PipelineSelectionForm, self).__init__(*args, **kwargs)

        pipeline = PipelineFamily.objects.get(pk=self.family_pk)
        self.family_name = pipeline.name
        choices = [(rev.pk, str(rev)) for rev in pipeline.members.order_by("revision_number")]
        self.fields["pipeline"].choices = choices
        self.fields["pipeline"].initial = choices[-1][0]
{'fraction_non_alphanumeric': 0.11753494282083862, 'fraction_numerical': 0.0031766200762388818, 'mean_word_length': 4.163934426229508, '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': '5254482', 'n_tokens_mistral': 447, 'n_tokens_neox': 451, 'n_words': 113}