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

from django.conf.urls import patterns, url

from importer.views import (
    list_imports, create, show_tree_import_status, show_species_import_status,
    update_row, export_all_species, export_single_species_import,
    export_single_tree_import, merge_species, results, commit, update, solve,
    counts, find_similar_species)

admin.autodiscover()


_import_api_pattern = r'(?P<import_type>[a-z]+)/(?P<import_event_id>\d+)'


urlpatterns = patterns(
    '',
    url(r'^$', list_imports, name='list_imports'),
    url(r'^create$', create, name='create'),
    url(r'^status/tree/(?P<import_event_id>\d+)$', show_tree_import_status,
        name='show_tree_import_status'),
    url(r'^status/species/(?P<import_event_id>\d+)$',
        show_species_import_status, name='show_species_import_status'),
    url(r'^update/(?P<import_event_row_id>\d+)$', update_row,
        name='update_row'),

    url(r'^export/species/all', export_all_species, name='export_all_species'),
    url(r'^export/species/(?P<import_event_id>\d+)$',
        export_single_species_import, name='export_single_species_import'),
    url(r'^export/tree/(?P<import_event_id>\d+)$', export_single_tree_import,
        name='export_single_tree_import'),

    # API
    url(r'^api/merge$', merge_species, name='merge'),
    url(r'^api/%s/results/(?P<subtype>[a-zA-Z]+)$' % _import_api_pattern,
        results, name='results'),
    url(r'^api/%s/commit$' % _import_api_pattern, commit, name='commit'),
    url(r'^api/%s/update$' % _import_api_pattern, update, name='update'),
    url(r'^api/species/(?P<import_event_id>\d+)/(?P<import_row_idx>\d+)/solve$',  # NOQA
        solve, name='solve'),
    url(r'^api/counts', counts, name='counts'),
    url(r'^api/species/similar', find_similar_species,
        name='find_similar_species'),
)<commit_msg>Disable importer if feature is not enabled<commit_after># -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division

from django.conf.urls import patterns, url

from importer.views import (
    list_imports, create, show_tree_import_status, show_species_import_status,
    update_row, export_all_species, export_single_species_import,
    export_single_tree_import, merge_species, results, commit, update, solve,
    counts, find_similar_species)
from treemap.plugin import feature_enabled


_import_api_pattern = r'(?P<import_type>[a-z]+)/(?P<import_event_id>\d+)'


urlpatterns = patterns(
    '',
    url(r'^$', list_imports, name='list_imports'),
    url(r'^create$', create, name='create'),
    url(r'^status/tree/(?P<import_event_id>\d+)$', show_tree_import_status,
        name='show_tree_import_status'),
    url(r'^status/species/(?P<import_event_id>\d+)$',
        show_species_import_status, name='show_species_import_status'),
    url(r'^update/(?P<import_event_row_id>\d+)$', update_row,
        name='update_row'),

    url(r'^export/species/all', export_all_species, name='export_all_species'),
    url(r'^export/species/(?P<import_event_id>\d+)$',
        export_single_species_import, name='export_single_species_import'),
    url(r'^export/tree/(?P<import_event_id>\d+)$', export_single_tree_import,
        name='export_single_tree_import'),

    # API
    url(r'^api/merge$', merge_species, name='merge'),
    url(r'^api/%s/results/(?P<subtype>[a-zA-Z]+)$' % _import_api_pattern,
        results, name='results'),
    url(r'^api/%s/commit$' % _import_api_pattern, commit, name='commit'),
    url(r'^api/%s/update$' % _import_api_pattern, update, name='update'),
    url(r'^api/species/(?P<import_event_id>\d+)/(?P<import_row_idx>\d+)/solve$',  # NOQA
        solve, name='solve'),
    url(r'^api/counts', counts, name='counts'),
    url(r'^api/species/similar', find_similar_species,
        name='find_similar_species'),
)

if not feature_enabled(None, 'bulk_upload'):
    urlpatterns = patterns('')
{'fraction_non_alphanumeric': 0.16523023885742427, 'fraction_numerical': 0.0004924895345973898, 'mean_word_length': 5.356807511737089, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '5804071', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1403, 'n_words': 201}