Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Change build to buildU for no arg component. | package com.github.ksoichiro.er
import japgolly.scalajs.react.vdom.prefix_<^._
import japgolly.scalajs.react.{ReactComponentB, ReactDOM}
import org.scalajs.dom.document
import scala.scalajs.js
import scalacss.Defaults._
import scalacss.ScalaCssReact._
object EntryPoint extends js.JSApp {
def main() = {
AppStyles.addToDocument()
val HelloMessage = ReactComponentB[Unit]("")
.render(_ => <.div(AppStyles.title, "Hello world"))
.build
ReactDOM.render(HelloMessage(""), document.getElementById("demo"))
}
}
| package com.github.ksoichiro.er
import japgolly.scalajs.react.vdom.prefix_<^._
import japgolly.scalajs.react.{ReactComponentB, ReactDOM}
import org.scalajs.dom.document
import scala.scalajs.js
import scalacss.Defaults._
import scalacss.ScalaCssReact._
object EntryPoint extends js.JSApp {
def main() = {
AppStyles.addToDocument()
val HelloMessage = ReactComponentB[Unit]("")
.render(_ => <.div(AppStyles.title, "Hello world"))
.buildU
ReactDOM.render(HelloMessage(), document.getElementById("demo"))
}
}
|
Add custome serializer for scala's BIgDecimal | package uk.gov.digital.ho.proving.financialstatus.api
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.{JsonSerializer, SerializerProvider}
class CustomSerializer extends JsonSerializer[BigDecimal] {
override def serialize(value: BigDecimal , jgen: JsonGenerator, provider: SerializerProvider ) {
// put your desired money style here
jgen.writeString(value.setScale(2, BigDecimal.RoundingMode.HALF_UP).toString())
}
}
| package uk.gov.digital.ho.proving.financialstatus.api
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.{JsonSerializer, SerializerProvider}
class CustomSerializer extends JsonSerializer[BigDecimal] {
override def serialize(value: BigDecimal , jgen: JsonGenerator, provider: SerializerProvider ) {
// Set the default BigDecimal serialization to 2 decimal places
jgen.writeString(value.setScale(2, BigDecimal.RoundingMode.HALF_UP).toString())
}
}
|
Add missing header from merge | package org.http4s.client.asynchttpclient
import java.util.concurrent.atomic.AtomicInteger
import _root_.io.netty.handler.codec.http.cookie.Cookie
import org.asynchttpclient.cookie.CookieStore
import org.asynchttpclient.uri.Uri
private[asynchttpclient] class NoOpCookieStore extends CookieStore {
private def empty: java.util.List[Cookie] = java.util.Collections.emptyList[Cookie]
override def add(uri: Uri, cookie: Cookie): Unit = ()
override def get(uri: Uri): java.util.List[Cookie] = empty
override def getAll(): java.util.List[Cookie] = empty
override def remove(pred: java.util.function.Predicate[Cookie]): Boolean = false
override def clear(): Boolean = false
override def evictExpired(): Unit = ()
private val counter = new AtomicInteger(0)
override def count(): Int = counter.get
override def decrementAndGet(): Int = counter.decrementAndGet()
override def incrementAndGet(): Int = counter.incrementAndGet()
}
| /*
* Copyright 2013-2020 http4s.org
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.http4s.client.asynchttpclient
import java.util.concurrent.atomic.AtomicInteger
import _root_.io.netty.handler.codec.http.cookie.Cookie
import org.asynchttpclient.cookie.CookieStore
import org.asynchttpclient.uri.Uri
private[asynchttpclient] class NoOpCookieStore extends CookieStore {
private def empty: java.util.List[Cookie] = java.util.Collections.emptyList[Cookie]
override def add(uri: Uri, cookie: Cookie): Unit = ()
override def get(uri: Uri): java.util.List[Cookie] = empty
override def getAll(): java.util.List[Cookie] = empty
override def remove(pred: java.util.function.Predicate[Cookie]): Boolean = false
override def clear(): Boolean = false
override def evictExpired(): Unit = ()
private val counter = new AtomicInteger(0)
override def count(): Int = counter.get
override def decrementAndGet(): Int = counter.decrementAndGet()
override def incrementAndGet(): Int = counter.incrementAndGet()
}
|
Add lucene and checksum packages to imports | import com.google.appengine.api.datastore.dev.LocalDatastoreService
import com.google.appengine.tools.development.ApiProxyLocalImpl
import com.google.apphosting.api.ApiProxy
import com.google.apphosting.api.ApiProxy.Environment
import java.io.File
object DatastoreService {
class GaeEnvironment(private val requestNamespace:String) extends Environment {
def this() = this("")
def getAppId = "Quotidian Specs"
def getVersionId = "1.0"
def getRequestNamespace = requestNamespace
def getAuthDomain = "gmail.com"
def isLoggedIn = throw new UnsupportedOperationException()
def getEmail = ""
def isAdmin = throw new UnsupportedOperationException()
def getAttributes = new java.util.HashMap[String,Object]()
}
val proxy = new ApiProxyLocalImpl(new File("./target/")){ }
val service = proxy.getService("datastore_v3").asInstanceOf[LocalDatastoreService]
def start = {
proxy.setProperty(LocalDatastoreService.NO_STORAGE_PROPERTY,true.toString)
ApiProxy.setEnvironmentForCurrentThread(new GaeEnvironment)
ApiProxy.setDelegate(proxy)
}
def stop = {
service.clearProfiles
proxy.stop
service.stop
ApiProxy.setDelegate(null)
ApiProxy.setEnvironmentForCurrentThread(null)
ApiProxy.clearEnvironmentForCurrentThread()
}
}
| import com.google.appengine.api.datastore.dev.LocalDatastoreService
import com.google.appengine.tools.development.ApiProxyLocalImpl
import com.google.apphosting.api.ApiProxy
import com.google.apphosting.api.ApiProxy.Environment
import java.io.File
import java.util.zip.{Checksum,CRC32}
import org.apache.lucene.index._
import org.apache.lucene.store._
import quotidian.search._
object DatastoreService {
class GaeEnvironment(private val requestNamespace:String) extends Environment {
def this() = this("")
def getAppId = "Quotidian Specs"
def getVersionId = "1.0"
def getRequestNamespace = requestNamespace
def getAuthDomain = "gmail.com"
def isLoggedIn = throw new UnsupportedOperationException()
def getEmail = ""
def isAdmin = throw new UnsupportedOperationException()
def getAttributes = new java.util.HashMap[String,Object]()
}
val proxy = new ApiProxyLocalImpl(new File("./target/")){ }
val service = proxy.getService("datastore_v3").asInstanceOf[LocalDatastoreService]
def start = {
proxy.setProperty(LocalDatastoreService.NO_STORAGE_PROPERTY,true.toString)
ApiProxy.setEnvironmentForCurrentThread(new GaeEnvironment)
ApiProxy.setDelegate(proxy)
}
def stop = {
service.clearProfiles
proxy.stop
service.stop
ApiProxy.setDelegate(null)
ApiProxy.setEnvironmentForCurrentThread(null)
ApiProxy.clearEnvironmentForCurrentThread()
}
}
|
Bump to latest ghpages and newer jekyll integration. | addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2")
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.10"
| addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2")
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.10"
|
Add coursier plugin to speed up build | resolvers += Resolver.url("artifactory-sbt-plugin-releases",
new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
resolvers += Classpaths.sbtPluginReleases
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
| resolvers += Resolver.url("artifactory-sbt-plugin-releases",
new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
resolvers += Classpaths.sbtPluginReleases
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC5")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
|
Determine Play's version depending on Scala Version | lazy val root = (project in file(".")).enablePlugins(SbtWeb)
libraryDependencies ++= Seq(
"org.webjars.bower" % "bootstrap-sass" % "3.3.6",
"org.webjars" %% "webjars-play" % "2.6.2"
)
| lazy val root = (project in file(".")).enablePlugins(SbtWeb)
lazy val playVersion = settingKey[String]("Play version in relation to current Scala Version")
playVersion := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) => "2.4.0-2"
case Some((2, n)) if n > 10 => "2.6.2"
}
}
libraryDependencies ++= Seq(
"org.webjars.bower" % "bootstrap-sass" % "3.3.6",
"org.webjars" %% "webjars-play" % playVersion.value
)
|
Rename error handler method in components trait | package org.webjars.play
import controllers.AssetsMetadata
import play.api.http.HttpErrorHandler
import play.api.{Configuration, Environment}
/**
* Compile-time DI components
*/
trait WebJarComponents {
def configuration: Configuration
def environment: Environment
def errorHandler: HttpErrorHandler
def assetsMetadata: AssetsMetadata
lazy val webJarsUtil = new WebJarsUtil(configuration, environment)
lazy val webJarAssets = new WebJarAssets(errorHandler, assetsMetadata)
}
| package org.webjars.play
import controllers.AssetsMetadata
import play.api.http.HttpErrorHandler
import play.api.{Configuration, Environment}
/**
* Compile-time DI components
*/
trait WebJarComponents {
def configuration: Configuration
def environment: Environment
def httpErrorHandler: HttpErrorHandler
def assetsMetadata: AssetsMetadata
lazy val webJarsUtil = new WebJarsUtil(configuration, environment)
lazy val webJarAssets = new WebJarAssets(httpErrorHandler, assetsMetadata)
}
|
Fix race condition on Windows by consolidating two file writes | package scoverage
import java.io.FileWriter
/** @author Stephen Samuel */
object Invoker {
def invoked(id: Int, path: String) = {
val writer = new FileWriter(path, true)
writer.append(id.toString)
writer.append(';')
writer.close()
}
}
| package scoverage
import java.io.FileWriter
/** @author Stephen Samuel */
object Invoker {
/**
* We record that the given id has been invoked by appending its id to the coverage
* data file.
* This will happen concurrently on as many threads as the application is using,
* but appending small amounts of data to a file is atomic on both POSIX and Windows
* if it is a single write of a small enough string.
*
* @see http://stackoverflow.com/questions/1154446/is-file-append-atomic-in-unix
* @see http://stackoverflow.com/questions/3032482/is-appending-to-a-file-atomic-with-windows-ntfs
*/
def invoked(id: Int, path: String) = {
val writer = new FileWriter(path, true)
writer.append(id.toString + ';')
writer.close()
}
}
|
Add helper to get Common Names from certificate | package io.mediachain.signatures
import java.security.cert.X509Certificate
import javax.security.auth.x500.X500Principal
object CertificateUtil {
def canonicalName(cert: X509Certificate): String =
cert.getSubjectX500Principal.getName(X500Principal.CANONICAL)
}
| package io.mediachain.signatures
import java.security.cert.X509Certificate
import javax.security.auth.x500.X500Principal
import org.bouncycastle.asn1.x500.X500Name
import org.bouncycastle.asn1.x500.style.{BCStyle, IETFUtils}
object CertificateUtil {
def canonicalName(cert: X509Certificate): String =
cert.getSubjectX500Principal.getName(X500Principal.CANONICAL)
def commonNames(cert: X509Certificate): List[String] = {
val name = new X500Name(cert.getSubjectX500Principal.getName)
val rdns = name.getRDNs(BCStyle.CN)
rdns.map(IETFUtils.valueToString).toList
}
}
|
Add 'shutdown' method to connection factory | /*
* Copyright 2016 Krzysztof Pado
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.rdbc.sapi
import scala.concurrent.Future
/** Provides access to a database [[Connection]].
*
* Implementors are encouraged to make the implementation of this trait thread-safe.
*/
trait ConnectionFactory {
/** Returns a type converter registry that will be configured for connections produced by this factory */
def typeConverterRegistry: TypeConverterRegistry
/** Returns a future of a [[Connection]].
*
* Future can fail with subclasses of [[io.rdbc.api.exceptions.ConnectException]]. //TODO describe subclasses
*/
def connection(): Future[Connection]
}
| /*
* Copyright 2016 Krzysztof Pado
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.rdbc.sapi
import scala.concurrent.Future
/** Provides access to a database [[Connection]].
*
* Implementors are encouraged to make the implementation of this trait thread-safe.
*/
trait ConnectionFactory {
/** Returns a type converter registry that will be configured for connections produced by this factory */
def typeConverterRegistry: TypeConverterRegistry
/** Returns a future of a [[Connection]].
*
* Future can fail with subclasses of [[io.rdbc.api.exceptions.ConnectException]]. //TODO describe subclasses
*/
def connection(): Future[Connection]
/** Shuts down this connection factory.
*
* Returned future never fails - it completes on finished shutdown attempt.
* After the factory is shut down it is illegal to request new connections from it.
*/
def shutdown(): Future[Unit]
}
|
Fix the file path in test | package org.phenoscape.kb
object MatrixRendererTest extends App {
val innerMap: Map[Any, Boolean] = Map("y1" -> true, "y2" -> false, "y3" -> true)
val outerMap: Map[Any, Map[Any, Boolean]] = Map("y1" -> innerMap, "y2" -> innerMap, "y3" -> innerMap)
val outputString = Similarity.matrixRendererFromMapOfMaps(outerMap)
println(outputString)
} | package org.phenoscape.kb
object MatrixRendererTest extends App {
val innerMap: Map[Any, Boolean] = Map("y1" -> true, "y2" -> false, "y3" -> true)
val outerMap: Map[Any, Map[Any, Boolean]] = Map("y1" -> innerMap, "y2" -> innerMap, "y3" -> innerMap)
val outputString = AnatomicalEntity.matrixRendererFromMapOfMaps(DependencyMatrix(outerMap))
println(outputString)
} |
Remove the Ratio case class | package de.theunknownxy.jgui.layout
sealed trait Policy
case class Expanding()
case class Fixed(value: Float)
case class Ratio(value: Float)
| package de.theunknownxy.jgui.layout
sealed trait Policy
case class Expanding(importance: Float)
case class Fixed(value: Float)
|
Swap results to get proper actual vs. expected order | package ingraph.tests
import org.scalatest.FunSuite
class BiValidationTest extends FunSuite {
//val testCases: Seq[LdbcSnbTestCase] = Seq(2, 3, 4, 6, 7, 8, 9, 12, 15, 17, 23, 24) map (new LdbcSnbTestCase("bi", _))
val testCases: Seq[LdbcSnbTestCase] = Seq(2, 4, 6, 7, 8, 9, 12) map (new LdbcSnbTestCase("bi", _))
testCases.foreach {
tc =>
test(s"${tc.name}") {
val neo4jResults = TestRunners.neo4jTestRunner(tc)
val ingraphResults = TestRunners.ingraphTestRunner(tc)
println("neo4j results: " + neo4jResults .map(x => x.toSeq.sortBy(_._1)))
println("ingraph results: " + ingraphResults.map(x => x.toSeq.sortBy(_._1)))
// println(tc.parameters.mkString("Parameters: (\n\t", "\n\t", "\n)"))
// println(neo4jResult.mkString("Results: (\n\t", "\n\t", "\n)"))
assert(neo4jResults == ingraphResults)
}
}
}
| package ingraph.tests
import org.scalatest.FunSuite
class BiValidationTest extends FunSuite {
//val testCases: Seq[LdbcSnbTestCase] = Seq(2, 3, 4, 6, 7, 8, 9, 12, 15, 17, 23, 24) map (new LdbcSnbTestCase("bi", _))
val testCases: Seq[LdbcSnbTestCase] = Seq(2, 4, 6, 7, 8, 9, 12) map (new LdbcSnbTestCase("bi", _))
testCases.foreach {
tc =>
test(s"${tc.name}") {
val neo4jResults = TestRunners.neo4jTestRunner(tc)
val ingraphResults = TestRunners.ingraphTestRunner(tc)
println("neo4j results: " + neo4jResults .map(x => x.toSeq.sortBy(_._1)))
println("ingraph results: " + ingraphResults.map(x => x.toSeq.sortBy(_._1)))
// println(tc.parameters.mkString("Parameters: (\n\t", "\n\t", "\n)"))
// println(neo4jResult.mkString("Results: (\n\t", "\n\t", "\n)"))
assert(ingraphResults == neo4jResults)
}
}
}
|
Add an implicit class tag to work around errors | package uk.ac.wellcome.platform.transformer.transformers
import org.scalatest.Matchers
import uk.ac.wellcome.models.transformable.Transformable
import uk.ac.wellcome.models.work.internal.UnidentifiedWork
trait TransformableTestBase[T <: Transformable] extends Matchers {
val transformer: TransformableTransformer[T]
def transformToWork(transformable: T): UnidentifiedWork = {
val triedMaybeWork = transformer.transform(transformable, version = 1)
if (triedMaybeWork.isFailure) triedMaybeWork.failed.get.printStackTrace()
triedMaybeWork.isSuccess shouldBe true
triedMaybeWork.get.get
}
def assertTransformToWorkFails(transformable: T): Unit = {
transformer
.transform(transformable, version = 1)
.isSuccess shouldBe false
}
}
| package uk.ac.wellcome.platform.transformer.transformers
import org.scalatest.Matchers
import uk.ac.wellcome.models.transformable.Transformable
import uk.ac.wellcome.models.work.internal.UnidentifiedWork
import scala.reflect.ClassTag
/** Utilities for transformer tests.
*
* @@AWLC: when I first wrote this code, I got the following error:
*
* TransformableTestBase.scala:12:47: No ClassTag available for T
* val triedMaybeWork = transformer.transform(transformable, version = 1)
* ↑
*
* The addition of the implicit ClassTag[T] is working around this error.
* In general reflection is icky, but it's only in tests so I think this
* is okay.
*/
trait TransformableTestBase[T <: Transformable] extends Matchers {
val transformer: TransformableTransformer[T]
def transformToWork(transformable: T)(implicit c: ClassTag[T]): UnidentifiedWork = {
val triedMaybeWork = transformer.transform(transformable, version = 1)
if (triedMaybeWork.isFailure) triedMaybeWork.failed.get.printStackTrace()
triedMaybeWork.isSuccess shouldBe true
triedMaybeWork.get.get
}
def assertTransformToWorkFails(transformable: T)(implicit c: ClassTag[T]): Unit = {
transformer
.transform(transformable, version = 1)
.isSuccess shouldBe false
}
}
|
Update jackson-databind to 2.13.4.2 in master | import sbt._
import Keys._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
object Dependencies {
lazy val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.3.1" % "test"
lazy val jodaTime = Seq(
"joda-time" % "joda-time" % "2.12.0",
"org.joda" % "joda-convert" % "2.2.2"
)
lazy val jackson = Seq(
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4"
)
lazy val scalaz_core = Def.setting(
"org.scalaz" %%% "scalaz-core" % "7.3.6"
)
lazy val paranamer = "com.thoughtworks.paranamer" % "paranamer" % "2.8"
lazy val scalatest = Def.setting(
Seq("org.scalatest" %%% "scalatest-wordspec" % "3.2.14" % "test")
)
lazy val scalatestScalacheck = Def.setting(
Seq("org.scalatestplus" %%% "scalacheck-1-17" % "3.2.14.0" % "test")
)
lazy val scalaXml = Def.setting {
"org.scala-lang.modules" %%% "scala-xml" % "2.1.0"
}
}
| import sbt._
import Keys._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
object Dependencies {
lazy val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.3.1" % "test"
lazy val jodaTime = Seq(
"joda-time" % "joda-time" % "2.12.0",
"org.joda" % "joda-convert" % "2.2.2"
)
lazy val jackson = Seq(
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.2"
)
lazy val scalaz_core = Def.setting(
"org.scalaz" %%% "scalaz-core" % "7.3.6"
)
lazy val paranamer = "com.thoughtworks.paranamer" % "paranamer" % "2.8"
lazy val scalatest = Def.setting(
Seq("org.scalatest" %%% "scalatest-wordspec" % "3.2.14" % "test")
)
lazy val scalatestScalacheck = Def.setting(
Seq("org.scalatestplus" %%% "scalacheck-1-17" % "3.2.14.0" % "test")
)
lazy val scalaXml = Def.setting {
"org.scala-lang.modules" %%% "scala-xml" % "2.1.0"
}
}
|
Fix getConsole to choose active console | package intellij.haskell.runconfig.console
import java.util.concurrent.ConcurrentHashMap
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import intellij.haskell.HaskellFile
import scala.collection.JavaConverters._
object HaskellConsoleViewMap {
private val consoleViews = new ConcurrentHashMap[Editor, HaskellConsoleView]().asScala
def addConsole(console: HaskellConsoleView) {
consoleViews.put(console.getConsoleEditor, console)
}
def delConsole(console: HaskellConsoleView) {
consoleViews.remove(console.getConsoleEditor)
}
def getConsole(editor: Editor): Option[HaskellConsoleView] = {
consoleViews.get(editor)
}
def getConsole(editor: Project): Option[HaskellConsoleView] = {
consoleViews.values.find(_.project == editor)
}
// File is project file and not file which represents console
val projectFileByConfigName = new ConcurrentHashMap[String, HaskellFile]().asScala
}
| package intellij.haskell.runconfig.console
import java.util.concurrent.ConcurrentHashMap
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import intellij.haskell.HaskellFile
import scala.collection.JavaConverters._
object HaskellConsoleViewMap {
private val consoleViews = new ConcurrentHashMap[Editor, HaskellConsoleView]().asScala
def addConsole(console: HaskellConsoleView) {
consoleViews.put(console.getConsoleEditor, console)
}
def delConsole(console: HaskellConsoleView) {
consoleViews.remove(console.getConsoleEditor)
}
def getConsole(editor: Editor): Option[HaskellConsoleView] = {
consoleViews.get(editor)
}
def getConsole(editor: Project): Option[HaskellConsoleView] = {
consoleViews.values.find(console => console.project == editor && console.isShowing)
}
// File is project file and not file which represents console
val projectFileByConfigName = new ConcurrentHashMap[String, HaskellFile]().asScala
}
|
Make buffering test more resilient | package sttp.client.testing.websocket
import java.nio.channels.ClosedChannelException
import org.scalatest.Suite
import org.scalatest.flatspec.AsyncFlatSpecLike
import sttp.capabilities.WebSockets
import sttp.client.testing.HttpTest.wsEndpoint
import sttp.client._
import sttp.monad.MonadError
import sttp.client.testing.ConvertToFuture
import scala.concurrent.duration._
import scala.concurrent.duration.FiniteDuration
import sttp.monad.syntax._
import sttp.ws.WebSocket
trait WebSocketBufferOverflowTest[F[_]] { outer: Suite with AsyncFlatSpecLike with WebSocketTest[F] =>
val backend: SttpBackend[F, WebSockets]
implicit val monad: MonadError[F]
implicit val convertToFuture: ConvertToFuture[F]
def bufferCapacity: Int
it should "error if incoming messages overflow the buffer" in {
basicRequest
.get(uri"$wsEndpoint/ws/echo")
.response(asWebSocketAlways { (ws: WebSocket[F]) =>
send(ws, bufferCapacity + 100).flatMap { _ =>
eventually(10.millis, 500) {
ws.isOpen().map(_ shouldBe false)
}
}
})
.send(backend)
.map(_.body)
.handleError {
case _: ClosedChannelException => succeed.unit
}
.toFuture()
}
def eventually[T](interval: FiniteDuration, attempts: Int)(f: => F[T]): F[T]
}
| package sttp.client.testing.websocket
import java.nio.channels.ClosedChannelException
import org.scalatest.Suite
import org.scalatest.flatspec.AsyncFlatSpecLike
import sttp.capabilities.WebSockets
import sttp.client.testing.HttpTest.wsEndpoint
import sttp.client._
import sttp.monad.MonadError
import sttp.client.testing.ConvertToFuture
import scala.concurrent.duration._
import scala.concurrent.duration.FiniteDuration
import sttp.monad.syntax._
import sttp.ws.WebSocket
trait WebSocketBufferOverflowTest[F[_]] { outer: Suite with AsyncFlatSpecLike with WebSocketTest[F] =>
val backend: SttpBackend[F, WebSockets]
implicit val monad: MonadError[F]
implicit val convertToFuture: ConvertToFuture[F]
def bufferCapacity: Int
it should "error if incoming messages overflow the buffer" in {
basicRequest
.get(uri"$wsEndpoint/ws/echo")
.response(asWebSocketAlways { (ws: WebSocket[F]) =>
send(ws, bufferCapacity * 2).flatMap { _ =>
eventually(10.millis, 500) {
ws.isOpen().map(_ shouldBe false)
}
}
})
.send(backend)
.map(_.body)
.handleError {
case _: ClosedChannelException => succeed.unit
}
.toFuture()
}
def eventually[T](interval: FiniteDuration, attempts: Int)(f: => F[T]): F[T]
}
|
Remove SimpleResult and no more argument for request.jwtSession | package controllers
import scala.concurrent.Future
import play.api.libs.concurrent.Execution.Implicits._
import play.api.mvc._
import play.api.mvc.Results._
import play.api.libs.json._
import pdi.scala.jwt._
import models.User
class AuthenticatedRequest[A](val user: User, request: Request[A]) extends WrappedRequest[A](request)
trait Secured {
def Authenticated = AuthenticatedAction
def Admin = AdminAction
}
object AuthenticatedAction extends ActionBuilder[AuthenticatedRequest] {
def invokeBlock[A](request: Request[A], block: AuthenticatedRequest[A] => Future[SimpleResult]) =
request.jwtSession(request).getAs[User]("user") match {
case Some(user) => block(new AuthenticatedRequest(user, request)).map(_.refreshJwtSession(request))
case _ => Future.successful(Unauthorized)
}
}
object AdminAction extends ActionBuilder[AuthenticatedRequest] {
def invokeBlock[A](request: Request[A], block: AuthenticatedRequest[A] => Future[SimpleResult]) =
request.jwtSession(request).getAs[User]("user") match {
case Some(user) if user.isAdmin => block(new AuthenticatedRequest(user, request)).map(_.refreshJwtSession(request))
case Some(_) => Future.successful(Forbidden.refreshJwtSession(request))
case _ => Future.successful(Unauthorized)
}
}
| package controllers
import scala.concurrent.Future
import play.api.libs.concurrent.Execution.Implicits._
import play.api.mvc._
import play.api.mvc.Results._
import play.api.libs.json._
import pdi.scala.jwt._
import models.User
class AuthenticatedRequest[A](val user: User, request: Request[A]) extends WrappedRequest[A](request)
trait Secured {
def Authenticated = AuthenticatedAction
def Admin = AdminAction
}
object AuthenticatedAction extends ActionBuilder[AuthenticatedRequest] {
def invokeBlock[A](request: Request[A], block: AuthenticatedRequest[A] => Future[Result]) =
request.jwtSession.getAs[User]("user") match {
case Some(user) => block(new AuthenticatedRequest(user, request)).map(_.refreshJwtSession(request))
case _ => Future.successful(Unauthorized)
}
}
object AdminAction extends ActionBuilder[AuthenticatedRequest] {
def invokeBlock[A](request: Request[A], block: AuthenticatedRequest[A] => Future[Result]) =
request.jwtSession.getAs[User]("user") match {
case Some(user) if user.isAdmin => block(new AuthenticatedRequest(user, request)).map(_.refreshJwtSession(request))
case Some(_) => Future.successful(Forbidden.refreshJwtSession(request))
case _ => Future.successful(Unauthorized)
}
}
|
Update www to compile w/ new container types | package lib
import com.gilt.apidocgenerator.models.Container
case class ExampleService(key: String) {
val docsUrl = s"/gilt/$key/latest"
val apiJsonUrl = s"/gilt/$key/latest/api.json"
}
object Util {
val AddServiceText = "Add Service"
val OrgSettingsText = "Org Settings"
val ApidocExample = ExampleService("apidoc")
val ApidocGeneratorExample = ExampleService("apidoc-generator")
val ApidocSpecExample = ExampleService("apidoc-spec")
val Examples = Seq(ApidocExample, ApidocGeneratorExample, ApidocSpecExample)
val GitHubUrl = "https://github.com/gilt/apidoc"
def calculateNextVersion(version: String): String = {
version.split(VersionTag.Dash).size match {
case 1 => {
val pieces = version.split(VersionTag.Dot)
if (pieces.forall(s => VersionTag.isDigit(s))) {
(Seq(pieces.last.toInt + 1) ++ pieces.reverse.drop(1)).reverse.mkString(".")
} else {
version
}
}
case _ => version
}
}
def formatType(container: Container, name: String) = {
container match {
case Container.Singleton => name
case Container.List => s"[$name]"
case Container.Map => s"map[$name]"
case Container.UNDEFINED(container) => s"$container[$name]"
}
}
}
| package lib
import com.gilt.apidocgenerator.models.Container
case class ExampleService(key: String) {
val docsUrl = s"/gilt/$key/latest"
val apiJsonUrl = s"/gilt/$key/latest/api.json"
}
object Util {
val AddServiceText = "Add Service"
val OrgSettingsText = "Org Settings"
val ApidocExample = ExampleService("apidoc")
val ApidocGeneratorExample = ExampleService("apidoc-generator")
val ApidocSpecExample = ExampleService("apidoc-spec")
val Examples = Seq(ApidocExample, ApidocGeneratorExample, ApidocSpecExample)
val GitHubUrl = "https://github.com/gilt/apidoc"
def calculateNextVersion(version: String): String = {
version.split(VersionTag.Dash).size match {
case 1 => {
val pieces = version.split(VersionTag.Dot)
if (pieces.forall(s => VersionTag.isDigit(s))) {
(Seq(pieces.last.toInt + 1) ++ pieces.reverse.drop(1)).reverse.mkString(".")
} else {
version
}
}
case _ => version
}
}
def formatType(container: Container, name: String) = {
container match {
case Container.Singleton => name
case Container.List => s"[$name]"
case Container.Map => s"map[$name]"
case Container.Union => s"union[$name]"
case Container.Option => s"option[$name]"
case Container.UNDEFINED(container) => s"$container[$name]"
}
}
}
|
Archive up to a year of data. | package org.fusesource.fabric.monitor.plugins
/**
* Builds the default monitor set for a typical JVM
*/
class DefaultJvmMonitorSetBuilder extends MonitorSetBuilder("JvmStatistics") {
def configure {
archive("5m")
/*
TODO can we support more than one archive???
archive("24h", "1m")
archive("30d", "1h")
archive("1y", "1d")
*/
jmxDataSources(
// heap
"java.lang:name=Par Survivor Space,type=MemoryPool/Usage/used" -> "jvm.heap.parSurvivor",
"java.lang:name=CMS Old Gen,type=MemoryPool/Usage/used" -> "jvm.heap.cmsOldGen",
"java.lang:name=Par Eden Space,type=MemoryPool/Usage/used" -> "jvm.heap.ParEden",
// non heap
"java.lang:name=CMS Perm Gen,type=MemoryPool/Usage/used" -> "jvm.nonHeap.cmsPerm",
"java.lang:name=Code Cache,type=MemoryPool/Usage/used" -> "jvm.nonHeap.code",
// memory summaries
"java.lang:type=Memory/HeapMemoryUsage/used" -> "jvm.heap.summary",
"java.lang:type=Memory/NonHeapMemoryUsage/used" -> "jvm.nonHeap.summary",
// other stuff
"java.lang:type=Threading/ThreadCount" -> "jvm.threading.count"
)
}
} | package org.fusesource.fabric.monitor.plugins
/**
* Builds the default monitor set for a typical JVM
*/
class DefaultJvmMonitorSetBuilder extends MonitorSetBuilder("JvmStatistics") {
def configure {
archive("5m")
archive("24h", "1m")
archive("1y", "1h")
/*
TODO can we support more than one archive???
archive("24h", "1m")
archive("30d", "1h")
archive("1y", "1d")
*/
jmxDataSources(
// heap
"java.lang:name=Par Survivor Space,type=MemoryPool/Usage/used" -> "jvm.heap.parSurvivor",
"java.lang:name=CMS Old Gen,type=MemoryPool/Usage/used" -> "jvm.heap.cmsOldGen",
"java.lang:name=Par Eden Space,type=MemoryPool/Usage/used" -> "jvm.heap.ParEden",
// non heap
"java.lang:name=CMS Perm Gen,type=MemoryPool/Usage/used" -> "jvm.nonHeap.cmsPerm",
"java.lang:name=Code Cache,type=MemoryPool/Usage/used" -> "jvm.nonHeap.code",
// memory summaries
"java.lang:type=Memory/HeapMemoryUsage/used" -> "jvm.heap.summary",
"java.lang:type=Memory/NonHeapMemoryUsage/used" -> "jvm.nonHeap.summary",
// other stuff
"java.lang:type=Threading/ThreadCount" -> "jvm.threading.count"
)
}
} |
Set the default window to 60 seconds | package intelmedia.ws.funnel {
import scala.concurrent.duration._
package object instruments extends Instruments(5 minutes, Monitoring.default) with DefaultKeys {
JVM.instrument(this)
Clocks.instrument(this)
}
}
package intelmedia.ws {
import scalaz.concurrent.Task
import scalaz.stream.Process
package object funnel {
type DatapointParser = java.net.URL => Process[Task,Datapoint[Any]]
}
} | package intelmedia.ws.funnel {
import scala.concurrent.duration._
package object instruments extends Instruments(1 minute, Monitoring.default) with DefaultKeys {
JVM.instrument(this)
Clocks.instrument(this)
}
}
package intelmedia.ws {
import scalaz.concurrent.Task
import scalaz.stream.Process
package object funnel {
type DatapointParser = java.net.URL => Process[Task,Datapoint[Any]]
}
}
|
Use JavaScript `Crypto` API to produce `random()` | package org.orbeon.oxf.xforms.library
import org.orbeon.macros.XPathFunction
import org.orbeon.oxf.xml.OrbeonFunctionLibrary
import org.orbeon.saxon.function.RandomSupport
trait CryptoFunctions extends OrbeonFunctionLibrary {
@XPathFunction
def random(isSeed: Boolean = true): Double =
RandomSupport.evaluate(isSeed = true)
}
| package org.orbeon.oxf.xforms.library
import org.orbeon.macros.XPathFunction
import org.orbeon.oxf.xml.OrbeonFunctionLibrary
import org.scalajs.dom.crypto.GlobalCrypto
import scala.scalajs.js.typedarray.{DataView, Int8Array}
trait CryptoFunctions extends OrbeonFunctionLibrary {
@XPathFunction
def random(isSeed: Boolean = true): Double =
CryptoFunctions.random()
}
object CryptoFunctions {
def random(): Double = {
val ints = new Int8Array(8)
GlobalCrypto.crypto.getRandomValues(ints)
// https://stackoverflow.com/questions/34575635/cryptographically-secure-float
ints(7) = 63
ints(6) = (ints(6) | 0xf0).toByte
new DataView(ints.buffer).getFloat64(0, littleEndian = true) - 1
}
} |
Make sure an empty list stays as an empty list | package uk.ac.wellcome.platform.common
import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.models.Work
import uk.ac.wellcome.utils.JsonUtil
class WorkTest extends FunSpec with Matchers {
it("should have an LD type 'Work' when serialised to JSON") {
val work = Work(
identifiers=List(),
label="A book about a blue whale"
)
val jsonString = JsonUtil.toJson(work).get
jsonString.contains("""type":"Work"""") should be (true)
}
}
class JsonUtilTest extends FunSpec with Matchers {
it("should not include fields where the value is empty or None") {
val work = Work(
identifiers=List(),
label="A haiku about a heron"
)
val jsonString = JsonUtil.toJson(work).get
jsonString.contains(""""accessStatus":null""") should be (false)
jsonString.contains(""""identifiers":[]""") should be (false)
}
}
| package uk.ac.wellcome.platform.common
import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.models.Work
import uk.ac.wellcome.utils.JsonUtil
class WorkTest extends FunSpec with Matchers {
it("should have an LD type 'Work' when serialised to JSON") {
val work = Work(
identifiers=List(),
label="A book about a blue whale"
)
val jsonString = JsonUtil.toJson(work).get
jsonString.contains("""type":"Work"""") should be (true)
}
}
class JsonUtilTest extends FunSpec with Matchers {
it("should not include fields where the value is empty or None") {
val work = Work(
identifiers=List(),
label="A haiku about a heron"
)
val jsonString = JsonUtil.toJson(work).get
jsonString.contains(""""accessStatus":null""") should be (false)
jsonString.contains(""""identifiers":[]""") should be (false)
}
it("should round-trip an empty list back to an empty list") {
val jsonString = """{"accessStatus": [], "label": "A doodle of a dog"}"""
val parsedWork = JsonUtil.fromJson[Work](jsonString).get
val extrapolatedString = JsonUtil.toJson(parsedWork).get
jsonString.contains(""""accessStatus": []""") shouldBe true
}
}
|
Update configuration to record version 0.3.10 | name := "apibuilder-validation"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.8"
crossScalaVersions := Seq("2.12.8")
version := "0.3.9"
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.6.10",
"org.scalatest" %% "scalatest" % "3.0.5" % Test
),
credentials += Credentials(
"Artifactory Realm",
"flow.jfrog.io",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
)
)
publishTo := {
val host = "https://flow.jfrog.io/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
| name := "apibuilder-validation"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.8"
crossScalaVersions := Seq("2.12.8")
version := "0.3.10"
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.6.10",
"org.scalatest" %% "scalatest" % "3.0.5" % Test
),
credentials += Credentials(
"Artifactory Realm",
"flow.jfrog.io",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
)
)
publishTo := {
val host = "https://flow.jfrog.io/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
|
Update configuration to record version 0.1.68 | name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.5"
crossScalaVersions := Seq("2.12.4", "2.11.12", "2.10.6")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
version := "0.1.67"
| name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.5"
crossScalaVersions := Seq("2.12.4", "2.11.12", "2.10.6")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
version := "0.1.68"
|
Set project version to 0.3.6-BETA | import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._
object Build extends android.AutoBuild
{
lazy val main = Project( "toolbelt", file( "." ) )
.settings( androidBuildAar: _* )
.settings(
libraryDependencies ++= Seq(
"com.android.support" % "appcompat-v7" % "21.0.0",
"com.github.japgolly.android" % "svg-android" % "2.0.6",
"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
"org.scala-lang" % "scala-reflect" % scalaVersion.value
),
name := "Toolbelt",
organization := "com.taig.android",
publishArtifact in ( Compile, packageDoc ) := false,
scalaVersion := "2.11.4",
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-language:dynamics",
"-language:existentials",
"-language:implicitConversions",
"-language:reflectiveCalls"
),
// @see https://github.com/pfn/android-sdk-plugin/issues/88
sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
version := "0.3.5-BETA",
minSdkVersion in Android := "10",
platformTarget in Android := "android-21",
targetSdkVersion in Android := "21"
)
} | import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._
object Build extends android.AutoBuild
{
lazy val main = Project( "toolbelt", file( "." ) )
.settings( androidBuildAar: _* )
.settings(
libraryDependencies ++= Seq(
"com.android.support" % "appcompat-v7" % "21.0.0",
"com.github.japgolly.android" % "svg-android" % "2.0.6",
"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
"org.scala-lang" % "scala-reflect" % scalaVersion.value
),
name := "Toolbelt",
organization := "com.taig.android",
publishArtifact in ( Compile, packageDoc ) := false,
scalaVersion := "2.11.4",
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-language:dynamics",
"-language:existentials",
"-language:implicitConversions",
"-language:reflectiveCalls"
),
// @see https://github.com/pfn/android-sdk-plugin/issues/88
sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
version := "0.3.6-BETA",
minSdkVersion in Android := "10",
platformTarget in Android := "android-21",
targetSdkVersion in Android := "21"
)
} |
Add link parsing to page sizer. | import scala.io._
import scala.actors._
import Actor._
def pageSize(url: String) = Source.fromURL(url).mkString.length
def printPageSizes(urls: Iterable[String]) = {
var caller = self
for(url <- urls) {
actor {
println("Loading " + url + "...")
caller ! (url, pageSize(url))
}
}
for(i <- 1 to urls.size) {
receive {
case (url, size) =>
println(url + " -> " + size)
}
}
}
val urls = List("https://www.facebook.com", "https://www.twitter.com", "https://www.linkedin.com")
printPageSizes(urls)
| import scala.io._
import scala.actors._
import Actor._
def printPageSizes(urls: Iterable[String]) = {
val caller = self
val linkPattern = """<a href="?([^ "]+)"?>""".r
for(url <- urls) {
actor {
println("Processing " + url + "...")
val contents = Source.fromURL(url).mkString
val size = contents.size
val links = linkPattern.findAllMatchIn(contents).map(_.group(1)).toList
caller ! (url, size, links)
}
}
for(i <- 1 to urls.size) {
receive {
case (url, size, links: List[String]) => {
println("... processed " + url + " -> size: " + size + ", links: " + links.mkString(", "))
}
}
}
}
val urls = List("https://www.facebook.com", "https://www.twitter.com", "https://www.linkedin.com")
printPageSizes(urls)
|
Update to official release of scala-io-file | name := "gu-who"
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.1"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq(
filters,
ws,
"com.madgag" % "github-api" % "1.50.0.2",
"com.github.nscala-time" %% "nscala-time" % "1.2.0",
"com.squareup.okhttp" % "okhttp" % "1.5.3",
"com.madgag" %% "scala-io-file" % "0.4.2",
"org.eclipse.jgit" % "org.eclipse.jgit" % "3.3.0.201403021825-r",
"com.madgag.scala-git" %% "scala-git" % "2.4",
"com.madgag.scala-git" %% "scala-git-test" % "2.4" % "test"
)
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
| name := "gu-who"
version := "1.0-SNAPSHOT"
scalaVersion := "2.11.1"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq(
filters,
ws,
"com.madgag" % "github-api" % "1.50.0.2",
"com.github.nscala-time" %% "nscala-time" % "1.2.0",
"com.squareup.okhttp" % "okhttp" % "1.5.3",
"com.github.scala-incubator.io" %% "scala-io-file" % "0.4.3-1",
"org.eclipse.jgit" % "org.eclipse.jgit" % "3.3.0.201403021825-r",
"com.madgag.scala-git" %% "scala-git" % "2.4",
"com.madgag.scala-git" %% "scala-git-test" % "2.4" % "test"
)
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
|
Add more different tests: TestForTest - comment | package tests
import org.scalatest.{FlatSpec, Matchers}
class SleepInTest extends FlatSpec with Matchers {
behavior of "SleepIn"
it should "sleepIn when it is not a weekday and it is not a vacation" in {
SleepInSolution.sleepIn(weekday = false, vacation = false) shouldBe true
}
it should "not sleepIn when it is a weekday and it is not a vacation" in {
SleepInSolution.sleepIn(weekday = true, vacation = false) shouldBe false
}
it should "sleepIn when it is not a weekday and it is a vacation" in {
SleepInSolution.sleepIn(weekday = false, vacation = true) shouldBe true
}
} | package tests
import org.scalatest.{FlatSpec, Matchers}
//let's keep this single test in tests as it is an example fot SbtRunner test-task
class SleepInTest extends FlatSpec with Matchers {
behavior of "SleepIn"
it should "sleepIn when it is not a weekday and it is not a vacation" in {
SleepInSolution.sleepIn(weekday = false, vacation = false) shouldBe true
}
it should "not sleepIn when it is a weekday and it is not a vacation" in {
SleepInSolution.sleepIn(weekday = true, vacation = false) shouldBe false
}
it should "sleepIn when it is not a weekday and it is a vacation" in {
SleepInSolution.sleepIn(weekday = false, vacation = true) shouldBe true
}
} |
Update to the latest sbt-pgp | addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.1.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
addSbtPlugin("com.etsy" % "sbt-checkstyle-plugin" % "3.1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-nocomma" % "0.1.0")
| addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.1.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0-M2")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
addSbtPlugin("com.etsy" % "sbt-checkstyle-plugin" % "3.1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-nocomma" % "0.1.0")
|
Upgrade gatling-build-plugin 2.5.2, let compile with Java9+ and retain Java8 compatibility | resolvers += Resolver.bintrayIvyRepo("gatling", "sbt-plugins")
resolvers += Resolver.jcenterRepo
addSbtPlugin("io.gatling" % "gatling-build-plugin" % "2.5.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.11")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3")
addSbtPlugin("net.aichler" % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.2")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.5")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.15")
| resolvers += Resolver.bintrayIvyRepo("gatling", "sbt-plugins")
resolvers += Resolver.jcenterRepo
addSbtPlugin("io.gatling" % "gatling-build-plugin" % "2.5.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.11")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3")
addSbtPlugin("net.aichler" % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.2")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.5")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.15")
|
Add event context information for xxforms-value-changed | /**
* Copyright (C) 2011 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
*/
package org.orbeon.oxf.xforms.event.events
import org.orbeon.oxf.xforms.XFormsContainingDocument
import org.orbeon.oxf.xforms.event.{XFormsEventTarget, XFormsEvents, XFormsEvent}
import org.orbeon.saxon.om.NodeInfo
class XXFormsValueChanged(containingDocument: XFormsContainingDocument, targetObject: XFormsEventTarget,
val node: NodeInfo, val oldValue: String, val newValue: String)
extends XFormsEvent(containingDocument, XFormsEvents.XXFORMS_VALUE_CHANGED, targetObject, true, true)
| /**
* Copyright (C) 2011 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
*/
package org.orbeon.oxf.xforms.event.events
import org.orbeon.oxf.xforms.XFormsContainingDocument
import org.orbeon.oxf.xforms.event.{XFormsEventTarget, XFormsEvents, XFormsEvent}
import org.orbeon.saxon.om.{SingletonIterator, NodeInfo}
import org.orbeon.saxon.value.StringValue
class XXFormsValueChanged(containingDocument: XFormsContainingDocument, targetObject: XFormsEventTarget,
val node: NodeInfo, val oldValue: String, val newValue: String)
extends XFormsEvent(containingDocument, XFormsEvents.XXFORMS_VALUE_CHANGED, targetObject, true, true) {
override def getAttribute(name: String) = name match {
case "node" ⇒ SingletonIterator.makeIterator(node)
case "old-value" ⇒ SingletonIterator.makeIterator(StringValue.makeStringValue(oldValue))
case "new-value" ⇒ SingletonIterator.makeIterator(StringValue.makeStringValue(newValue))
case other ⇒ super.getAttribute(other)
}
}
|
Remove test that was not really passing solver checks | /* Copyright 2009-2015 EPFL, Lausanne */
import leon.lang._
object MyMap {
def map1(): Int = {
val m = Map(1 -> 2, 2 -> 3, 3 -> 4)
m(2)
} ensuring(_ == 3)
def map2(): Boolean = {
val m1 = Map[Int, Int]()
val m2 = Map.empty[Int, Int]
m1 == m2
}.holds
}
| /* Copyright 2009-2015 EPFL, Lausanne */
import leon.lang._
object MyMap {
def map1(): Int = {
val m = Map(1 -> 2, 2 -> 3, 3 -> 4)
m(2)
} ensuring(_ == 3)
// Empty maps are not well supported in CVC4, because of lack of quantifiers
//def map2(): Boolean = {
// val m1 = Map[Int, Int]()
// val m2 = Map.empty[Int, Int]
// m1 == m2
//}.holds
}
|
Add more matchers to the parsing service spec | package services.assessmentcentre
import repositories.assessmentcentre.AssessmentEventsRepository
import services.BaseServiceSpec
import scala.concurrent.Future
/**
* Created by fayimora on 08/06/2017.
*/
class AssessmentCentreParsingServiceSpec extends BaseServiceSpec {
"processCentres" must {
"successfully save the file contents" in new TestFixture {
val events = service.processCentres().futureValue
events.size mustBe 2
// TODO: Don't stop here!
}
}
trait TestFixture {
val mockAssessmentCentreRepository = mock[AssessmentEventsRepository]
val service = new AssessmentCentreParsingService {
val fileContents = Future.successful(List(
"FSAC,London,London (Euston Tower),03/04/17,09:00,12:00,36,4,5,6,1,1,1,1,2",
"SDIP telephone interview,London,London (Euston Tower),04/04/17,08:00,13:30,36,24,7,,,,,,"
))
val assessmentCentreRepository = mockAssessmentCentreRepository
}
}
}
| package services.assessmentcentre
import repositories.assessmentcentre.AssessmentEventsRepository
import services.BaseServiceSpec
import scala.concurrent.Future
/**
* Created by fayimora on 08/06/2017.
*/
class AssessmentCentreParsingServiceSpec extends BaseServiceSpec {
"processCentres" must {
"successfully saves and loads the file contents" in new TestFixture {
val events = service.processCentres().futureValue
events.size mustBe 2
events.head.eventType mustBe "FSAC"
events(1).skillRequirements.getOrElse("QUALITY_ASSURANCE_COORDINATOR", "--") mustBe 0
}
}
trait TestFixture {
val mockAssessmentCentreRepository = mock[AssessmentEventsRepository]
val service = new AssessmentCentreParsingService {
val fileContents = Future.successful(List(
"FSAC,London,London (Euston Tower),03/04/17,09:00,12:00,36,4,5,6,1,1,1,1,2",
"SDIP telephone interview,London,London (Euston Tower),04/04/17,08:00,13:30,36,24,7,,,,,,"
))
val assessmentCentreRepository = mockAssessmentCentreRepository
}
}
}
|
Add threaded execution to Clustal | package es.uvigo.ei.sing.funpep
package contrib
import java.nio.file.Path
import scalaz.Scalaz._
import data.Config.syntax._
import util.IOUtils._
object Clustal {
val devNull = "/dev/null".toPath
def distanceMatrix(input: Path, alignment: Path, distmat: Path): ConfiguredT[IOThrowable, String] =
ConfiguredT {
config ⇒ execute(s"${config.clustalo} -i $input -o $alignment --distmat-out=$distmat --percent-id --full --force")
}
def guideTree(input: Path, alignment: Path, tree: Path): ConfiguredT[IOThrowable, String] =
ConfiguredT {
config ⇒ execute(s"${config.clustalo} -i $input -o $alignment --guidetree-out=$tree --full --force")
}
def withDistanceMatrixOf[A](input: Path)(f: Path ⇒ IOThrowable[A]): ConfiguredT[IOThrowable, A] = {
val distMat = input + ".distmat"
def written = distanceMatrix(input, devNull, distMat)
def mapped = f(distMat).liftM[ConfiguredT]
written *> mapped
}
}
| package es.uvigo.ei.sing.funpep
package contrib
import java.nio.file.Path
import scalaz.Scalaz._
import data.Config.syntax._
import util.IOUtils._
object Clustal {
val devNull = "/dev/null".toPath
val threads = Math.min(1, Runtime.getRuntime().availableProcessors() - 3)
def distanceMatrix(input: Path, alignment: Path, distmat: Path): ConfiguredT[IOThrowable, String] =
ConfiguredT {
config ⇒ execute(s"${config.clustalo} -i $input -o $alignment --distmat-out=$distmat --percent-id --full --threads=$threads --force")
}
def guideTree(input: Path, alignment: Path, tree: Path): ConfiguredT[IOThrowable, String] =
ConfiguredT {
config ⇒ execute(s"${config.clustalo} -i $input -o $alignment --guidetree-out=$tree --full --threads=$threads --force")
}
def withDistanceMatrixOf[A](input: Path)(f: Path ⇒ IOThrowable[A]): ConfiguredT[IOThrowable, A] = {
val distMat = input + ".distmat"
def written = distanceMatrix(input, devNull, distMat)
def mapped = f(distMat).liftM[ConfiguredT]
written *> mapped
}
}
|
Update joda-time to 2.10.14 in master | import sbt._
import Keys._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
object Dependencies {
lazy val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.3.1" % "test"
lazy val jodaTime = Seq(
"joda-time" % "joda-time" % "2.10.13",
"org.joda" % "joda-convert" % "2.2.2"
)
lazy val jackson = Seq(
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2"
)
lazy val scalaz_core = Def.setting(
"org.scalaz" %%% "scalaz-core" % "7.3.6"
)
lazy val paranamer = "com.thoughtworks.paranamer" % "paranamer" % "2.8"
lazy val scalatest = Def.setting(
Seq("org.scalatest" %%% "scalatest-wordspec" % "3.2.11" % "test")
)
lazy val scalatestScalacheck = Def.setting(
Seq("org.scalatestplus" %%% "scalacheck-1-15" % "3.2.11.0" % "test")
)
lazy val scalaXml = Def.setting {
"org.scala-lang.modules" %%% "scala-xml" % "2.0.1"
}
}
| import sbt._
import Keys._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
object Dependencies {
lazy val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.3.1" % "test"
lazy val jodaTime = Seq(
"joda-time" % "joda-time" % "2.10.14",
"org.joda" % "joda-convert" % "2.2.2"
)
lazy val jackson = Seq(
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.2"
)
lazy val scalaz_core = Def.setting(
"org.scalaz" %%% "scalaz-core" % "7.3.6"
)
lazy val paranamer = "com.thoughtworks.paranamer" % "paranamer" % "2.8"
lazy val scalatest = Def.setting(
Seq("org.scalatest" %%% "scalatest-wordspec" % "3.2.11" % "test")
)
lazy val scalatestScalacheck = Def.setting(
Seq("org.scalatestplus" %%% "scalacheck-1-15" % "3.2.11.0" % "test")
)
lazy val scalaXml = Def.setting {
"org.scala-lang.modules" %%% "scala-xml" % "2.0.1"
}
}
|
Update sbt-scalafmt to 2.5.0 in master | addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.14")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
| addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.14")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
|
Make checkNull just check for null and return a default | package cpup.lib
object Util {
def checkNull[T, R](obj: T, fn: (T) => R, default: R): R = {
if(obj == null) {
default
} else {
fn(obj)
}
}
} | package cpup.lib
object Util {
def checkNull[R](obj: R, default: R): R = {
if(obj == null) {
default
} else {
obj
}
}
} |
Use managed version of MetricsReporter | package com.socrata.soda.server
import com.rojoma.simplearm.util._
import com.socrata.http.server.SocrataServerJetty
import com.socrata.http.server.curator.CuratorBroker
import com.socrata.soda.server.config.SodaFountainConfig
import com.socrata.thirdparty.curator.DiscoveryFromConfig
import com.socrata.thirdparty.metrics.{SocrataHttpSupport, MetricsOptions, MetricsReporter}
import com.typesafe.config.ConfigFactory
object SodaFountainJetty extends App {
val config = new SodaFountainConfig(ConfigFactory.load())
val metricsOptions = MetricsOptions(config.codaMetrics)
for {
sodaFountain <- managed(new SodaFountain(config))
discovery <- managed(DiscoveryFromConfig.unmanaged(classOf[Void],
sodaFountain.curator,
config.discovery))
} {
discovery.start()
val reporter = new MetricsReporter(metricsOptions)
val server = new SocrataServerJetty(
sodaFountain.handle,
port = config.network.port,
extraHandlers = List(SocrataHttpSupport.getHandler(metricsOptions)),
broker = new CuratorBroker[Void](discovery,
config.serviceAdvertisement.address,
config.serviceAdvertisement.service,
None))
server.run()
}
}
| package com.socrata.soda.server
import com.rojoma.simplearm.util._
import com.socrata.http.server.SocrataServerJetty
import com.socrata.http.server.curator.CuratorBroker
import com.socrata.soda.server.config.SodaFountainConfig
import com.socrata.thirdparty.curator.DiscoveryFromConfig
import com.socrata.thirdparty.metrics.{SocrataHttpSupport, MetricsOptions, MetricsReporter}
import com.typesafe.config.ConfigFactory
object SodaFountainJetty extends App {
val config = new SodaFountainConfig(ConfigFactory.load())
val metricsOptions = MetricsOptions(config.codaMetrics)
for {
sodaFountain <- managed(new SodaFountain(config))
discovery <- managed(DiscoveryFromConfig.unmanaged(classOf[Void],
sodaFountain.curator,
config.discovery))
reporter <- MetricsReporter.managed(metricsOptions)
} {
discovery.start()
val server = new SocrataServerJetty(
sodaFountain.handle,
port = config.network.port,
extraHandlers = List(SocrataHttpSupport.getHandler(metricsOptions)),
broker = new CuratorBroker[Void](discovery,
config.serviceAdvertisement.address,
config.serviceAdvertisement.service,
None))
server.run()
}
}
|
Update the Identifier class with the ontologyType field | package uk.ac.wellcome.platform.idminter.model
import com.google.inject.Inject
import com.twitter.inject.annotations.Flag
import scalikejdbc._
/** Represents a set of identifiers as stored in MySQL */
case class Identifier(CanonicalID: String, MiroID: String)
object Identifier {
def apply(p: SyntaxProvider[Identifier])(rs: WrappedResultSet): Identifier =
Identifier(rs.string(p.resultName.CanonicalID),
rs.string(p.resultName.MiroID))
}
class IdentifiersTable @Inject()(
@Flag("aws.rds.identifiers.database") database: String,
@Flag("aws.rds.identifiers.table") table: String)
extends SQLSyntaxSupport[Identifier] {
override val schemaName = Some(database)
override val tableName = table
override val useSnakeCaseColumnName = false
override val columns = Seq("CanonicalID", "ontologyType", "MiroID")
val i = this.syntax("i")
}
| package uk.ac.wellcome.platform.idminter.model
import com.google.inject.Inject
import com.twitter.inject.annotations.Flag
import scalikejdbc._
/** Represents a set of identifiers as stored in MySQL */
case class Identifier(
CanonicalID: String,
MiroID: String,
ontologyType: String = "Work"
)
object Identifier {
def apply(p: SyntaxProvider[Identifier])(rs: WrappedResultSet): Identifier =
Identifier(
CanonicalID = rs.string(p.resultName.CanonicalID),
MiroID = rs.string(p.resultName.MiroID),
ontologyType = rs.string(p.resultName.ontologyType)
)
}
class IdentifiersTable @Inject()(
@Flag("aws.rds.identifiers.database") database: String,
@Flag("aws.rds.identifiers.table") table: String)
extends SQLSyntaxSupport[Identifier] {
override val schemaName = Some(database)
override val tableName = table
override val useSnakeCaseColumnName = false
override val columns = Seq("CanonicalID", "ontologyType", "MiroID")
val i = this.syntax("i")
}
|
Fix build for Scala 2.11 | package org.http4s
package server
import java.net.{InetSocketAddress, URL}
import org.http4s.dsl._
import org.specs2.specification.AfterAll
import scala.io.Source
import scalaz.{\/-, -\/}
import scalaz.concurrent.Task
trait ServerContext extends AfterAll {
def builder: ServerBuilder
lazy val server = builder.bindAny()
.withServiceExecutor(Http4sSpec.TestPool)
.mountService(HttpService {
case GET -> Root / "thread" / "routing" =>
val thread = Thread.currentThread.getName
Ok(thread)
case GET -> Root / "thread" / "effect" =>
Task.delay(Thread.currentThread.getName).flatMap(Ok(_))
})
.start
.unsafePerformSync
def afterAll =
server.shutdown.unsafePerformSync
}
trait ServerSpec extends Http4sSpec with ServerContext {
def get(path: String): Task[String] = Task.delay {
Source.fromURL(new URL(s"http://127.0.0.1:${server.address.getPort}$path")).getLines.mkString
}
"A server" should {
"route requests on the service executor" in {
get("/thread/routing").unsafePerformSync must startWith("http4s-spec-")
}
"execute the service task on the service executor" in {
get("/thread/effect").unsafePerformSync must startWith("http4s-spec-")
}
}
}
| package org.http4s
package server
import java.net.{InetSocketAddress, URL}
import org.http4s.internal.compatibility._
import org.http4s.dsl._
import org.specs2.specification.AfterAll
import scala.io.Source
import scalaz.{\/-, -\/}
import scalaz.concurrent.Task
trait ServerContext extends AfterAll {
def builder: ServerBuilder
lazy val server = builder.bindAny()
.withServiceExecutor(Http4sSpec.TestPool)
.mountService(HttpService {
case GET -> Root / "thread" / "routing" =>
val thread = Thread.currentThread.getName
Ok(thread)
case GET -> Root / "thread" / "effect" =>
Task.delay(Thread.currentThread.getName).flatMap(Ok(_))
})
.start
.unsafePerformSync
def afterAll =
server.shutdown.unsafePerformSync
}
trait ServerSpec extends Http4sSpec with ServerContext {
def get(path: String): Task[String] = Task.delay {
Source.fromURL(new URL(s"http://127.0.0.1:${server.address.getPort}$path")).getLines.mkString
}
"A server" should {
"route requests on the service executor" in {
get("/thread/routing").unsafePerformSync must startWith("http4s-spec-")
}
"execute the service task on the service executor" in {
get("/thread/effect").unsafePerformSync must startWith("http4s-spec-")
}
}
}
|
Update filters-helpers, play-ahc-ws, ... to 2.8.16 | // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.15")
// For removing warts, maintain code quality
addSbtPlugin("org.wartremover" %% "sbt-wartremover" % "2.4.20")
// The sbt native packager - needed for docker builds
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9")
// For code coverage test
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
// For checkstyle
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
// For formatting Scala source code
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")
// Build fat JAR file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")
// Check vulnerabilities in JAR's
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "4.1.0")
| // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.16")
// For removing warts, maintain code quality
addSbtPlugin("org.wartremover" %% "sbt-wartremover" % "2.4.20")
// The sbt native packager - needed for docker builds
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9")
// For code coverage test
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
// For checkstyle
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
// For formatting Scala source code
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")
// Build fat JAR file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")
// Check vulnerabilities in JAR's
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "4.1.0")
|
Use Akka 2.1-M2 isntead of M1 | import sbt._
import Keys._
object MiniBCSBuild extends Build {
val buildOptions = Defaults.defaultSettings ++ Seq(
scalaVersion := "2.10.0-M7",
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
libraryDependencies := Seq(
"com.typesafe.akka" % "akka-actor" % "2.1-M1",
"com.typesafe.akka" % "akka-remote" % "2.1-M1",
"org.joda" % "joda-convert" % "1.2",
"joda-time" % "joda-time" % "2.1"
),
version := "1.0.0"
)
lazy val root = Project(
"minibcs",
file("."),
settings = buildOptions
).dependsOn(
uri("https://github.com/breakpoint-eval/scala-common.git"))
}
| import sbt._
import Keys._
object MiniBCSBuild extends Build {
val buildOptions = Defaults.defaultSettings ++ Seq(
scalaVersion := "2.10.0-M7",
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
resolvers += "Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/snapshots/",
resolvers += "Central" at "https://oss.sonatype.org/content/repositories/releases/",
libraryDependencies := Seq(
// Update these to use %% when 2.10 goes live because I have no idea how to force it to use that.
"com.typesafe.akka" % "akka-actor_2.10.0-M7" % "2.1-M2",
"com.typesafe.akka" % "akka-remote_2.10.0-M7" % "2.1-M2",
"org.joda" % "joda-convert" % "1.2",
"joda-time" % "joda-time" % "2.1"
),
version := "1.0.0"
)
lazy val root = Project(
"minibcs",
file("."),
settings = buildOptions
).dependsOn(
uri("https://github.com/breakpoint-eval/scala-common.git"))
}
|
Change Expiry Logging Level to Trace | package com.twitter.finagle.memcached.protocol
import com.twitter.logging.Logger
import com.twitter.util.Time
private[memcached] object ExpiryValidation {
private val log = Logger.get()
/**
* Checks if expiry is valid
*/
def checkExpiry(command: String, expiry: Time): Boolean = {
// Item never expires if expiry is Time.epoch
if (expiry == Time.epoch) true
else if (expiry < Time.now) {
log.warning(s"Negative expiry for $command: item will expire immediately")
false
} else true
}
}
| package com.twitter.finagle.memcached.protocol
import com.twitter.logging.{Level, Logger}
import com.twitter.util.Time
private[memcached] object ExpiryValidation {
private val log = Logger.get()
/**
* Checks if expiry is valid
*/
def checkExpiry(command: String, expiry: Time): Boolean = {
// Item never expires if expiry is Time.epoch
if (expiry == Time.epoch) true
else if (expiry < Time.now) {
if (log.isLoggable(Level.TRACE))
log.trace(s"Negative expiry for $command: item will expire immediately")
false
} else true
}
}
|
Add lastStreamId to GOAWAY exception | package com.twitter.finagle.http2
import com.twitter.finagle.{FailureFlags, StreamClosedException}
import io.netty.handler.codec.http2.Http2Error
import java.net.SocketAddress
private object Http2StreamClosedException {
private[http2] def errorToString(errorCode: Long): String = {
val err = Http2Error.valueOf(errorCode)
if (err == null) // happens for unknown codes
"unknown error code"
else
err.toString
}
}
final class GoAwayException private[http2](val errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], flags: Long)
extends StreamClosedException(remoteAddress, streamId.toString, s"GOAWAY(${Http2StreamClosedException.errorToString(errorCode)})", flags) {
def this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress]) =
this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], FailureFlags.Empty)
}
final class RstException private[http2](val errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], flags: Long)
extends StreamClosedException(remoteAddress, streamId.toString, s"RST(${Http2StreamClosedException.errorToString(errorCode)})", flags) {
def this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress]) =
this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], FailureFlags.Empty)
}
| package com.twitter.finagle.http2
import com.twitter.finagle.{FailureFlags, StreamClosedException}
import io.netty.handler.codec.http2.Http2Error
import java.net.SocketAddress
private object Http2StreamClosedException {
private[http2] def errorToString(errorCode: Long): String = {
val err = Http2Error.valueOf(errorCode)
if (err == null) // happens for unknown codes
"unknown error code"
else
err.toString
}
}
final class GoAwayException private[http2](val errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], flags: Long)
extends StreamClosedException(remoteAddress, streamId.toString, s"GOAWAY(${Http2StreamClosedException.errorToString(errorCode)}, $streamId)", flags) {
def this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress]) =
this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], FailureFlags.Empty)
}
final class RstException private[http2](val errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], flags: Long)
extends StreamClosedException(remoteAddress, streamId.toString, s"RST(${Http2StreamClosedException.errorToString(errorCode)})", flags) {
def this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress]) =
this(errorCode: Long, streamId: Long, remoteAddress: Option[SocketAddress], FailureFlags.Empty)
}
|
Increase timeout for publishing new poms. | package ch.epfl.scala.index
package server
package routes
package api
package impl
import data.DataPaths
import akka.actor.{Actor, ActorSystem}
import akka.stream.ActorMaterializer
import scala.concurrent.Await
import scala.concurrent.duration._
class PublishActor(paths: DataPaths,
dataRepository: DataRepository,
implicit val system: ActorSystem,
implicit val materializer: ActorMaterializer)
extends Actor {
private val publishProcess = new impl.PublishProcess(paths, dataRepository)
def receive = {
case publishData: PublishData => {
sender ! Await.result(publishProcess.writeFiles(publishData), 10.seconds)
}
}
}
| package ch.epfl.scala.index
package server
package routes
package api
package impl
import data.DataPaths
import akka.actor.{Actor, ActorSystem}
import akka.stream.ActorMaterializer
import scala.concurrent.Await
import scala.concurrent.duration._
class PublishActor(paths: DataPaths,
dataRepository: DataRepository,
implicit val system: ActorSystem,
implicit val materializer: ActorMaterializer)
extends Actor {
private val publishProcess = new impl.PublishProcess(paths, dataRepository)
def receive = {
case publishData: PublishData => {
sender ! Await.result(publishProcess.writeFiles(publishData), 1.minute)
}
}
}
|
Update configuration to record version 0.0.29 | import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-lint"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.8"
version := "0.0.28"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.5.1",
"com.ning" % "async-http-client" % "1.9.38",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
| import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-lint"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.8"
version := "0.0.29"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.5.1",
"com.ning" % "async-http-client" % "1.9.38",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
|
Update mdoc, sbt-mdoc to 2.2.14 | addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.8.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.5")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.7")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("io.chrisdavenport" % "sbt-mima-version-check" % "0.1.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.16")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13")
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6")
| addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.8.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.5")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.7")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("io.chrisdavenport" % "sbt-mima-version-check" % "0.1.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.16")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.14")
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.6")
|
Update sdkman-mongodb-persistence to version 1.3 | enablePlugins(JavaServerAppPackaging)
enablePlugins(DockerPlugin)
name := """sdkman-website"""
organization := "io.sdkman"
version := "1.0.0-SNAPSHOT"
packageName in Docker := "sdkman/sdkman-website"
dockerExposedPorts ++= Seq(9000)
javaOptions in Universal ++= Seq(
"-Dpidfile.path=/dev/null"
)
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.12.10"
resolvers ++= Seq(
Resolver.bintrayRepo("sdkman", "maven"),
Resolver.jcenterRepo
)
libraryDependencies ++= Seq(
ws,
guice,
"io.sdkman" %% "sdkman-mongodb-persistence" % "1.0",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
"com.iheart" %% "ficus" % "1.4.7")
| enablePlugins(JavaServerAppPackaging)
enablePlugins(DockerPlugin)
name := """sdkman-website"""
organization := "io.sdkman"
version := "1.0.0-SNAPSHOT"
packageName in Docker := "sdkman/sdkman-website"
dockerExposedPorts ++= Seq(9000)
javaOptions in Universal ++= Seq(
"-Dpidfile.path=/dev/null"
)
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.12.10"
resolvers ++= Seq(
Resolver.bintrayRepo("sdkman", "maven"),
Resolver.jcenterRepo
)
libraryDependencies ++= Seq(
ws,
guice,
"io.sdkman" %% "sdkman-mongodb-persistence" % "1.3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
"com.iheart" %% "ficus" % "1.4.7")
|
Use `3.1.6` release of lwjgl plugin. |
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1")
addSbtPlugin("com.github.philcali" % "sbt-lwjgl-plugin" % "3.1.5")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
|
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1")
addSbtPlugin("com.storm-enroute" % "sbt-lwjgl-plugin" % "3.1.6")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
|
Update filters-helpers, play-ahc-ws, ... to 2.8.12 | // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.9")
// For removing warts, maintain code quality
addSbtPlugin("org.wartremover" %% "sbt-wartremover" % "2.4.16")
// The sbt native packager - needed for docker builds
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.7")
// For code coverage test
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.2")
// For checkstyle
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
// For formatting Scala source code
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")
// Build fat JAR file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.0")
// Check vulnerabilities in JAR's
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "3.3.0")
| // The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.12")
// For removing warts, maintain code quality
addSbtPlugin("org.wartremover" %% "sbt-wartremover" % "2.4.16")
// The sbt native packager - needed for docker builds
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.7")
// For code coverage test
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.2")
// For checkstyle
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
// For formatting Scala source code
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")
// Build fat JAR file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.0")
// Check vulnerabilities in JAR's
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "3.3.0")
|
Add Lucene and commons-codec dependencies | name := "tshrdlu"
version := "0.1.5-SNAPSHOT"
organization := "edu.utexas"
scalaVersion := "2.10.0"
crossPaths := false
retrieveManaged := true
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
"org.twitter4j" % "twitter4j-core" % "3.0.3",
"org.twitter4j" % "twitter4j-stream" % "3.0.3",
"org.scalanlp" % "nak" % "1.1.0"
)
| name := "tshrdlu"
version := "0.1.5-SNAPSHOT"
organization := "edu.utexas"
scalaVersion := "2.10.0"
crossPaths := false
retrieveManaged := true
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
"org.twitter4j" % "twitter4j-core" % "3.0.3",
"org.twitter4j" % "twitter4j-stream" % "3.0.3",
"org.scalanlp" % "nak" % "1.1.0",
"commons-codec" % "commons-codec" % "1.7",
"org.apache.lucene" % "lucene-core" % "4.2.0",
"org.apache.lucene" % "lucene-analyzers-common" % "4.2.0",
"org.apache.lucene" % "lucene-queryparser" % "4.2.0"
)
|
Upgrade com.ning.async-http-client from 1.9.32 => 1.9.33 | import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-lint"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.7"
version := "0.0.17"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.4.6",
"com.ning" % "async-http-client" % "1.9.32",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
| import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-lint"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.7"
version := "0.0.17"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.4.6",
"com.ning" % "async-http-client" % "1.9.33",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
|
Update mdoc, sbt-mdoc to 2.2.14 | addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.7.0")
val sbtSoftwareMillVersion = "2.0.2"
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-browser-test-js" % sbtSoftwareMillVersion)
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13")
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
| addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.7.0")
val sbtSoftwareMillVersion = "2.0.2"
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-browser-test-js" % sbtSoftwareMillVersion)
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.14")
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
|
Use extractor for .external extension | package nbmtools
import java.io.InputStream
import java.util.zip.ZipInputStream
class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
override def getNextEntry() = {
val originalEntry = super.getNextEntry
if (originalEntry.getName.endsWith(".external")) {
// TODO
originalEntry
} else originalEntry
}
}
| package nbmtools
import java.io.InputStream
import java.util.zip.ZipInputStream
object appendExternal {
def apply(s: String): String = s + ".external"
def unapply(s: String): Option[String] = {
if (s.endsWith(".external"))
Some(s.stripSuffix(".external"))
else None
}
}
class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
override def getNextEntry() = {
val originalEntry = super.getNextEntry
originalEntry.getName match {
case appendExternal(name) => {
// TODO
originalEntry
}
case name => originalEntry
}
}
}
|
Fix bug in SBT config | // Imports
import scalariform.formatter.preferences._
import de.johoop.findbugs4sbt.FindBugs._
import de.johoop.jacoco4sbt._
import JacocoPlugin._
// Global build settings
fork := true
// Scalariform - source code formatter
// disable automatic reformat on compile
// instead use 'scalariform-format' command in sbt
defaultScalariformSettings // instead of scalariformSettings
// list of preferences available at http://mdr.github.io/scalariform/
ScalariformKeys.preferences := FormattingPreferences()
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
// FindBugs settings
findbugsSettings
findbugsReportType := Some(de.johoop.findbugs4sbt.ReportType.FancyHistHtml)
findbugsPriority := de.johoop.findbugs4sbt.Priority.Low
findbugsEffort := de.johoop.findbugs4sbt.Effort.Maximum
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html")
// JacocoPlugin settings
jacoco.settings
| // Imports
import scalariform.formatter.preferences._
import de.johoop.findbugs4sbt.FindBugs._
import de.johoop.jacoco4sbt._
import JacocoPlugin._
// Global build settings
// Scalariform - source code formatter
// disable automatic reformat on compile
// instead use 'scalariform-format' command in sbt
defaultScalariformSettings // instead of scalariformSettings
// list of preferences available at http://mdr.github.io/scalariform/
ScalariformKeys.preferences := FormattingPreferences()
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
// FindBugs settings
findbugsSettings
findbugsReportType := Some(de.johoop.findbugs4sbt.ReportType.FancyHistHtml)
findbugsPriority := de.johoop.findbugs4sbt.Priority.Low
findbugsEffort := de.johoop.findbugs4sbt.Effort.Maximum
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html")
// JacocoPlugin settings
jacoco.settings
|
Add try-catch block for initialization | package org.apache.mesos.chronos.scheduler
import java.util.concurrent.atomic.AtomicBoolean
import java.util.logging.Logger
import org.apache.mesos.chronos.scheduler.api._
import org.apache.mesos.chronos.scheduler.config._
import org.apache.mesos.chronos.scheduler.jobs.{JobScheduler, MetricReporterService, ZookeeperService}
import mesosphere.chaos.http.{HttpConf, HttpModule, HttpService}
import mesosphere.chaos.metrics.MetricsModule
import mesosphere.chaos.{App, AppConfiguration}
import org.rogach.scallop.ScallopConf
/**
* Main entry point to chronos using the Chaos framework.
* @author Florian Leibert (flo@leibert.de)
*/
object Main extends App {
lazy val conf = new ScallopConf(args)
with HttpConf with AppConfiguration with SchedulerConfiguration
with GraphiteConfiguration with CassandraConfiguration
val isLeader = new AtomicBoolean(false)
private[this] val log = Logger.getLogger(getClass.getName)
log.info("---------------------")
log.info("Initializing chronos.")
log.info("---------------------")
def modules() = {
Seq(
new HttpModule(conf),
new ChronosRestModule,
new MetricsModule,
new MainModule(conf),
new ZookeeperModule(conf),
new JobMetricsModule(conf),
new JobStatsModule(conf)
)
}
run(
classOf[ZookeeperService],
classOf[HttpService],
classOf[JobScheduler],
classOf[MetricReporterService]
)
}
| package org.apache.mesos.chronos.scheduler
import java.util.concurrent.atomic.AtomicBoolean
import java.util.logging.Logger
import org.apache.mesos.chronos.scheduler.api._
import org.apache.mesos.chronos.scheduler.config._
import org.apache.mesos.chronos.scheduler.jobs.{JobScheduler, MetricReporterService, ZookeeperService}
import mesosphere.chaos.http.{HttpConf, HttpModule, HttpService}
import mesosphere.chaos.metrics.MetricsModule
import mesosphere.chaos.{App, AppConfiguration}
import org.rogach.scallop.ScallopConf
/**
* Main entry point to chronos using the Chaos framework.
* @author Florian Leibert (flo@leibert.de)
*/
object Main extends App {
lazy val conf = new ScallopConf(args)
with HttpConf with AppConfiguration with SchedulerConfiguration
with GraphiteConfiguration with CassandraConfiguration
val isLeader = new AtomicBoolean(false)
private[this] val log = Logger.getLogger(getClass.getName)
log.info("---------------------")
log.info("Initializing chronos.")
log.info("---------------------")
def modules() = {
Seq(
new HttpModule(conf),
new ChronosRestModule,
new MetricsModule,
new MainModule(conf),
new ZookeeperModule(conf),
new JobMetricsModule(conf),
new JobStatsModule(conf)
)
}
try {
run(
classOf[ZookeeperService],
classOf[HttpService],
classOf[JobScheduler],
classOf[MetricReporterService]
)
} catch {
case _ =>
System.exit(1)
}
}
|
Reduce code dup in test. |
package org.scalatest.tools
import org.scalatest.Spec
import org.scalatest.matchers.ShouldMatchers
class SbtCommandParserSpec extends Spec with ShouldMatchers {
describe("the cmd terminal?") {
it("should parse 'st'") {
val parser = new SbtCommandParser
val result = parser.parseResult("""st""")
result match {
case parser.Success(result, _) => println("success: " + result)
case ns: parser.NoSuccess => fail(ns.toString)
}
}
it("should parse 'st --'") {
val parser = new SbtCommandParser
val result = parser.parseResult("""st --""")
result match {
case parser.Success(result, _) => println("success: " + result)
case ns: parser.NoSuccess => fail(ns.toString)
}
}
}
}
|
package org.scalatest.tools
import org.scalatest.Spec
import org.scalatest.matchers.ShouldMatchers
class SbtCommandParserSpec extends Spec with ShouldMatchers {
val parser = new SbtCommandParser
def canParsePhrase(s: String) {
val result = parser.parseResult(s)
result match {
case ns: parser.NoSuccess => fail(ns.toString)
case _ =>
}
}
def cannotParsePhrase(s: String) {
val result = parser.parseResult(s)
result match {
case parser.Success(result, _) => fail("wasn't supposed to, but parsed: " + result)
case _ =>
}
}
describe("the cmd terminal?") {
it("should parse 'st'") {
canParsePhrase("""st""")
canParsePhrase("""st --""")
}
}
}
|
Add apidoc-spec to public examples | package lib
import com.gilt.apidocgenerator.models.Container
case class ExampleService(key: String) {
val docsUrl = s"/gilt/$key/latest"
val apiJsonUrl = s"/gilt/$key/latest/api.json"
}
object Util {
val AddServiceText = "Add Service"
val OrgSettingsText = "Org Settings"
val ApidocExample = ExampleService("apidoc")
val ApidocGeneratorExample = ExampleService("apidoc-generator")
val Examples = Seq(ApidocExample, ApidocGeneratorExample)
val GitHubUrl = "https://github.com/gilt/apidoc"
def calculateNextVersion(version: String): String = {
version.split(VersionTag.Dash).size match {
case 1 => {
val pieces = version.split(VersionTag.Dot)
if (pieces.forall(s => VersionTag.isDigit(s))) {
(Seq(pieces.last.toInt + 1) ++ pieces.reverse.drop(1)).reverse.mkString(".")
} else {
version
}
}
case _ => version
}
}
def formatType(container: Container, name: String) = {
container match {
case Container.Singleton => name
case Container.List => s"[$name]"
case Container.Map => s"map[$name]"
case Container.UNDEFINED(container) => s"$container[$name]"
}
}
}
| package lib
import com.gilt.apidocgenerator.models.Container
case class ExampleService(key: String) {
val docsUrl = s"/gilt/$key/latest"
val apiJsonUrl = s"/gilt/$key/latest/api.json"
}
object Util {
val AddServiceText = "Add Service"
val OrgSettingsText = "Org Settings"
val ApidocExample = ExampleService("apidoc")
val ApidocGeneratorExample = ExampleService("apidoc-generator")
val ApidocSpecExample = ExampleService("apidoc-spec")
val Examples = Seq(ApidocExample, ApidocGeneratorExample, ApidocSpecExample)
val GitHubUrl = "https://github.com/gilt/apidoc"
def calculateNextVersion(version: String): String = {
version.split(VersionTag.Dash).size match {
case 1 => {
val pieces = version.split(VersionTag.Dot)
if (pieces.forall(s => VersionTag.isDigit(s))) {
(Seq(pieces.last.toInt + 1) ++ pieces.reverse.drop(1)).reverse.mkString(".")
} else {
version
}
}
case _ => version
}
}
def formatType(container: Container, name: String) = {
container match {
case Container.Singleton => name
case Container.List => s"[$name]"
case Container.Map => s"map[$name]"
case Container.UNDEFINED(container) => s"$container[$name]"
}
}
}
|
Update compilerplugin-shaded, ... to 0.8.4 | addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.13.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.18")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "0.6.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2")
addSbtCoursier
libraryDependencies ++= List(
"com.thesamet.scalapb" %% "compilerplugin-shaded" % "0.8.0",
"io.github.bonigarcia" % "webdrivermanager" % "3.0.0",
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
)
| addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.13.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.18")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "0.6.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2")
addSbtCoursier
libraryDependencies ++= List(
"com.thesamet.scalapb" %% "compilerplugin-shaded" % "0.8.4",
"io.github.bonigarcia" % "webdrivermanager" % "3.0.0",
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
)
|
Update configuration to record version 0.0.77 | import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-build"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.8"
version := "0.0.76"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.5.5",
"com.ning" % "async-http-client" % "1.9.39",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
| import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-build"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.8"
version := "0.0.77"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.5.5",
"com.ning" % "async-http-client" % "1.9.39",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
|
Align ML layer with the changes made on RDF layer | package net.sansa_stack.ml.spark.clustering.algorithms
import com.holdenkarau.spark.testing.DataFrameSuiteBase
import net.sansa_stack.rdf.spark.io._
import net.sansa_stack.rdf.spark.model.graph._
import org.apache.jena.riot.Lang
import org.scalatest.FunSuite
class RdfPicTest extends FunSuite with DataFrameSuiteBase {
test("Clustering RDF data") {
val lang = Lang.NTRIPLES
val path = getClass.getResource("/Cluster/Clustering_sampledata.txt").getPath
val triples = spark.rdf(lang)(path)
val graph = triples.asStringGraph()
val cluster = RDFGraphPowerIterationClustering(spark, graph, "/Cluster/output", 4, 10)
cluster.collect().foreach(println)
assert(true)
}
}
| package net.sansa_stack.ml.spark.clustering.algorithms
import com.holdenkarau.spark.testing.DataFrameSuiteBase
import net.sansa_stack.rdf.spark.io._
import net.sansa_stack.rdf.spark.model._
import org.apache.jena.riot.Lang
import org.scalatest.FunSuite
class RdfPicTest extends FunSuite with DataFrameSuiteBase {
test("Clustering RDF data") {
val lang = Lang.NTRIPLES
val path = getClass.getResource("/Cluster/Clustering_sampledata.txt").getPath
val triples = spark.rdf(lang)(path)
val graph = triples.asStringGraph()
val cluster = RDFGraphPowerIterationClustering(spark, graph, "/Cluster/output", 4, 10)
cluster.collect().foreach(println)
assert(true)
}
}
|
Make "binding not found" error messages more readable. | package lore.compiler.semantics.scopes
import lore.compiler.core.Position
import lore.compiler.feedback.Reporter
import lore.compiler.semantics.NamePath
import lore.compiler.semantics.functions.FunctionSignature
/**
* A scope that provides access to bindings (variables, multi-functions, struct constructors, modules, etc.).
*/
trait BindingScope extends Scope[Binding] {
def resolveStatic(namePath: NamePath, position: Position)(implicit reporter: Reporter): Option[Binding] = {
resolveStatic(namePath, this, position)
}
override def entryLabel: String = "variable, multi-function, struct constructor, or module"
}
/**
* The root binding scope of a function, containing parameter bindings.
*/
case class FunctionBindingScope(signature: FunctionSignature, parent: BindingScope) extends ImmutableScope[Binding] with BindingScope {
override protected val optionalParent: Option[Scope[Binding]] = Some(parent)
override protected val entries: Map[String, Binding] = signature.namedParameters.map(p => p.name -> p.asVariable).toMap
}
/**
* A scope opened by a block, containing local variable bindings.
*/
class BlockBindingScope(parent: BindingScope) extends MutableScope[Binding] with BindingScope {
override protected def optionalParent: Option[Scope[Binding]] = Some(parent)
def register(variable: LocalVariable, position: Position)(implicit reporter: Reporter): Unit = {
super.register(variable.name, variable, position)
}
}
| package lore.compiler.semantics.scopes
import lore.compiler.core.Position
import lore.compiler.feedback.Reporter
import lore.compiler.semantics.NamePath
import lore.compiler.semantics.functions.FunctionSignature
/**
* A scope that provides access to bindings (variables, multi-functions, struct constructors, modules, etc.).
*/
trait BindingScope extends Scope[Binding] {
def resolveStatic(namePath: NamePath, position: Position)(implicit reporter: Reporter): Option[Binding] = {
resolveStatic(namePath, this, position)
}
override def entryLabel: String = "binding"
}
/**
* The root binding scope of a function, containing parameter bindings.
*/
case class FunctionBindingScope(signature: FunctionSignature, parent: BindingScope) extends ImmutableScope[Binding] with BindingScope {
override protected val optionalParent: Option[Scope[Binding]] = Some(parent)
override protected val entries: Map[String, Binding] = signature.namedParameters.map(p => p.name -> p.asVariable).toMap
}
/**
* A scope opened by a block, containing local variable bindings.
*/
class BlockBindingScope(parent: BindingScope) extends MutableScope[Binding] with BindingScope {
override protected def optionalParent: Option[Scope[Binding]] = Some(parent)
def register(variable: LocalVariable, position: Position)(implicit reporter: Reporter): Unit = {
super.register(variable.name, variable, position)
}
}
|
Update configuration to record version 0.1.71 | name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.5"
crossScalaVersions := Seq("2.12.4", "2.11.12", "2.10.6")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
version := "0.1.70"
| name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.5"
crossScalaVersions := Seq("2.12.4", "2.11.12", "2.10.6")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
version := "0.1.71"
|
Increment version from 0.0.12 => 0.0.13 | import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-lint"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.7"
version := "0.0.12"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.4.6",
"com.ning" % "async-http-client" % "1.9.32",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
| import com.github.retronym.SbtOneJar._
oneJarSettings
name := "api-lint"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.7"
version := "0.0.13"
exportJars := true
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.4.6",
"com.ning" % "async-http-client" % "1.9.32",
"org.scalatest" %% "scalatest" % "2.2.6" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
|
Update configuration to record version 0.1.36 | name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.3"
crossScalaVersions := Seq("2.12.3", "2.11.11", "2.10.6")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.4" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
version := "0.1.35"
| name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.3"
crossScalaVersions := Seq("2.12.3", "2.11.11", "2.10.6")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.4" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
version := "0.1.36"
|
Add 'akka-http-testkit' and 'scalatest' dependency | name := "scala-starter-kit"
version := "0.1"
scalaVersion := "2.12.6"
val akkaVersion = "2.5.16"
val akkaHttpVersion = "10.1.5"
val sangriaVersion = "1.0.1"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.google.inject" % "guice" % "4.1.0",
"net.codingwell" %% "scala-guice" % "4.2.1",
"org.sangria-graphql" %% "sangria" % "1.4.2",
"org.sangria-graphql" %% "sangria-spray-json" % sangriaVersion,
"org.sangria-graphql" %% "sangria-akka-streams" % sangriaVersion,
"org.sangria-graphql" %% "sangria-monix" % "1.0.0"
) | name := "scala-starter-kit"
version := "0.1"
scalaVersion := "2.12.6"
val akkaVersion = "2.5.16"
val akkaHttpVersion = "10.1.5"
val sangriaVersion = "1.0.1"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-http-testkit" % "10.1.5",
"org.scalatest" % "scalatest_2.12" % "3.0.5" % "test",
"com.google.inject" % "guice" % "4.1.0",
"net.codingwell" %% "scala-guice" % "4.2.1",
"org.sangria-graphql" %% "sangria" % "1.4.2",
"org.sangria-graphql" %% "sangria-spray-json" % sangriaVersion,
"org.sangria-graphql" %% "sangria-akka-streams" % sangriaVersion,
"org.sangria-graphql" %% "sangria-monix" % "1.0.0"
) |
Update configuration to record version 0.2.21 | name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.8"
crossScalaVersions := Seq("2.12.8")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5" % Test,
compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
"com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
),
credentials += Credentials(
"Artifactory Realm",
"flow.jfrog.io",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
)
)
publishTo := {
val host = "https://flow.jfrog.io/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
// silence all warnings on autogenerated files
scalacOptions += "-P:silencer:pathFilters=src/main/scala/io/flow/generated/.*"
// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"
version := "0.2.20"
| name := "lib-reference-scala"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.8"
crossScalaVersions := Seq("2.12.8")
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5" % Test,
compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
"com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
),
credentials += Credentials(
"Artifactory Realm",
"flow.jfrog.io",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
)
)
publishTo := {
val host = "https://flow.jfrog.io/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
// silence all warnings on autogenerated files
scalacOptions += "-P:silencer:pathFilters=src/main/scala/io/flow/generated/.*"
// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"
version := "0.2.21"
|
Update validation stats lookup for macro edits | package hmda.validation.rules
import akka.actor.ActorRef
import akka.cluster.singleton.{ ClusterSingletonProxy, ClusterSingletonProxySettings }
import akka.util.Timeout
import com.typesafe.config.ConfigFactory
import hmda.validation.{ AS, EC }
import scala.concurrent.Future
import scala.concurrent.duration._
trait StatsLookup {
val configuration = ConfigFactory.load()
val duration = configuration.getInt("hmda.actor.timeout")
val isClustered = configuration.getBoolean("hmda.isClustered")
implicit val timeout = Timeout(duration.seconds)
def validationStats(implicit system: AS[_], ec: EC[_]): Future[ActorRef] =
if (isClustered) {
Future(
system.actorOf(
ClusterSingletonProxy.props(
singletonManagerPath = "/user/validation-stats",
settings = ClusterSingletonProxySettings(system).withRole("persistence")
)
)
)
} else {
system.actorSelection("/user/validation-stats").resolveOne()
}
}
| package hmda.validation.rules
import akka.actor.ActorRef
import akka.cluster.singleton.{ ClusterSingletonProxy, ClusterSingletonProxySettings }
import akka.util.Timeout
import com.typesafe.config.ConfigFactory
import hmda.validation.{ AS, EC, ValidationStats }
import scala.concurrent.Future
import scala.concurrent.duration._
trait StatsLookup {
val configuration = ConfigFactory.load()
val duration = configuration.getInt("hmda.actor.timeout")
val isClustered = configuration.getBoolean("hmda.isClustered")
implicit val timeout = Timeout(duration.seconds)
def validationStats(implicit system: AS[_], ec: EC[_]): Future[ActorRef] =
if (isClustered) {
Future(
system.actorOf(
ClusterSingletonProxy.props(
singletonManagerPath = s"/user/${ValidationStats.name}",
settings = ClusterSingletonProxySettings(system).withRole("persistence")
)
)
)
} else {
system.actorSelection(s"/user/${ValidationStats.name}").resolveOne()
}
}
|
Remove unneeded defaults from mixins | package io.continuum.bokeh
trait FillProps { self: HasFields =>
object fill_color extends Vectorized[Color](Color.Gray)
object fill_alpha extends Field[Percent](100%%)
}
trait LineProps { self: HasFields =>
object line_color extends Vectorized[Color](Color.Black)
object line_width extends Field[Double](1.0) with NonNegative
object line_alpha extends Field[Percent](100%%)
object line_join extends Field[LineJoin]
object line_cap extends Field[LineCap]
object line_dash extends Field[LineDash]
object line_dash_offset extends Field[Int](0)
}
trait TextProps { self: HasFields =>
object text_font extends Field[String]
object text_font_size extends Field[String]("10pt")
object text_font_style extends Field[FontStyle]
object text_color extends Field[Color](Color.Black)
object text_alpha extends Field[Percent](100%%)
object text_align extends Field[TextAlign]
object text_baseline extends Field[TextBaseline]
}
| package io.continuum.bokeh
trait FillProps { self: HasFields =>
object fill_color extends Vectorized[Color](Color.Gray)
object fill_alpha extends Field[Percent]
}
trait LineProps { self: HasFields =>
object line_color extends Vectorized[Color](Color.Black)
object line_width extends Field[Double](1.0)
object line_alpha extends Field[Percent]
object line_join extends Field[LineJoin]
object line_cap extends Field[LineCap]
object line_dash extends Field[LineDash]
object line_dash_offset extends Field[Int]
}
trait TextProps { self: HasFields =>
object text_font extends Field[String]
object text_font_size extends Field[String]("10pt")
object text_font_style extends Field[FontStyle]
object text_color extends Field[Color](Color.Black)
object text_alpha extends Field[Percent]
object text_align extends Field[TextAlign]
object text_baseline extends Field[TextBaseline]
}
|
Revert "upgraded scala to v2.12.1" | organization := "com.pulptunes"
name := "pulptunes-relay"
version := "2.0.0-SNAPSHOT"
scalaVersion := "2.12.1"
libraryDependencies ++= Seq(
evolutions,
ws,
"com.typesafe.play" %% "play-slick" % "2.0.0",
"com.typesafe.play" %% "play-slick-evolutions" % "2.0.0",
"mysql" % "mysql-connector-java" % "5.1.36",
"org.typelevel" %% "cats" % "0.4.1"
)
sources in (Compile, doc) := Seq.empty
publishArtifact in (Compile, packageDoc) := false
lazy val root = (project in file(".")).enablePlugins(PlayScala)
| organization := "com.pulptunes"
name := "pulptunes-relay"
version := "2.0.0-SNAPSHOT"
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
evolutions,
ws,
"com.typesafe.play" %% "play-slick" % "2.0.0",
"com.typesafe.play" %% "play-slick-evolutions" % "2.0.0",
"mysql" % "mysql-connector-java" % "5.1.36",
"org.typelevel" %% "cats" % "0.4.1"
)
sources in (Compile, doc) := Seq.empty
publishArtifact in (Compile, packageDoc) := false
lazy val root = (project in file(".")).enablePlugins(PlayScala)
|
Add postgres as deployment DB driver | name := """frontend"""
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
| name := """frontend"""
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
libraryDependencies ++= Seq(
"org.postgresql" % "postgresql" % "9.4-1204-jdbc42"
)
|
Update spire, spire-laws to 0.16.1 | package quasar.project
object Versions {
val algebraVersion = "1.0.0"
val argonautVersion = "6.2.2"
val catsEffectVersion = "1.1.0"
val disciplineVersion = "0.7.2"
val jawnVersion = "0.14.1"
val jawnfs2Version = "0.14.1"
val matryoshkaVersion = "0.18.3"
val monocleVersion = "1.4.0"
val pathyVersion = "0.2.11"
val refinedVersion = "0.8.3"
val scodecBitsVersion = "1.1.2"
val scalacheckVersion = "1.14.0"
val scalazVersion = "7.2.26"
val scalazStreamVersion = "0.8.6a"
val scoptVersion = "3.5.0"
val shapelessVersion = "2.3.3"
val simulacrumVersion = "0.10.0"
val specsVersion = "4.3.3"
val spireVersion = "0.16.0"
val akkaVersion = "2.5.1"
val fs2Version = "1.0.2"
val slf4sVersion = "1.7.25"
}
| package quasar.project
object Versions {
val algebraVersion = "1.0.0"
val argonautVersion = "6.2.2"
val catsEffectVersion = "1.1.0"
val disciplineVersion = "0.7.2"
val jawnVersion = "0.14.1"
val jawnfs2Version = "0.14.1"
val matryoshkaVersion = "0.18.3"
val monocleVersion = "1.4.0"
val pathyVersion = "0.2.11"
val refinedVersion = "0.8.3"
val scodecBitsVersion = "1.1.2"
val scalacheckVersion = "1.14.0"
val scalazVersion = "7.2.26"
val scalazStreamVersion = "0.8.6a"
val scoptVersion = "3.5.0"
val shapelessVersion = "2.3.3"
val simulacrumVersion = "0.10.0"
val specsVersion = "4.3.3"
val spireVersion = "0.16.1"
val akkaVersion = "2.5.1"
val fs2Version = "1.0.2"
val slf4sVersion = "1.7.25"
}
|
Fix color for component following nodes | package qrygraph.client.ui
import qrygraph.shared.data.Edge
import qrygraph.shared.pig.ResultType
/**
* Created by info on 31.08.2016.
*/
object UIHelper {
/** based on the state of the resultTypes of the source and the target this function returns a color index for an edge */
def getColorCodeForEdge(e: Edge,resultTypes: Map[String, ResultType]): Int = {
// in case of an join/cross we have a neighbour node that can be invalid
val neighbourInputNodeOption = e.to.parent.inputs.find(_.id != e.to.id).map(_.parent.name)
val neighbourHasNoTyping = neighbourInputNodeOption.exists(!resultTypes.contains(_))
(resultTypes.get(e.from.parent.name), resultTypes.get(e.to.parent.name), neighbourHasNoTyping) match {
case (Some(_), Some(_), _) => 5 // valid node -> green
case (None, None, _) => 3 // both sides not working -> yellow
case (Some(_), None, true) => 3 // the to node is not valid but other neighbour also not -> yellow
case (_, None, _) => 1 // the to node is not valid -> red
case (_, _, _) => 0 // ERROR CASE should not happen -> grey
}
}
}
| package qrygraph.client.ui
import qrygraph.shared.data.Edge
import qrygraph.shared.nodes.ComponentNode
import qrygraph.shared.pig.ResultType
/**
* Created by info on 31.08.2016.
*/
object UIHelper {
/** based on the state of the resultTypes of the source and the target this function returns a color index for an edge */
def getColorCodeForEdge(e: Edge, resultTypes: Map[String, ResultType]): Int = {
// in case of an join/cross we have a neighbour node that can be invalid
val neighbourInputNodeOption = e.to.parent.inputs.find(_.id != e.to.id).map(_.parent.name)
val neighbourHasNoTyping = neighbourInputNodeOption.exists(!resultTypes.contains(_))
(resultTypes.get(e.from.parent.name).isDefined || e.from.parent.isInstanceOf[ComponentNode],
resultTypes.get(e.to.parent.name).isDefined || e.to.parent.isInstanceOf[ComponentNode],
neighbourHasNoTyping) match {
case (true, true, _) => 5 // valid node -> green
case (false, false, _) => 3 // both sides not working -> yellow
case (true, false, true) => 3 // the to node is not valid but other neighbour also not -> yellow
case (_, false, _) => 1 // the to node is not valid -> red
case (_, true, _) => 4 // ERROR CASE
case (_, _, _) => 0 // ERROR CASE should not happen -> grey
}
}
}
|
Fix Mahout 0.8 Build 1993 dependency | name := "PredictionIO-Process-ItemRec-Algorithms-Scala-Mahout-Commons"
libraryDependencies ++= Seq(
"io.prediction" %% "predictionio-commons" % "0.4-SNAPSHOT"
)
// Mahout's dependencies
libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "13.0.1",
"org.codehaus.jackson" % "jackson-core-asl" % "1.9.11",
"org.codehaus.jackson" % "jackson-mapper-asl" % "1.9.11",
"org.slf4j" % "slf4j-api" % "1.7.2",
"commons-lang" % "commons-lang" % "2.6",
"commons-io" % "commons-io" % "2.4",
"com.thoughtworks.xstream" % "xstream" % "1.4.4",
"org.apache.lucene" % "lucene-core" % "4.2.0",
"org.apache.lucene" % "lucene-analyzers-common" % "4.2.0",
"org.apache.mahout.commons" % "commons-cli" % "2.0-mahout",
"org.apache.commons" % "commons-math3" % "3.1.1"
)
| name := "PredictionIO-Process-ItemRec-Algorithms-Scala-Mahout-Commons"
libraryDependencies ++= Seq(
"io.prediction" %% "predictionio-commons" % "0.4-SNAPSHOT"
)
// Mahout's dependencies
libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "13.0.1",
"org.codehaus.jackson" % "jackson-core-asl" % "1.9.11",
"org.codehaus.jackson" % "jackson-mapper-asl" % "1.9.11",
"org.slf4j" % "slf4j-api" % "1.7.2",
"commons-lang" % "commons-lang" % "2.6",
"commons-io" % "commons-io" % "2.4",
"com.thoughtworks.xstream" % "xstream" % "1.4.4",
"org.apache.lucene" % "lucene-core" % "4.2.0",
"org.apache.lucene" % "lucene-analyzers-common" % "4.2.0",
"org.apache.mahout.commons" % "commons-cli" % "2.0-mahout",
"org.apache.commons" % "commons-math3" % "3.2"
)
|
Add Let to staged interpreter test | import scala.quoted._
enum Exp {
case Num(n: Int)
case Plus(e1: Exp, e2: Exp)
case Var(x: String)
}
object Test {
import Exp._
val exp = Plus(Plus(Num(2), Var("x")), Num(4))
def compile(e: Exp, env: Map[String, Expr[Int]]): Expr[Int] = e match {
case Num(n) => n
case Plus(e1, e2) => '(~compile(e1, env) + ~compile(e2, env))
case Var(x) => env(x)
}
val res = (x: Int) => ~compile(exp, Map("x" -> '(x)))
}
| import scala.quoted._
enum Exp {
case Num(n: Int)
case Plus(e1: Exp, e2: Exp)
case Var(x: String)
case Let(x: String, e: Exp, in: Exp)
}
object Test {
import Exp._
val keepLets = true
val exp = Plus(Plus(Num(2), Var("x")), Num(4))
val letExp = Let("x", Num(3), exp)
def compile(e: Exp, env: Map[String, Expr[Int]]): Expr[Int] = e match {
case Num(n) => n
case Plus(e1, e2) => '(~compile(e1, env) + ~compile(e2, env))
case Var(x) => env(x)
case Let(x, e, body) =>
if (keepLets)
'{ val y = ~compile(e, env); ~compile(body, env + (x -> '(y))) }
else
compile(body, env + (x -> compile(e, env)))
}
val res1 = (x: Int) => ~compile(exp, Map("x" -> '(x)))
val res2 = compile(letExp, Map())
}
|
Remove Applicative constraint on encoders from scala-tags | package org.http4s
package scalatags
import _root_.scalatags.Text.TypedTag
import cats.Applicative
import org.http4s.headers.`Content-Type`
trait ScalatagsInstances {
implicit def scalatagsEncoder[F[_]: Applicative](
implicit charset: Charset = DefaultCharset): EntityEncoder[F, TypedTag[String]] =
contentEncoder(MediaType.text.html)
private def contentEncoder[F[_], C <: TypedTag[String]](mediaType: MediaType)(
implicit charset: Charset): EntityEncoder[F, C] =
EntityEncoder
.stringEncoder[F]
.contramap[C](content => content.render)
.withContentType(`Content-Type`(mediaType, charset))
}
| package org.http4s
package scalatags
import _root_.scalatags.Text.TypedTag
import org.http4s.headers.`Content-Type`
trait ScalatagsInstances {
implicit def scalatagsEncoder[F[_]](
implicit charset: Charset = DefaultCharset): EntityEncoder[F, TypedTag[String]] =
contentEncoder(MediaType.text.html)
private def contentEncoder[F[_], C <: TypedTag[String]](mediaType: MediaType)(
implicit charset: Charset): EntityEncoder[F, C] =
EntityEncoder
.stringEncoder[F]
.contramap[C](content => content.render)
.withContentType(`Content-Type`(mediaType, charset))
}
|
Remove "object" command, not necessary at the moment | import io.luna.game.event.impl.CommandEvent
>>@[CommandEvent]("npc", RIGHTS_DEV) { (msg, plr) =>
val args = msg.getArgs
world.addNpc(args(0).toInt, plr.position)
}
>>@[CommandEvent]("object", RIGHTS_DEV) { (msg, plr) =>
// TODO: Once object placement system is done
}
| import io.luna.game.event.impl.CommandEvent
>>@[CommandEvent]("npc", RIGHTS_DEV) { (msg, plr) =>
val args = msg.getArgs
world.addNpc(args(0).toInt, plr.position)
} |
Set project dependencies to HEAD of the respective projects. | /* ______________ ___ __ ___ _____ _____ ____ __ ____________ *\
** / __/_ __/ __ \/ _ \/ |/ / / __/ |/ / _ \/ __ \/ / / /_ __/ __/ **
** _\ \ / / / /_/ / , _/ /|_/ / / _// / , _/ /_/ / /_/ / / / / _/ **
** /___/ /_/ \____/_/|_/_/ /_/ /___/_/|_/_/|_|\____/\____/ /_/ /___/ **
** **
** Storm Enroute (c) 2011 **
\* www.storm-enroute.com */
import sbt._
import Keys._
object StormEnrouteBuild extends Build {
lazy val root = Project("storm-enroute", file(".")) dependsOn (
RootProject(uri("git://github.com/axel22/mempool.git")),
RootProject(uri("git://git.assembla.com/bufferz.git"))
)
}
| /* ______________ ___ __ ___ _____ _____ ____ __ ____________ *\
** / __/_ __/ __ \/ _ \/ |/ / / __/ |/ / _ \/ __ \/ / / /_ __/ __/ **
** _\ \ / / / /_/ / , _/ /|_/ / / _// / , _/ /_/ / /_/ / / / / _/ **
** /___/ /_/ \____/_/|_/_/ /_/ /___/_/|_/_/|_|\____/\____/ /_/ /___/ **
** **
** Storm Enroute (c) 2011 **
\* www.storm-enroute.com */
import sbt._
import Keys._
object StormEnrouteBuild extends Build {
lazy val root = Project("storm-enroute", file(".")) dependsOn (
RootProject(uri("git://github.com/axel22/mempool.git#HEAD")),
RootProject(uri("git://git.assembla.com/bufferz.git#HEAD"))
)
}
|
Set project version to 0.3.17-BETA | import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._
object Build extends android.AutoBuild
{
lazy val main = Project( "toolbelt", file( "." ) )
.settings( androidBuildAar: _* )
.settings(
libraryDependencies ++= Seq(
"com.android.support" % "appcompat-v7" % "21.0.0",
"com.github.japgolly.android" % "svg-android" % "2.0.6",
"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
"org.scala-lang" % "scala-reflect" % scalaVersion.value
),
name := "Toolbelt",
organization := "com.taig.android",
publishArtifact in ( Compile, packageDoc ) := false,
scalaVersion := "2.11.4",
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-language:dynamics",
"-language:existentials",
"-language:implicitConversions",
"-language:reflectiveCalls"
),
// @see https://github.com/pfn/android-sdk-plugin/issues/88
sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
version := "0.3.16-BETA",
minSdkVersion in Android := "10",
platformTarget in Android := "android-21",
targetSdkVersion in Android := "21"
)
} | import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._
object Build extends android.AutoBuild
{
lazy val main = Project( "toolbelt", file( "." ) )
.settings( androidBuildAar: _* )
.settings(
libraryDependencies ++= Seq(
"com.android.support" % "appcompat-v7" % "21.0.0",
"com.github.japgolly.android" % "svg-android" % "2.0.6",
"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
"org.scala-lang" % "scala-reflect" % scalaVersion.value
),
name := "Toolbelt",
organization := "com.taig.android",
publishArtifact in ( Compile, packageDoc ) := false,
scalaVersion := "2.11.4",
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-language:dynamics",
"-language:existentials",
"-language:implicitConversions",
"-language:reflectiveCalls"
),
// @see https://github.com/pfn/android-sdk-plugin/issues/88
sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
version := "0.3.17-BETA",
minSdkVersion in Android := "10",
platformTarget in Android := "android-21",
targetSdkVersion in Android := "21"
)
} |
Remove urls in Twitter statuses | package fi.pyppe.ircbot.slave
import twitter4j.TwitterFactory
import scala.concurrent.{ExecutionContext, Future}
object Tweets {
def statusText(id: Long)(implicit ec: ExecutionContext): Future[String] = Future {
val status = TwitterFactory.getSingleton.showStatus(id)
val user = s"@${status.getUser.getScreenName} (${status.getUser.getName})"
val text = status.getText.replace("\n", " ")
s"$user: $text"
}
}
| package fi.pyppe.ircbot.slave
import twitter4j.TwitterFactory
import scala.concurrent.{ExecutionContext, Future}
object Tweets {
def statusText(id: Long)(implicit ec: ExecutionContext): Future[String] = Future {
val status = TwitterFactory.getSingleton.showStatus(id)
val user = s"@${status.getUser.getScreenName} (${status.getUser.getName})"
val text = removeUrls(status.getText.replace("\n", " "))
s"$user: $text"
}
private def removeUrls(str: String) = str.replaceAll(
"https?://\\S+\\b",
""
).trim
}
|
Update configuration to record version 0.1.16 | name := "apibuilder-validation"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.4"
crossScalaVersions := Seq("2.12.4", "2.11.12")
version := "0.1.15"
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.6.7",
"org.scalatest" %% "scalatest" % "3.0.4" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
| name := "apibuilder-validation"
organization := "io.flow"
scalaVersion in ThisBuild := "2.12.4"
crossScalaVersions := Seq("2.12.4", "2.11.12")
version := "0.1.16"
lazy val root = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.6.7",
"org.scalatest" %% "scalatest" % "3.0.4" % Test
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
|
Fix warning message about hidden import | package webserviceclients.vehicleandkeeperlookup
import play.api.libs.json.Json
import webserviceclients.vehicleandkeeperlookup.VehicleAndKeeperDetailsDto
final case class VehicleAndKeeperDetailsResponse(responseCode: Option[String],
vehicleAndKeeperDetailsDto: Option[VehicleAndKeeperDetailsDto])
object VehicleAndKeeperDetailsResponse {
implicit val JsonFormat = Json.format[VehicleAndKeeperDetailsResponse]
}
| package webserviceclients.vehicleandkeeperlookup
import play.api.libs.json.Json
final case class VehicleAndKeeperDetailsResponse(responseCode: Option[String],
vehicleAndKeeperDetailsDto: Option[VehicleAndKeeperDetailsDto])
object VehicleAndKeeperDetailsResponse {
implicit val JsonFormat = Json.format[VehicleAndKeeperDetailsResponse]
}
|
Add fen and last move to user game api | package lila.api
import play.api.libs.json._
import lila.common.PimpedJson._
import lila.game.{ Game, PerfPicker }
object UserApiGameJson {
import lila.round.JsonView._
implicit val writer: Writes[Game] = Writes[Game] { g =>
Json.obj(
"id" -> g.id,
"rated" -> g.rated,
"variant" -> g.variant,
"speed" -> g.speed.key,
"perf" -> PerfPicker.key(g),
"timestamp" -> g.createdAt.getDate,
"turns" -> g.turns,
"status" -> g.status,
"clock" -> g.clock,
"correspondence" -> g.correspondenceClock,
"opening" -> g.opening,
"players" -> JsObject(g.players map { p =>
p.color.name -> Json.obj(
"userId" -> p.userId,
"name" -> p.name,
"aiLevel" -> p.aiLevel,
"rating" -> p.rating,
"ratingDiff" -> p.ratingDiff
).noNull
}),
"opening" -> g.opening.map { o =>
Json.obj("code" -> o.code, "name" -> o.name)
},
"winner" -> g.winnerColor.map(_.name),
"bookmarks" -> g.bookmarks
).noNull
}
}
| package lila.api
import play.api.libs.json._
import lila.common.PimpedJson._
import lila.game.{ Game, PerfPicker }
import chess.format.Forsyth
object UserApiGameJson {
import lila.round.JsonView._
implicit val writer: Writes[Game] = Writes[Game] { g =>
Json.obj(
"id" -> g.id,
"rated" -> g.rated,
"variant" -> g.variant,
"speed" -> g.speed.key,
"perf" -> PerfPicker.key(g),
"timestamp" -> g.createdAt.getDate,
"turns" -> g.turns,
"status" -> g.status,
"clock" -> g.clock,
"correspondence" -> g.correspondenceClock,
"opening" -> g.opening,
"players" -> JsObject(g.players map { p =>
p.color.name -> Json.obj(
"userId" -> p.userId,
"name" -> p.name,
"aiLevel" -> p.aiLevel,
"rating" -> p.rating,
"ratingDiff" -> p.ratingDiff
).noNull
}),
"fen" -> Forsyth.exportBoard(g.toChess.board),
"lastMove" -> g.castleLastMoveTime.lastMoveString,
"opening" -> g.opening.map { o =>
Json.obj("code" -> o.code, "name" -> o.name)
},
"winner" -> g.winnerColor.map(_.name),
"bookmarks" -> g.bookmarks
).noNull
}
}
|
Add two new forms of crossover | package com
import scala.util.Random
trait RSCrossover {
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float])
}
class nullCrossover extends RSCrossover{
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float]) =
(a,b)
}
class twoPointCrossover extends RSCrossover {
val rand = new Random()
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float]) = {
val len = Math.min(a.size, b.size)
val (spA,spB) = {
val a = rand.nextInt(len+1)
val b = rand.nextInt(len+1)
if(a > b) (b, a)
else (a, b)
}
val diff = spB-spA
(a.patch(spA, b.slice(spA,spB), diff),
b.patch(spA, a.slice(spA,spB), diff) )
}
}
| package com
import scala.util.Random
trait RSCrossover {
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float])
}
class NullCrossover extends RSCrossover{
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float]) =
(a,b)
}
class TwoPointCrossover extends RSCrossover {
val rand = new Random()
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float]) = {
val len = Math.min(a.size, b.size)
val (spA,spB) = {
val a = rand.nextInt(len+1)
val b = rand.nextInt(len+1)
if(a > b) (b, a)
else (a, b)
}
val diff = spB-spA
(a.patch(spA, b.view(spA,spB), diff),
b.patch(spA, a.view(spA,spB), diff) )
}
}
class ArithmeticCrossover(range: Float) extends RSCrossover {
val rand = new Random()
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float]) = {
(a zip b).map{ case (x, y) =>
val r = rand.nextFloat * range
(x*(1.0f-r) + y*r, x*r + y*(1.0f-r))
} unzip
}
}
class UniformCrossover(flipChance: Float) extends RSCrossover {
val rand = new Random()
def apply(a: Seq[Float], b: Seq[Float]): (Seq[Float], Seq[Float]) = {
(a zip b).map{ case (x, y) =>
if(rand.nextFloat < flipChance) (y, x)
else (x, y)
} unzip
}
}
|
Prepare for integration tests over ultiple Play runtimes | // Comment to get more information during initialization
logLevel := Level.Warn
//resolvers += "Local Repository" at "http://localhost:8090/publish"
// Enable it for Play 2.0.3
//resolvers += "Typesafe releases" at "http://repo.typesafe.com/typesafe/releases"
resolvers += (Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath+"/.ivy2/local"))(Resolver.ivyStylePatterns))
resolvers += "Play2war plugins snapshot" at "http://repository-play-war.forge.cloudbees.com/snapshot/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.0.2")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "0.9-SNAPSHOT")
| // Comment to get more information during initialization
logLevel := Level.Warn
//resolvers += "Local Repository" at "http://localhost:8090/publish"
// Enable it for Play 2.0.3
resolvers += "Typesafe releases" at "http://repo.typesafe.com/typesafe/releases"
resolvers += (Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath+"/.ivy2/local"))(Resolver.ivyStylePatterns))
resolvers += "Play2war plugins snapshot" at "http://repository-play-war.forge.cloudbees.com/snapshot/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % Option(System.getProperty("play.version")).getOrElse("2.0.2"))
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "0.9-SNAPSHOT")
|
Comment out code that equires rabbitmq to be installed and running | package audit
import audit.Message.JsonWrites
import com.google.inject.Inject
import com.rabbitmq.client.ConnectionFactory
import play.api.Logger
import play.api.libs.json.Json.{stringify, toJson}
import utils.helpers.Config
final class AuditServiceImpl @Inject()(config: Config) extends AuditService {
override def send(auditMessage: Message): Unit = {
val factory = new ConnectionFactory()
factory.setHost(config.rabbitmqHost)
val connection = factory.newConnection() // TESTS NEED TO BE USING STUB SERVICE
try {
val channel = connection.createChannel()
try {
channel.queueDeclare(config.rabbitmqQueue, false, false, false, null)
val message = messageToSend(auditMessage).getBytes
channel.basicPublish("", config.rabbitmqQueue, null, message)
Logger.debug(s"Sent Audit message: $message")
} finally {
channel.close()
}
} finally {
connection.close()
}
}
private def messageToSend(auditMessage: Message) = {
val asJson = toJson(auditMessage)
stringify(asJson)
}
} | package audit
import audit.Message.JsonWrites
import com.google.inject.Inject
import com.rabbitmq.client.ConnectionFactory
import play.api.Logger
import play.api.libs.json.Json.{stringify, toJson}
import utils.helpers.Config
final class AuditServiceImpl @Inject()(config: Config) extends AuditService {
override def send(auditMessage: Message): Unit = {
// val factory = new ConnectionFactory()
// factory.setHost(config.rabbitmqHost)
// val connection = factory.newConnection() // TESTS NEED TO BE USING STUB SERVICE
// try {
// val channel = connection.createChannel()
// try {
// channel.queueDeclare(config.rabbitmqQueue, false, false, false, null)
// val message = messageToSend(auditMessage).getBytes
// channel.basicPublish("", config.rabbitmqQueue, null, message)
// Logger.debug(s"Sent Audit message: $message")
// } finally {
// channel.close()
// }
// } finally {
// connection.close()
// }
Logger.debug(s"Sent Audit message" + auditMessage)
}
private def messageToSend(auditMessage: Message) = {
val asJson = toJson(auditMessage)
stringify(asJson)
}
} |
Add a simple image cache | package com.davebsoft.sctw.ui
import _root_.scala.actors.Actor
import scala.actors.Actor._
import java.net.URL
import javax.swing.ImageIcon
/**
* Fetches pictures in the background, and calls a method in the event
* dispatching thread when done.
* @author Dave Briccetti
*/
case class FetchImage(val url: String)
class ImageReady(val url: String, val imageIcon: ImageIcon)
class PictureFetcher(processFinishedImage: (ImageReady) => Unit) extends Actor {
def act = while(true) receive {
case fi: FetchImage =>
if (mailboxSize == 0) {
SwingInvoke.invokeLater({processFinishedImage(new ImageReady(fi.url,
new ImageIcon(new URL(fi.url))))})
} // else ignore this request because of the newer one behind it
}
start
} | package com.davebsoft.sctw.ui
import _root_.scala.actors.Actor
import scala.actors.Actor._
import java.net.URL
import javax.swing.ImageIcon
/**
* Fetches pictures in the background, and calls a method in the event
* dispatching thread when done.
* @author Dave Briccetti
*/
case class FetchImage(val url: String)
class ImageReady(val url: String, val imageIcon: ImageIcon)
class PictureFetcher(processFinishedImage: (ImageReady) => Unit) extends Actor {
val imageCache = scala.collection.mutable.Map.empty[String, ImageIcon]
def act = while(true) receive {
case fi: FetchImage =>
if (mailboxSize == 0) {
val icon = imageCache.get(fi.url) match {
case Some(imageIcon) => imageIcon
case None => {
val newIcon = new ImageIcon(new URL(fi.url))
if (imageCache.size > 1000) imageCache.clear // TODO clear LRU instead?
imageCache(fi.url) = newIcon
newIcon
}
}
SwingInvoke.invokeLater({processFinishedImage(new ImageReady(fi.url, icon))})
} // else ignore this request because of the newer one behind it
}
start
} |
Build a correct URI of the maven repo for the sbt , was broken on windows | import sbt._
object Resolvers {
private val sonatypeRoot = "https://oss.sonatype.org/"
val sonatypeSnapshots = "Sonatype Snapshots" at sonatypeRoot + "content/repositories/snapshots/"
val sonatypeStaging = "Sonatype Staging" at sonatypeRoot + "service/local/staging/deploy/maven2/"
val localMaven = "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
}
| import sbt._
import java.nio.file.Paths
object Resolvers {
private val sonatypeRoot = "https://oss.sonatype.org/"
val sonatypeSnapshots = "Sonatype Snapshots" at sonatypeRoot + "content/repositories/snapshots/"
val sonatypeStaging = "Sonatype Staging" at sonatypeRoot + "service/local/staging/deploy/maven2/"
val localMaven = "Local Maven Repository" at Paths.get(Path.userHome.absolutePath + "/.m2/repository").toUri.toString
}
|
Make Debian/packageBin more resilient to versions | enablePlugins(PlayScala)
enablePlugins(SystemdPlugin)
bashScriptExtraDefines ++= Seq(
s"addJava -Dorg.quartz.properties=${defaultLinuxConfigLocation.value}/${(Linux / packageName).value}/quartz.properties",
"addJava -Dpidfile.path=/run/piezo-admin/piezo-admin.pid",
s"addJava -Dhttp.port=${PlayKeys.playDefaultPort.value}"
)
javaOptions += s"-Dorg.quartz.properties=${(Compile / resourceDirectory).value / "quartz.properties"}"
libraryDependencies ++= Seq(
jdbc,
"org.ow2.asm" % "asm" % "8.0.1",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"org.quartz-scheduler" % "quartz" % "2.1.7",
"com.softwaremill.macwire" %% "macros" % "2.3.3" % "provided",
specs2 % Test
)
maintainer := "Lucid Software, Inc. <ops@lucidchart.com>"
name := "piezo-admin"
packageDescription := "Piezo web admin"
PlayKeys.playDefaultPort := 8001
Debian/defaultLinuxStartScriptLocation := "/lib/systemd/system"
publishTo := sonatypePublishToBundle.value
| enablePlugins(PlayScala)
enablePlugins(SystemdPlugin)
bashScriptExtraDefines ++= Seq(
s"addJava -Dorg.quartz.properties=${defaultLinuxConfigLocation.value}/${(Linux / packageName).value}/quartz.properties",
"addJava -Dpidfile.path=/run/piezo-admin/piezo-admin.pid",
s"addJava -Dhttp.port=${PlayKeys.playDefaultPort.value}"
)
javaOptions += s"-Dorg.quartz.properties=${(Compile / resourceDirectory).value / "quartz.properties"}"
libraryDependencies ++= Seq(
jdbc,
"org.ow2.asm" % "asm" % "8.0.1",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"org.quartz-scheduler" % "quartz" % "2.1.7",
"com.softwaremill.macwire" %% "macros" % "2.3.3" % "provided",
specs2 % Test
)
Debian/version := {
val noDashVersion = (Compile/version).value.replace("-", "~")
if (noDashVersion.matches("^\\d.*")) {
noDashVersion
} else {
"0~" + noDashVersion
}
}
maintainer := "Lucid Software, Inc. <ops@lucidchart.com>"
name := "piezo-admin"
packageDescription := "Piezo web admin"
PlayKeys.playDefaultPort := 8001
Debian/defaultLinuxStartScriptLocation := "/lib/systemd/system"
publishTo := sonatypePublishToBundle.value
|
Use snapshot version of sbt | /**
* Copyright (C) 2012 Typesafe, Inc. <http://www.typesafe.com>
*/
import sbt._
import sbt.Keys._
object ZincBuild extends Build {
val sbtVersion = "0.13.1-M1"
val resolveSbtLocally = SettingKey[Boolean]("resolve-sbt-locally")
lazy val buildSettings = Defaults.defaultSettings ++ Seq(
organization := "com.typesafe.zinc",
version := "0.3.1-SNAPSHOT",
scalaVersion := "2.10.3",
crossPaths := false
)
lazy val zinc = Project(
"zinc",
file("."),
settings = buildSettings ++ Version.settings ++ Publish.settings ++ Scriptit.settings ++ Seq(
resolveSbtLocally := false,
resolvers <+= resolveSbtLocally { local => if (local) Resolver.mavenLocal else Opts.resolver.sonatypeSnapshots },
libraryDependencies ++= Seq(
"com.typesafe.sbt" % "incremental-compiler" % sbtVersion,
"com.typesafe.sbt" % "compiler-interface" % sbtVersion classifier "sources",
"com.martiansoftware" % "nailgun-server" % "0.9.1" % "optional"
),
scalacOptions ++= Seq("-feature", "-deprecation", "-Xlint")
)
)
lazy val dist = Project(
id = "dist",
base = file("dist"),
settings = buildSettings ++ Dist.settings
)
}
| /**
* Copyright (C) 2012 Typesafe, Inc. <http://www.typesafe.com>
*/
import sbt._
import sbt.Keys._
object ZincBuild extends Build {
val sbtVersion = "0.13.1-SNAPSHOT"
val resolveSbtLocally = SettingKey[Boolean]("resolve-sbt-locally")
lazy val buildSettings = Defaults.defaultSettings ++ Seq(
organization := "com.typesafe.zinc",
version := "0.3.1-SNAPSHOT",
scalaVersion := "2.10.3",
crossPaths := false
)
lazy val zinc = Project(
"zinc",
file("."),
settings = buildSettings ++ Version.settings ++ Publish.settings ++ Scriptit.settings ++ Seq(
resolveSbtLocally := false,
resolvers <+= resolveSbtLocally { local => if (local) Resolver.mavenLocal else Opts.resolver.sonatypeSnapshots },
libraryDependencies ++= Seq(
"com.typesafe.sbt" % "incremental-compiler" % sbtVersion,
"com.typesafe.sbt" % "compiler-interface" % sbtVersion classifier "sources",
"com.martiansoftware" % "nailgun-server" % "0.9.1" % "optional"
),
scalacOptions ++= Seq("-feature", "-deprecation", "-Xlint")
)
)
lazy val dist = Project(
id = "dist",
base = file("dist"),
settings = buildSettings ++ Dist.settings
)
}
|
Update configuration to record version 0.2.6 | import play.PlayImport.PlayKeys._
name := "lib-play"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.8"
crossScalaVersions := Seq("2.11.8")
version := "0.2.5"
lazy val root = project
.in(file("."))
.enablePlugins(PlayScala)
.settings(
libraryDependencies ++= Seq(
ws,
filters,
"com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
"org.scalatestplus" %% "play" % "1.4.0" % "test"
),
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
credentials += Credentials(
"Artifactory Realm",
"flow.artifactoryonline.com",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
| import play.PlayImport.PlayKeys._
name := "lib-play"
organization := "io.flow"
scalaVersion in ThisBuild := "2.11.8"
crossScalaVersions := Seq("2.11.8")
version := "0.2.6"
lazy val root = project
.in(file("."))
.enablePlugins(PlayScala)
.settings(
libraryDependencies ++= Seq(
ws,
filters,
"com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
"org.scalatestplus" %% "play" % "1.4.0" % "test"
),
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
credentials += Credentials(
"Artifactory Realm",
"flow.artifactoryonline.com",
System.getenv("ARTIFACTORY_USERNAME"),
System.getenv("ARTIFACTORY_PASSWORD")
)
)
publishTo := {
val host = "https://flow.artifactoryonline.com/flow"
if (isSnapshot.value) {
Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
} else {
Some("Artifactory Realm" at s"$host/libs-release-local")
}
}
|
Use user service to save dynamically-generated test users. | package security
import play.api.test.{DefaultAwaitTimeout, FutureAwaits}
import repository.ProfileRepository
import securesocial.core.providers.UsernamePasswordProvider
import securesocial.core.services.SaveMode
import securesocial.core.{AuthenticationMethod, BasicProfile, PasswordInfo}
import utils.UniqueStrings
trait UserGeneration extends UniqueStrings with FutureAwaits with DefaultAwaitTimeout {
def generateUnregisteredUser = {
val someUniqueString = uniqueString
User(firstName = s"FirstName-$someUniqueString", userId = s"test-userid-$someUniqueString@nomail.com", password = s"test-password-$someUniqueString")
}
def generateRegisteredUser: User = registerUser(generateUnregisteredUser)
def registerUser(user: User): User = {
val hash = PasswordHash.hash(user.password)
val profile = BasicProfile(
providerId = UsernamePasswordProvider.UsernamePassword,
userId = user.userId,
firstName = Some(user.firstName),
lastName = None,
fullName = None,
email = Some(user.userId),
avatarUrl = None,
authMethod = AuthenticationMethod.UserPassword,
oAuth1Info = None,
oAuth2Info = None,
passwordInfo = Some(PasswordInfo(hasher = "bcrypt", password = hash.hashed, salt = Some(hash.salt)))
)
await(new ProfileRepository {}.save(profile, SaveMode.SignUp))
user
}
}
| package security
import play.api.test.{DefaultAwaitTimeout, FutureAwaits}
import securesocial.core.providers.UsernamePasswordProvider
import securesocial.core.services.SaveMode
import securesocial.core.{AuthenticationMethod, BasicProfile, PasswordInfo}
import utils.UniqueStrings
trait UserGeneration extends UniqueStrings with FutureAwaits with DefaultAwaitTimeout {
def generateUnregisteredUser = {
val someUniqueString = uniqueString
User(firstName = s"FirstName-$someUniqueString", userId = s"test-userid-$someUniqueString@nomail.com", password = s"test-password-$someUniqueString")
}
def generateRegisteredUser: User = registerUser(generateUnregisteredUser)
def registerUser(user: User): User = {
val hash = PasswordHash.hash(user.password)
val profile = BasicProfile(
providerId = UsernamePasswordProvider.UsernamePassword,
userId = user.userId,
firstName = Some(user.firstName),
lastName = None,
fullName = None,
email = Some(user.userId),
avatarUrl = None,
authMethod = AuthenticationMethod.UserPassword,
oAuth1Info = None,
oAuth2Info = None,
passwordInfo = Some(PasswordInfo(hasher = "bcrypt", password = hash.hashed, salt = Some(hash.salt)))
)
await(SecurityEnvironment.userService.save(profile, SaveMode.SignUp))
user
}
}
|
Update nscplugin, sbt-scala-native, ... to 0.4.5 | addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0")
val sbtSoftwareMillVersion = "2.0.9"
addSbtPlugin(
"com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion
)
addSbtPlugin(
"com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion
)
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")
| addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0")
val sbtSoftwareMillVersion = "2.0.9"
addSbtPlugin(
"com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion
)
addSbtPlugin(
"com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion
)
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.5")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")
|
Add in coverage testing - got 100% statement and branch coverage first time on this commit. Whooh! | addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.11")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
| addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.11")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
|
Add scala-reflect as it is somehow needed during native-image compilation | name := "bootcompiler"
version := "2.0-SNAPSHOT"
scalaVersion := "2.11.7"
scalacOptions ++= Seq("-deprecation", "-optimize")
libraryDependencies += "com.lihaoyi" %% "fastparse" % "0.3.7"
seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)
EclipseKeys.withSource := true
| name := "bootcompiler"
version := "2.0-SNAPSHOT"
scalaVersion := "2.11.7"
scalacOptions ++= Seq("-deprecation", "-optimize")
libraryDependencies += "com.lihaoyi" %% "fastparse" % "0.3.7"
// native-image needs it
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)
EclipseKeys.withSource := true
|
Change HikerTest file to more idiomatic Scala |
import org.scalatest.FunSuite
class HikerSuite extends FunSuite {
test("the answer to life the universe and everything") {
val douglas = new Hiker
assert(douglas.answer() === (42))
}
} | import org.scalatest.FunSuite
class HikerSuite extends FunSuite {
test("the answer to life the universe and everything") {
assert(Hiker.answer == 42)
}
}
|
Remove unnecessary constructor in helper class | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package py_sparkling.ml.features
import org.apache.spark.ml.util.Identifiable
class ColumnPruner(override val uid: String) extends org.apache.spark.ml.h2o.features.ColumnPruner(uid){
def this() = this(Identifiable.randomUID("h2oColRemover"))
}
| /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package py_sparkling.ml.features
class ColumnPruner(override val uid: String) extends org.apache.spark.ml.h2o.features.ColumnPruner(uid)
|
Switch organization name for sbt-pgp | // Play
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.7")
// Releasing
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
// Sonatype publishing
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
// PGP signing
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1") | // Play
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.7")
// Releasing
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
// Sonatype publishing
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
// PGP signing
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.