<commit_before>"""URLs for the ``django-tinylinks`` app."""
from django.conf import settings
from django.conf.urls import include
from django.urls import re_path
from django.views.generic import RedirectView
from django.views.generic import TemplateView
from rest_framework.routers import DefaultRouter

from tinylinks.views import (
    StatisticsView,
    TinylinkCreateView,
    TinylinkDeleteView,
    TinylinkListView,
    TinylinkRedirectView,
    TinylinkUpdateView,
    TinylinkViewSet,
    UserViewSet,
    db_stats,
    stats,
    tinylink_stats,
    tinylink_expand,
)

# Create router and register our API viewsets with it.
router = DefaultRouter()
router.register(r"tinylinks", TinylinkViewSet)
router.register(r"users", UserViewSet)

urlpatterns = [
    re_path(r"^list/$", TinylinkListView.as_view(), name="tinylink_list"),
    re_path(r"^create/$", TinylinkCreateView.as_view(), name="tinylink_create"),
    re_path(
        r"^update/(?P<pk>\d+)/(?P<mode>[a-z-]+)/$",
        TinylinkUpdateView.as_view(),
        name="tinylink_update",
    ),
    re_path(
        r"^delete/(?P<pk>\d+)/$",
        TinylinkDeleteView.as_view(),
        name="tinylink_delete",
    ),
]

if getattr(settings, "TINYLINK_REDIRECT_404", None):<commit_msg>fix: add TINYLINK_API_PREFIX<commit_after>"""URLs for the ``django-tinylinks`` app."""
from django.conf import settings
from django.conf.urls import include
from django.urls import re_path
from django.views.generic import RedirectView
from django.views.generic import TemplateView
from rest_framework.routers import DefaultRouter

from tinylinks.views import (
    StatisticsView,
    TinylinkCreateView,
    TinylinkDeleteView,
    TinylinkListView,
    TinylinkRedirectView,
    TinylinkUpdateView,
    TinylinkViewSet,
    UserViewSet,
    db_stats,
    stats,
    tinylink_stats,
    tinylink_expand,
)

# Create router and register our API viewsets with it.
router = DefaultRouter()
router.register(
    r"{}".format(getattr(settings, "TINYLINK_API_PREFIX", "tinylinks")), TinylinkViewSet
)
router.register(r"users", UserViewSet)

urlpatterns = [
    re_path(r"^list/$", TinylinkListView.as_view(), name="tinylink_list"),
    re_path(r"^create/$", TinylinkCreateView.as_view(), name="tinylink_create"),
    re_path(
        r"^update/(?P<pk>\d+)/(?P<mode>[a-z-]+)/$",
        TinylinkUpdateView.as_view(),
        name="tinylink_update",
    ),
    re_path(
        r"^delete/(?P<pk>\d+)/$",
        TinylinkDeleteView.as_view(),
        name="tinylink_delete",
    ),
]

if getattr(settings, "TINYLINK_REDIRECT_404", None):
{'fraction_non_alphanumeric': 0.12858249419054996, 'fraction_numerical': 0.0023237800154918666, 'mean_word_length': 4.25, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4778592', 'n_tokens_mistral': 871, 'n_tokens_neox': 882, 'n_words': 160}