<commit_before>"""Classy API view."""
import inspect
from .decorators import view
from flask.ext.classy import FlaskView
from werkzeug.routing import parse_rule

suffixes = ('Endpoint', 'View')


def route(rule=None, **options):
    """
    A decorator that is used to define custom routes for methods in FlaskView subclasses. The
    format is exactly the same as Flask's `@app.route` decorator. If ule is absent the name of the
    decorated function will be used.
    """
    options = options.copy()
    options.update({'rule': rule})

    def decorator(f):
        # Put the rule cache on the method itself instead of globally
        rule = options.pop('rule', None)
        if not rule:
            rule = '/{}/'.format(f.__name__)
        if not hasattr(f, '_rule_cache') or f._rule_cache is None:
            f._rule_cache = {f.__name__: [(rule, options)]}
        elif f.__name__ not in f._rule_cache:
            f._rule_cache[f.__name__] = [(rule, options)]
        else:
            f._rule_cache[f.__name__].append((rule, options))
        return f

    return decorator


class EndpointMeta(object):
    """Endpoint metadata class."""
<commit_msg>Coerce coverage.<commit_after>"""Classy API view."""
import inspect
from .decorators import view
from flask.ext.classy import FlaskView
from werkzeug.routing import parse_rule

suffixes = ('Endpoint', 'View')


def route(rule=None, **options):
    """
    A decorator that is used to define custom routes for methods in FlaskView subclasses. The
    format is exactly the same as Flask's `@app.route` decorator. If ule is absent the name of the
    decorated function will be used.
    """
    options = options.copy()
    options.update({'rule': rule})

    def decorator(f): # pragma: no cover
        # Put the rule cache on the method itself instead of globally
        rule = options.pop('rule', None)
        if not rule:
            rule = '/{}/'.format(f.__name__)
        if not hasattr(f, '_rule_cache') or f._rule_cache is None:
            f._rule_cache = {f.__name__: [(rule, options)]}
        elif f.__name__ not in f._rule_cache:
            f._rule_cache[f.__name__] = [(rule, options)]
        else:
            f._rule_cache[f.__name__].append((rule, options))
        return f

    return decorator


class EndpointMeta(object):
    """Endpoint metadata class."""

{'fraction_non_alphanumeric': 0.11210571184995738, 'fraction_numerical': 0.0, 'mean_word_length': 2.816260162601626, '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': '3796049', 'n_tokens_mistral': 698, 'n_tokens_neox': 682, 'n_words': 238}