<commit_before>package mesosphere.marathon

import org.rogach.scallop.ScallopConf
import java.net.InetSocketAddress

/**
 * @author <NAME>
 */

trait MarathonConfiguration extends ScallopConf {


  lazy val mesosMaster = opt[String]("master",
  descr = "The URL of the Mesos master",
  required = true,
  noshort = true)

  lazy val mesosFailoverTimeout = opt[Long]("failover_timeout",
  descr = "The failover_timeout for mesos in seconds",
  default = Some(3600L))

  lazy val highlyAvailable = opt[Boolean]("ha",
  descr = "Runs Marathon in HA mode with leader election." +
  "Allows starting an arbitrary number of other Marathons but all need to" +
  "be started in HA mode. This mode requires a running ZooKeeper",
  noshort = true, default = Some(true))

  lazy val zooKeeperHostString = opt[String]("zk_hosts",
  descr = "The list of ZooKeeper servers for storing state",
  default = Some("localhost:2181"))

  lazy val zooKeeperTimeout = opt[Long]("zk_timeout",
  descr = "The timeout for ZooKeeper in milliseconds",
  default = Some(10000L))

  lazy val zooKeeperPath = opt[String]("zk_state",
  descr = "Path in ZooKeeper for storing state",
  default = Some("/marathon"))

  lazy val localPortMin = opt[Int]("local_port_min",
    descr = "Min port number to use when assigning ports to apps",
    default = Some(10000))

  lazy val localPortMax = opt[Int]("local_port_max",
    descr = "Max port number to use when assigning ports to apps",
    default = Some(20000))

  def zooKeeperStatePath = "%s/state".format(zooKeeperPath())

  def zooKeeperLeaderPath = "%s/leader".format(zooKeeperPath())

  def zooKeeperServerSetPath = "%s/apps".format(zooKeeperPath())

  lazy val hostname = opt[String]("hostname",
    descr = "The advertised hostname stored in ZooKeeper so another standby" +
      "host can redirect to this elected leader",
    default = Some("localhost"))

  def zooKeeperHostAddresses : Seq[InetSocketAddress] = {
    zooKeeperHostString()
      .split(",")
      .map(x => { require(x.contains(":"), "expected host:port for zk servers");
           x.split(":") })
      .collect({ case Array(h,p) => new InetSocketAddress(h, p.toInt) })
  }
}<commit_msg>Clean up spacing and IDE errors in conf module.<commit_after>package mesosphere.marathon

import org.rogach.scallop.ScallopConf
import java.net.InetSocketAddress

/**
 * @author <NAME>
 */

trait MarathonConfiguration extends ScallopConf {


  lazy val mesosMaster = opt[String]("master",
    descr = "The URL of the Mesos master",
    required = true,
    noshort = true)

  lazy val mesosFailoverTimeout = opt[Long]("failover_timeout",
    descr = "The failover_timeout for mesos in seconds",
    default = Some(3600L))

  lazy val highlyAvailable = opt[Boolean]("ha",
    descr = "Runs Marathon in HA mode with leader election. " +
      "Allows starting an arbitrary number of other Marathons but all need " +
      "to be started in HA mode. This mode requires a running ZooKeeper",
    noshort = true, default = Some(true))

  lazy val zooKeeperHostString = opt[String]("zk_hosts",
    descr = "The list of ZooKeeper servers for storing state",
    default = Some("localhost:2181"))

  lazy val zooKeeperTimeout = opt[Long]("zk_timeout",
    descr = "The timeout for ZooKeeper in milliseconds",
    default = Some(10000L))

  lazy val zooKeeperPath = opt[String]("zk_state",
    descr = "Path in ZooKeeper for storing state",
    default = Some("/marathon"))

  lazy val localPortMin = opt[Int]("local_port_min",
    descr = "Min port number to use when assigning ports to apps",
    default = Some(10000))

  lazy val localPortMax = opt[Int]("local_port_max",
    descr = "Max port number to use when assigning ports to apps",
    default = Some(20000))

  def zooKeeperStatePath = "%s/state".format(zooKeeperPath())

  def zooKeeperLeaderPath = "%s/leader".format(zooKeeperPath())

  def zooKeeperServerSetPath = "%s/apps".format(zooKeeperPath())

  lazy val hostname = opt[String]("hostname",
    descr = "The advertised hostname stored in ZooKeeper so another standby " +
      "host can redirect to this elected leader",
    default = Some("localhost"))

  def zooKeeperHostAddresses: Seq[InetSocketAddress] =
    for (s <- zooKeeperHostString().split(",")) yield {
      val splits = s.split(":")
      require(splits.length == 2, "expected host:port for zk servers")
      new InetSocketAddress(splits(0), splits(1).toInt)
    }
}
{'fraction_non_alphanumeric': 0.1150022593764121, 'fraction_numerical': 0.011070944419340261, 'mean_word_length': 4.094361334867664, 'pattern_counts': {'":': 3, '<': 6, '<?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': '6613575', 'n_tokens_mistral': 1504, 'n_tokens_neox': 1383, 'n_words': 421}