<commit_before>package com.yammer.dropwizard

import collection.{immutable, mutable}
import com.codahale.logula.Logging
import com.google.inject.{Stage, Guice, Module}
import com.yammer.dropwizard.modules.{ServerModule, RequestLogHandlerModule}
import com.yammer.dropwizard.cli.{ServerCommand, Command}
import util.JarAware

trait Service extends Logging with JarAware {
  private val modules = new mutable.ArrayBuffer[Module]() ++ Seq(new RequestLogHandlerModule, new ServerModule)

  protected def require(modules: Module*) { this.modules ++= modules }

  private var commands = new immutable.TreeMap[String, Command]
  protected def provide(commands: Command*) { commands.foreach { c => this.commands += c.name -> c } }
  provide(new ServerCommand(this))

  def name: String

  def banner: Option[String] = None

  protected lazy val injector = Guice.createInjector(Stage.PRODUCTION, modules.toArray: _*)

  private def printUsage(error: Option[String] = None) {
    for (msg <- error) {
      System.err.printf("%s\n\n", msg)
    }

    printf("%s <command> [arg1 arg2]\n\n", jarSyntax)


    println("Commands")
    println("========\n")
    for (cmd <- commands.values) {<commit_msg>Service doesn't need an injector any more.<commit_after>package com.yammer.dropwizard

import collection.{immutable, mutable}
import com.codahale.logula.Logging
import com.google.inject.Module
import com.yammer.dropwizard.modules.{ServerModule, RequestLogHandlerModule}
import com.yammer.dropwizard.cli.{ServerCommand, Command}
import util.JarAware

trait Service extends Logging with JarAware {
  private val modules = new mutable.ArrayBuffer[Module]() ++ Seq(new RequestLogHandlerModule, new ServerModule)

  protected def require(modules: Module*) { this.modules ++= modules }

  private var commands = new immutable.TreeMap[String, Command]
  protected def provide(commands: Command*) { commands.foreach { c => this.commands += c.name -> c } }
  provide(new ServerCommand(this))

  def name: String

  def banner: Option[String] = None

  private def printUsage(error: Option[String] = None) {
    for (msg <- error) {
      System.err.printf("%s\n\n", msg)
    }

    printf("%s <command> [arg1 arg2]\n\n", jarSyntax)


    println("Commands")
    println("========\n")
    for (cmd <- commands.values) {
{'fraction_non_alphanumeric': 0.12924281984334204, 'fraction_numerical': 0.0017406440382941688, 'mean_word_length': 4.580097087378641, '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': '5622805', 'n_tokens_mistral': 724, 'n_tokens_neox': 701, 'n_words': 178}