<commit_before>package restling.restlet

import com.google.inject.Inject
import com.google.inject.Injector
import groovy.transform.CompileStatic
import org.restlet.Context
import org.restlet.resource.Finder
import org.restlet.resource.ServerResource
import org.restlet.routing.Router

/**
 * Responsible for providing routing information into the Restling application.
 */
@CompileStatic
abstract class RestlingRouter extends Router {

    @Inject
    Injector injector

    @Inject
    RestlingRouter(Context context) {
        super(context)
    }

    /**
     * Specifies that we use a {@link RestlingFinder}
     */
    Class<? extends Finder> finderClass = RestlingFinder

    /**
     * Constructs a {@link RestlingFinder} to provide an instance of {@code resourceClass}.
     *
     * @param resourceClass The class to be created
     * @return An instantiated and configured {@link RestlingFinder}
     */
    @Override
    Finder createFinder(Class<? extends ServerResource> resourceClass) {
        assert injector: "Need an injector to create the finder!"
        return new RestlingFinder(context, resourceClass, injector)
    }

    /**
     * This is the hook for performing initialization (such as calling {@code .attach})
     * for this router.
     */
    abstract void init() throws Exception;

}
<commit_msg>Allow the RestlingRouter to not take a context, but explode if we don't have one when we expect to<commit_after>package restling.restlet

import com.google.inject.Inject
import com.google.inject.Injector
import groovy.transform.CompileStatic
import org.restlet.Context
import org.restlet.resource.Finder
import org.restlet.resource.ServerResource
import org.restlet.routing.Router

/**
 * Responsible for providing routing information into the Restling application.
 */
@CompileStatic
abstract class RestlingRouter extends Router {

    @Inject
    Injector injector

    /**
     * Default constructor. Equivalent to calling @{link RestlingRouter#RestlingRouter(Context)} and passing in
     * {@code null}.
     */
    RestlingRouter() {
        this(null);
    }

    /**
     * Constructor for if you have a context you want to pass in.
     *
     * @param context The context to install; may be {@code null}
     */
    RestlingRouter(Context context) {
        super(context)
    }

    /**
     * Specifies that we use a {@link RestlingFinder}
     */
    Class<? extends Finder> finderClass = RestlingFinder

    /**
     * Constructs a {@link RestlingFinder} to provide an instance of {@code resourceClass}.
     *
     * @param resourceClass The class to be created
     * @return An instantiated and configured {@link RestlingFinder}
     */
    @Override
    Finder createFinder(Class<? extends ServerResource> resourceClass) {
        assert injector: "Need an injector to create the finder!"
        assert context: "Need a context to create the finder!"
        return new RestlingFinder(context, resourceClass, injector)
    }

    /**
     * This is the hook for performing initialization (such as calling {@code .attach})
     * for this router. {@link #setContext(Context)} will be called with a non-null context
     * before this method is called.
     */
    abstract void init() throws Exception;

}

{'fraction_non_alphanumeric': 0.08269289886258838, 'fraction_numerical': 0.0, 'mean_word_length': 3.1771501925545573, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7485301', 'n_tokens_mistral': 874, 'n_tokens_neox': 867, 'n_words': 306}