<commit_before>from django.conf.urls.defaults import patterns, include, url
from django.views.generic import DetailView
from toolkit.diary.models import Event


urlpatterns = patterns( 'toolkit.diary.views',
    # View lists of event for various time/dates
    url('^$', 'view_diary', name="default-view"),
    url('^(?P<year>\d{4})/?$', 'view_diary', name="year-view"),
    url('^(?P<year>\d{4})/(?P<month>\d{1,2})/?$', 'view_diary', name="month-view"),
    url('^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})', 'view_diary', name="day-view"),

    # View lists of events for editing:
    url('^edit/?$', 'edit_diary_list', name="default-edit", ),
    url('^edit/(?P<year>\d{4})/?$', 'edit_diary_list', name="year-edit", ),
    url('^edit/(?P<year>\d{4})/(?P<month>\d{1,2})/?$', 'edit_diary_list', name="month-edit", ),
    url('^edit/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})', 'edit_diary_list', name="day-edit", ),

    # View individual showing
    url('^showing/id/(?P<showing_id>\d+)$', 'view_showing', name="single-showing-view"),
    # All showings for a given event
    url('^event/id/(?P<event_id>\d+)$', 'view_event', name="single-event-view"),

    # Edit an event: view event before editing
    url('^edit/event/id/(?P<pk>\d+)/view$',
            DetailView.as_view(
                model=Event,
                template_name='event_edit_view.html'), name="edit-event-details-view"),
    # Edit an event
    url('^edit/event/id/(?P<event_id>\d+)$', 'edit_event', name="edit-event-details"),
    # Edit a showing (includes delete / add a new showing)
    url('^edit/showing/id/(?P<showing_id>\d+)$', 'edit_showing', name="edit-showing"),
    # Edit ideas
    url('^edit/ideas/(?P<year>\d{4})/(?P<month>\d{1,2})$', 'edit_ideas', name="edit-ideas"),
    # Add a new showing (to an existing event) - submission URL for edit-showing
    url('^add/event/id/(?P<event_id>\d+)/showing$', 'add_showing', name="add-showing"),
    # Delete a showin
    url('^edit/showing/id/(?P<showing_id>\d+)/delete$', 'delete_showing', name="delete-showing"),
    # Add a new event + showing
    url('^add/event$', 'add_event', name="add-event"),

    # View rota
    url("""rota(/|/(?P<year>\d{4})/(?P<month>\d{1,2})/?(?P<day>(?<=/)\d{0,2})/?)?$""", 'view_rota', name="view_rota"),
    # That slightly OTT regex will match:
    # "rota" "rota/" "rota/2001/01" "rota/2001/01/" "rota/2001/1/02" "rota/2001/1/2/"
)

<commit_msg>Fix mistakes in URL regexes shown by unit tests.<commit_after>from django.conf.urls.defaults import patterns, include, url
from django.views.generic import DetailView
from toolkit.diary.models import Event


urlpatterns = patterns( 'toolkit.diary.views',
    # View lists of event for various time/dates
    url('^$', 'view_diary', name="default-view"),
    url('^(?P<year>\d{4})/?$', 'view_diary', name="year-view"),
    url('^(?P<year>\d{4})/(?P<month>\d{1,2})/?$', 'view_diary', name="month-view"),
    url('^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})', 'view_diary', name="day-view"),

    # View lists of events for editing:
    url('^edit/?$', 'edit_diary_list', name="default-edit", ),
    url('^edit/(?P<year>\d{4})/?$', 'edit_diary_list', name="year-edit", ),
    url('^edit/(?P<year>\d{4})/(?P<month>\d{1,2})/?$', 'edit_diary_list', name="month-edit", ),
    url('^edit/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})', 'edit_diary_list', name="day-edit", ),

    # View individual showing
    url('^showing/id/(?P<showing_id>\d+)$', 'view_showing', name="single-showing-view"),
    # All showings for a given event
    url('^event/id/(?P<event_id>\d+)$', 'view_event', name="single-event-view"),

    # Edit an event: view event before editing
    url('^edit/event/id/(?P<pk>\d+)/view$',
            DetailView.as_view(
                model=Event,
                template_name='event_edit_view.html'), name="edit-event-details-view"),
    # Edit an event
    url('^edit/event/id/(?P<event_id>\d+)$', 'edit_event', name="edit-event-details"),
    # Edit a showing (includes delete / add a new showing)
    url('^edit/showing/id/(?P<showing_id>\d+)$', 'edit_showing', name="edit-showing"),
    # Edit ideas
    url('^edit/ideas/(?P<year>\d{4})/(?P<month>\d{1,2})$', 'edit_ideas', name="edit-ideas"),
    # Add a new showing (to an existing event) - submission URL for edit-showing
    url('^add/event/id/(?P<event_id>\d+)/showing$', 'add_showing', name="add-showing"),
    # Delete a showin
    url('^edit/showing/id/(?P<showing_id>\d+)/delete$', 'delete_showing', name="delete-showing"),
    # Add a new event + showing
    url('^add/event$', 'add_event', name="add-event"),

    # View rota
    url("""rota(/|/(?P<year>\d{4})/(?P<month>\d{1,2})/?(?P<day>(?<=/)\d{0,2})?/?)?$""", 'view_rota', name="view_rota"),
    # That slightly OTT regex will match:
    # "rota" "rota/" "rota/2001/01" "rota/2001/01/" "rota/2001/1/02" "rota/2001/1/2/"
    # (ie needs at least year/month, not just a year)
)


{'fraction_non_alphanumeric': 0.2488897860314897, 'fraction_numerical': 0.020589422688736373, 'mean_word_length': 4.113519091847265, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 51, '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': '1838736', 'n_tokens_mistral': 1998, 'n_tokens_neox': 1943, 'n_words': 317}