<commit_before>from django import forms
import Bio.Phylo as bp
from phylocommons.get_treestore import get_treestore, tree_id_from_uri, uri_from_tree_id


class QueryForm(forms.Form):
    treestore = get_treestore()
    
    taxa = forms.CharField(required=True,
                           initial='Homo sapiens,Pan troglodytes,Pan paniscus,Gorilla gorilla,Pongo pygmaeus',
                           widget=forms.Textarea)
    taxa.widget.attrs['class'] = 'stretch'
    
    format_choices = sorted(bp._io.supported_formats.keys()) + ['ascii']
    format_choices = [(x,x) for x in format_choices] + [('view', '(open in tree viewer)')]
    format = forms.ChoiceField(choices=format_choices,
                               initial='newick'
                               )
    format.widget.attrs['class'] = 'stretch'
                               
    prune = forms.BooleanField(required=False, initial=True)
    
    match_all = forms.BooleanField(required=False, initial=False)
    
    tree_list = [tree_id_from_uri(x) for x in treestore.list_trees()]
    
    tree_choices = [('', '(Select automatically)')] + [(x,x) for x in tree_list]
    tree = forms.ChoiceField(choices=tree_choices,
                             initial=tree_choices[0],
                             required=False)
    tree.widget.attrs['class'] = 'combobox'<commit_msg>No longer selecting automatically since there's now a disambiguation step.<commit_after>from django import forms
import Bio.Phylo as bp
from phylocommons.get_treestore import get_treestore, tree_id_from_uri, uri_from_tree_id


class QueryForm(forms.Form):
    treestore = get_treestore()
    
    taxa = forms.CharField(required=True,
                           initial='Homo sapiens,Pan troglodytes,Pan paniscus,Gorilla gorilla,Pongo pygmaeus',
                           widget=forms.Textarea)
    taxa.widget.attrs['class'] = 'stretch'
    
    format_choices = sorted(bp._io.supported_formats.keys()) + ['ascii']
    format_choices = [(x,x) for x in format_choices] + [('view', '(open in tree viewer)')]
    format = forms.ChoiceField(choices=format_choices,
                               initial='newick'
                               )
    format.widget.attrs['class'] = 'stretch'
                               
    prune = forms.BooleanField(required=False, initial=True)
    
    match_all = forms.BooleanField(required=False, initial=False)
    
    tree_list = [tree_id_from_uri(x) for x in treestore.list_trees()]
    
    tree_choices = [('', '(see all matching trees)')] + [(x,x) for x in tree_list]
    tree = forms.ChoiceField(choices=tree_choices,
                             initial=tree_choices[0],
                             required=False)
    tree.widget.attrs['class'] = 'combobox'
{'fraction_non_alphanumeric': 0.10816696914700545, 'fraction_numerical': 0.0007259528130671506, 'mean_word_length': 2.432129514321295, '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': '764463', 'n_tokens_mistral': 866, 'n_tokens_neox': 837, 'n_words': 158}