<commit_before>from django.conf import settings
from django.core.urlresolvers import RegexURLResolver, RegexURLPattern


class ApiDocumentation(object):
    excluded_apps = ["admin", "drfdocs"]
    root_urlconf = __import__(settings.ROOT_URLCONF)

    def __init__(self):
        self.view_names = []
        self.get_all_view_names(self.root_urlconf.urls.urlpatterns)

    def get_all_view_names(self, urlpatterns):
        for pattern in urlpatterns:
            if isinstance(pattern, RegexURLResolver) and (pattern.app_name not in self.excluded_apps):
                self.get_all_view_names(pattern.url_patterns)
            elif isinstance(pattern, RegexURLPattern):
                self.view_names.append(pattern.callback.__name__)

    def get_views(self):
        return self.view_names<commit_msg>Exclude "serve" view (static files)<commit_after>from django.conf import settings
from django.core.urlresolvers import RegexURLResolver, RegexURLPattern


class ApiDocumentation(object):
    excluded_apps = ["admin", "drfdocs"]
    excluded_endpoints = ["serve"]
    root_urlconf = __import__(settings.ROOT_URLCONF)

    def __init__(self):
        self.view_names = []
        self.get_all_view_names(self.root_urlconf.urls.urlpatterns)

    def get_all_view_names(self, urlpatterns):
        for pattern in urlpatterns:
            if isinstance(pattern, RegexURLResolver) and (pattern.app_name not in self.excluded_apps):
                self.get_all_view_names(pattern.url_patterns)
            elif isinstance(pattern, RegexURLPattern) and (pattern.callback.__name__ not in self.excluded_endpoints):
                self.view_names.append(pattern.callback.__name__)

    def get_views(self):
        return self.view_names
{'fraction_non_alphanumeric': 0.08419838523644751, 'fraction_numerical': 0.0, 'mean_word_length': 3.6143617021276597, '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': '7205815', 'n_tokens_mistral': 518, 'n_tokens_neox': 511, 'n_words': 98}