<commit_before># -*- coding:utf-8 -*-
import sys
from pyramid.paster import bootstrap

def main():
    config = sys.argv[1]
    env = bootstrap(config)

    registry = env["registry"]
    introspector = registry.introspector

    print("{path:^25} {method:^6} {view_name:^20}".format(
        path="Path",
        method="Method",
        view_name="View"))
    print(u"--------------------------------------------------")

    for d in (introspector.get_category("views")):
        view = d["introspectable"]
        route = None
        for s, category_name, discriminator in view._relations:
            if s and category_name == "routes":
                route = introspector.get(category_name, discriminator)
                break

        if route:
            print("{path:<25} {method:<6} {view_name:<20}".format(
                path=route["pattern"],
                method=view["request_methods"] or "-",
                view_name=view_name(view["callable"], view["attr"])
            ))


def view_name(callable, attr):
    if hasattr(callable, "__name__"):
        name = callable.__name__
    else:
        name = callable.__class__.__name__
    if attr:
        name = name + "#" + attr
    return "{module}:{name}".format(
        module=callable.__module__,
        name=name)<commit_msg>tiny tweak<commit_after># -*- coding:utf-8 -*-
import sys
from pyramid.paster import bootstrap

def main():
    config = sys.argv[1]
    env = bootstrap(config)

    registry = env["registry"]
    introspector = registry.introspector

    print("{path:^40} {method:^6} {view_name:^20}".format(
        path="Path",
        method="Method",
        view_name="View"))
    print(u"--------------------------------------------------")

    for d in (introspector.get_category("views")):
        view = d["introspectable"]
        route = None
        for s, category_name, discriminator in view._relations:
            if s and category_name == "routes":
                route = introspector.get(category_name, discriminator)
                break

        if route:
            print("{path:<40} {method:<6} {view_name:<20}".format(
                path=route["pattern"],
                method=view["request_methods"] or "-",
                view_name=view_name(view["callable"], view["attr"])
            ))


def view_name(callable, attr):
    if hasattr(callable, "__name__"):
        name = callable.__name__
    else:
        name = callable.__class__.__name__
    if attr:
        name = name + "#" + attr
    return "{module}:{name}".format(
        module=callable.__module__,
        name=name)
{'fraction_non_alphanumeric': 0.17337936325278097, 'fraction_numerical': 0.009205983889528193, 'mean_word_length': 2.046728971962617, 'pattern_counts': {'":': 2, '<': 9, '<?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': '4008335', 'n_tokens_mistral': 793, 'n_tokens_neox': 748, 'n_words': 156}