instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package de.unimarburg
package composition
import org.scalatest._
object functorInstanceFixtures {
trait F[+A] {
def foo: A
def other: Int
}
object IntF extends F[Int] {
def foo = 42
def other = 43
}
}
class FunctorInstanceReflectionTest extends FlatSpec with Shared {
import reflection.... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.javadsl.client.integration
import akka.actor.{ Actor, ActorRef, ActorSystem, Props }
import com.typesafe.config.ConfigFactory
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{ BeforeAndAfterEach,... |
Explain and rewrite the following Scala code: | package config
import com.google.inject.{Inject, Singleton}
import com.typesafe.config.Config
@Singleton
class MailConfig @Inject()(config: Config) {
val address: String = config.getString("email.address")
}
|
Explain and rewrite the following Scala code: | package org.genivi.sota.core.jsonrpc
import akka.http.scaladsl.marshalling.ToEntityMarshaller
import akka.http.scaladsl.model.ContentTypes
import akka.http.scaladsl.model.HttpEntity
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.StatusCode
import akka.http.scaladsl.model.StatusCodes
impor... |
Explain and rewrite the following Scala code: | package pro.boto.recommender.data.tables.product
object ProductColumn {
val productId:String = "productId"
val districto:String = "districto"
val concelho:String = "concelho"
val freguesia:String = "freguesia"
val latitude:String = "latitude"
val longitude:String = "longitude"
val typology:String = "typ... |
Explain and rewrite the following Scala code: | package com.avsystem.commons
package redis.commands
import com.avsystem.commons.redis._
import com.avsystem.commons.redis.commands.ReplyDecoders._
trait HashesApi extends ApiSubset {
/** Executes [[http://redis.io/commands/hdel HDEL]] */
def hdel(key: Key, field: Field): Result[Boolean] =
execute(new Hdel(key... |
Explain and rewrite the following Scala code: | package com.github.cuzfrog
import utest._
object TemplateTest extends TestSuite{
val tests = this{
'test1{
eventually()
}
}
} |
Explain and rewrite the following Scala code: | package com.snppts.backend
import org.scalatra._
import org.scalatra.json._
import com.snppts.backend.models._
import org.json4s.{DefaultFormats, Formats}
class SnippetController extends ScalatraServlet with JacksonJsonSupport {
protected implicit val jsonFormats: Formats = DefaultFormats
before() {
conten... |
Explain and rewrite the following Scala code: | /*
* ____ ____ _____ ____ ___ ____
* | _ \\ | _ \\ | ____| / ___| / _/ / ___| Precog (R)
* | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data
* | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, In... |
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api.test._
import play.api.test.Helpers._
/**
* add your integration spec here.
* An integration test will fire up a whole play application in a real (or headless) browser
*/
@RunWith(classOf[JUnitRunner])
class Integratio... |
Explain and rewrite the following Scala code: | package org.lolczak.util
import scala.annotation.tailrec
object Generators {
//todo refactor, generic version
def generate[A](f: A => Set[A], source: Set[A]): Set[A] = {
@tailrec
def recGen(oldSet: Set[A], newSet: Set[A]): Set[A] = {
val generated = newSet.flatMap(f)
if (generated.isEmpty) ol... |
Explain and rewrite the following Scala code: | package jp.gr.java_conf.hangedman.util.wiki
import java.io.File
import jp.gr.java_conf.hangedman.model.WikiPageLevel
import jp.gr.java_conf.hangedman.util.WikiUtil
sealed abstract class PageFlag
case object Create extends PageFlag
case object Update extends PageFlag
case object Remove extends PageFlag
/**
* FSWikiデ... |
Explain and rewrite the following Scala code: |
object Main {
def main(args: Array[String]) = {
val win = new JuliaFrame(700, 500, new Mandelbrot)
}
}
|
Explain and rewrite the following Scala code: | package org.scaladebugger.api.profiles.java.requests.monitors
import com.sun.jdi.event.MonitorContendedEnterEvent
import org.scaladebugger.api.lowlevel.JDIArgument
import org.scaladebugger.api.lowlevel.events.EventManager
import org.scaladebugger.api.lowlevel.events.EventType._
import org.scaladebugger.api.lowlevel.m... |
Explain and rewrite the following Scala code: | package com.inneractive.cerberus
import java.io.{File, FileOutputStream}
import javax.xml.transform.stream.StreamResult
import com.typesafe.config.Config
import org.apache.spark.ml.PipelineModel
import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.types._
import org.apache.spark.{SparkConf, SparkContext... |
Explain and rewrite the following Scala code: | package dhg.pos.minmodel
import scala.collection.{ Map => CMap }
import scala.collection.{ Set => CSet }
import scala.collection.mutable.{ Map => MMap }
import scala.collection.mutable.{ Set => MSet }
import dhg.nlp.tag.TagUtils._
import dhg.nlp.tag.TagDict.OptionalTagDict
import dhg.nlp.tag.support.Viterbi
import dhg... |
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2013 Artima, Inc.
*
* 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 agre... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.structureView
import com.intellij.lang.Language
import com.intellij.testFramework.UsefulTestCase.assertThrows
import org.jetbrains.plugins.scala.ScalaLanguage
import org.jetbrains.plugins.scala.icons.Icons.{ABSTRACT_CLASS, CASE_CLASS, CLASS, ENUM, EXTENSION, FUNCTION, OBJECT, TRAIT,... |
Explain and rewrite the following Scala code: | package com.softwaremill.react.kafka
import java.util.{Properties, UUID}
import kafka.message.{DefaultCompressionCodec, NoCompressionCodec, SnappyCompressionCodec}
import kafka.producer.ProducerConfig
import kafka.serializer.Encoder
object ProducerProperties {
/**
* Producer Properties
*
* brokerList
... |
Explain and rewrite the following Scala code: | class A { val x = 1; var y = {x = 2; 3} }
object Main { def main(args: Array[String]) { } }
|
Explain and rewrite the following Scala code: | package com.eigengo.lift.exercise.classifiers.model
import akka.stream.{ActorFlowMaterializer, ActorFlowMaterializerSettings}
import akka.stream.scaladsl._
import akka.stream.testkit.{StreamTestKit, AkkaSpec}
import akka.testkit.TestActorRef
import com.eigengo.lift.exercise.UserExercisesClassifier.{Tap => TapEvent}
im... |
Explain and rewrite the following Scala code: | package com.twitter.zipkin.storage.mongodb.utils
import com.mongodb.casbah.Imports._
trait Index {
def apply(collection: MongoCollection): Unit
}
object Index {
abstract class WithOptions(key: String, options: MongoDBObject) extends Index {
override def apply(collection: MongoCollection): Unit = collection.... |
Explain and rewrite the following Scala code: | ///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
//
// 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 ... |
Explain and rewrite the following Scala code: | package scorex.unit
import org.scalatest.FunSuite
import scorex.account.PrivateKeyAccount
import scorex.block.{Block, BlockStub}
import scorex.consensus.nxt.{NxtBlockGenerationData, NxtBlockGenerationDataParser}
import scorex.consensus.qora.{QoraBlockGenerationData, QoraBlockGenerationFunctions}
import scorex.consensu... |
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | package controllers
import org.vindinium.server._
import akka.pattern.{ ask, pipe }
import play.api._
import play.api.libs.Comet.CometMessage
import play.api.libs.EventSource
import play.api.libs.iteratee._
import play.api.libs.json._
import play.api.mvc._
import scala.concurrent.duration._
import scala.concurrent.Ex... |
Explain and rewrite the following Scala code: | package edu.tum.cs.isabelle
import java.net.{URL, URLClassLoader}
import java.nio.file.Path
import scala.util.control.Exception._
import edu.tum.cs.isabelle.api._
import acyclic.file
object Implementations {
/**
* An empty managed [[Implementations set of implementations]].
*
* New implementations can ... |
Explain and rewrite the following Scala code: | package org.scalameta.contexts
import scala.language.experimental.macros
import scala.annotation.StaticAnnotation
import scala.reflect.macros.whitebox.Context
class context(translateExceptions: Boolean = false) extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro ContextMacros.impl
}
class C... |
Explain and rewrite the following Scala code: | package com.alanrodas
import org.scalatest._
package object fronttier {
abstract class UnitSpec extends FlatSpec with Matchers
}
|
Explain and rewrite the following Scala code: | package dotty.tools
package dotc
package typer
import core._
import ast.{Trees, untpd, tpd, TreeInfo}
import util.Positions._
import util.Stats.{track, record, monitored}
import printing.Showable
import Contexts._
import Types._
import Flags._
import Mode.ImplicitsEnabled
import Denotations._
import NameOps._
import S... |
Explain and rewrite the following Scala code: | package java.nio.charset
class CoderMalfunctionError(cause: Exception) extends Error(cause)
|
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | package com.example
import akka.actor.{ActorSystem, Props}
import akka.io.IO
import spray.can.Http
object Boot extends App {
implicit val system = ActorSystem("on-spray-can")
val service = system.actorOf(Props[MyServiceActor], "demo-service")
val port = Option(System.getenv("PORT")).getOrElse("8080").toInt
... |
Explain and rewrite the following Scala code: | /*
* (c) Copyright 2016 Hewlett Packard Enterprise Development LP
*
* 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 b... |
Explain and rewrite the following Scala code: | package water.api
/**
* Generic implementation endpoint for all RDD queries.
*/
class RDDsBase[I <: RDDs, S <: RDDsBase[I,S]] extends Schema[I,S] {
@API(help = "List of RDDs", direction = API.Direction.OUTPUT)
val rdds: Array[RDDV3] = null
}
|
Explain and rewrite the following Scala code: | package mesosphere.marathon.api.v2
import javax.servlet.http.HttpServletRequest
import javax.ws.rs._
import javax.ws.rs.core.{ Context, MediaType, Response }
import com.codahale.metrics.annotation.Timed
import mesosphere.marathon.api.v2.json.Formats._
import mesosphere.marathon.api.{ AuthResource, MarathonMediaType }... |
Explain and rewrite the following Scala code: | package ml.combust.mleap.executor.error
class AlreadyExistsException(message: String,
cause: Throwable) extends ExecutorException(message, cause) {
def this(message: String) = this(message, null)
def this(err: Throwable) = this(err.getMessage, err)
}
|
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | package algebra
package lattice
import scala.{specialized => sp}
trait BoundedJoinSemilattice[@sp(Int, Long, Float, Double) A] extends Any with JoinSemilattice[A] { self =>
def zero: A
def isZero(a: A)(implicit ev: Eq[A]): Boolean = ev.eqv(a, zero)
override def joinSemilattice: BoundedSemilattice[A] =
new ... |
Explain and rewrite the following Scala code: | package com.twitter.diffy.lifter
import com.twitter.diffy.ParentSpec
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class JsonLifterSpec extends ParentSpec {
describe("JsonLifter"){
it("should correctly lift maps when keys are invalid identifier prefixes") ... |
Explain and rewrite the following Scala code: | /**
* 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... |
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | /*
Copyright (c) 2010, Tobias Knerr
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the foll... |
Explain and rewrite the following Scala code: | package jp.co.cyberagent.aeromock.server.http
import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.http.{HttpResponseStatus, HttpResponse, FullHttpRequest}
import jp.co.cyberagent.aeromock.config.Project
import jp.co.cyberagent.aeromock.helper.DeepTraversal._
import jp.co.cyberagent.aeromock.hel... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package specs2
import play.api.mvc.ControllerHelpers
import play.api.mvc.RequestHeader
import play.api.test.PlaySpecification
import scala.concurrent.Future
// #scalatest-examplemessagesspec
class ExampleMessagesSpec extends PlaySpecification with C... |
Explain and rewrite the following Scala code: | package chessgame
object Chess extends Moves {
val p = "Z1"
val xOpt = p(0) match {
case 'A' => Some(N1)
case 'B' => Some(N2)
case 'C' => Some(N3)
case 'D' => Some(N4)
case 'E' => Some(N5)
case 'F' => Some(N6)
case 'G' => Some(N7)
case 'H' => Some... |
Explain and rewrite the following Scala code: | /**
* 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... |
Explain and rewrite the following Scala code: | package common.graphql
import akka.http.scaladsl.model.HttpHeader
import akka.http.scaladsl.model.Multipart.FormData
import akka.http.scaladsl.model.headers.HttpCookie
import akka.stream.scaladsl.Source
import modules.socket.WebSocketMessageContext
import scala.collection.mutable.ListBuffer
case class UserContext(
... |
Explain and rewrite the following Scala code: | package skinny.splash.controller.feature
import java.util.Locale
import skinny.splash.SprayRequest
trait LocaleFeature {
def currentLocale(implicit currentRequest: SprayRequest): Option[Locale] = None
}
|
Explain and rewrite the following Scala code: | package cromwell.core.actor
import akka.actor.{ActorRef, Cancellable, FSM}
import cats.data.NonEmptyVector
import cromwell.core.actor.BatchingDbWriter._
import cromwell.util.GracefulShutdownHelper.ShutdownCommand
import org.slf4j.LoggerFactory
import scala.util.{Failure, Success, Try}
/** A collection of state, dat... |
Explain and rewrite the following Scala code: | package com.wiredforcode.groovy.extensions.scala
import java.util.concurrent.TimeUnit.SECONDS
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
object FutureExtensions {
def result[T](f: Future[T]): T = Await.result(f, Duration(10, SECONDS))
def result[T](f: Future[T], amount: Int): T =... |
Explain and rewrite the following Scala code: | package opennlp.textgrounder.geolocate
import NlpUtil._
/**
TextGrounder-specific information (e.g. env vars).
*/
object TextGrounderInfo {
val textgrounder_dir = System.getenv("TEXTGROUNDER_DIR")
if (textgrounder_dir == null) {
errprint("""TEXTGROUNDER_DIR must be set to the top-level directory where
Text... |
Explain and rewrite the following Scala code: | object A
{
//def x = 3
def x: String = 3
//def x: String = "3"
} |
Explain and rewrite the following Scala code: | package net.rrm.ehour.ui.manage.project.assign
import net.rrm.ehour.domain.User
import net.rrm.ehour.ui.common.panel.AbstractBasePanel
import org.apache.wicket.markup.html.basic.Label
import org.apache.wicket.model.Model
class AffectedUserPanel(id: String, user: User) extends AbstractBasePanel[String](id, new Model[S... |
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | package com.learning.akka.fault.tolerance
import akka.actor.SupervisorStrategy.Stop
import akka.actor.{Props, ActorSystem, OneForOneStrategy, Actor}
import akka.event.LoggingReceive
import akka.util.Timeout
import com.typesafe.config.ConfigFactory
import scala.concurrent.Future
import scala.concurrent.duration._
impor... |
Explain and rewrite the following Scala code: | package com.datawizards.dmg
import java.sql.Timestamp
import java.sql.Date
import com.datawizards.dmg.annotations._
import com.datawizards.dmg.annotations.hive._
import com.datawizards.dmg.annotations.es._
object TestModel {
case class Person(name: String, age: Int)
case class ClassWithAllSimpleTypes(
strVal... |
Explain and rewrite the following Scala code: | /* Copyright (C) 2008-2014 University of Massachusetts Amherst.
This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible)
http://factorie.cs.umass.edu, http://github.com/factorie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with... |
Explain and rewrite the following Scala code: | /*
* Copyright 2013 Akiyoshi Sugiki, University of Tsukuba
*
* 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 a... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2013 the original author or authors.
*
* 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 ap... |
Explain and rewrite the following Scala code: | package common
import akka.actor.{Actor, ActorRef}
case object CONNECT
case object KILL
case object FINISHED
|
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | package dtos.report.row
import scala.beans.BeanProperty
import java.util
import java.lang.Double
import dtos.report.TaskDto
import dtos.report.qlkh.TaskReportBean
/**
* The Class PhongBanKhoiLuongRow.
*
* @author Nguyen Duc Dung
* @since 4/15/14 12:53 PM
*
*/
class PhongBanKhoiLuongRow {
@BeanProperty
var t... |
Explain and rewrite the following Scala code: | import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api.test._
@RunWith(classOf[JUnitRunner])
class IntegrationSpec extends Specification {
"Application" should {
"show the index page" in new WithBrowser {
browser.goTo("http://localhost:" + port)
browser.pag... |
Explain and rewrite the following Scala code: | // -----------------------------------------------------------------------------
//
// Scalax - The Scala Community Library
// Copyright (c) 2005-8 The Scalax Project. All rights reserved.
//
// The primary distribution site is http://scalax.scalaforge.org/
//
// This software is released under the terms of the Rev... |
Explain and rewrite the following Scala code: | /*
* Copyright 2019 ACINQ SAS
*
* 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... |
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | /*
* 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 ... |
Explain and rewrite the following Scala code: | package services.security
import play.api.mvc._
import models.User
trait Authentication { this: Controller =>
def Authenticated(action: User => Request[AnyContent] => Result) = Action { implicit request =>
session.get("id") match {
case Some(userId) => action(User.create(userId))(request)
... |
Explain and rewrite the following Scala code: | package se.lu.nateko.cp.meta.services.upload
import java.net.URI
import scala.util.Failure
import scala.util.Success
import scala.util.Try
import org.eclipse.rdf4j.model.IRI
import org.eclipse.rdf4j.model.vocabulary.RDF
import akka.NotUsed
import se.lu.nateko.cp.cpauth.core.UserId
import se.lu.nateko.cp.meta.DataOb... |
Explain and rewrite the following Scala code: | //
// author: Cosmin Basca
//
// Copyright 2010 University of Zurich
//
// 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 r... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014-2022 Netflix, Inc.
*
* 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 agr... |
Explain and rewrite the following Scala code: | /***
* Copyright 2014 Rackspace US, Inc.
*
* 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 applica... |
Explain and rewrite the following Scala code: | package de.kaufhof.hajobs.testutils
import java.util.UUID
import com.datastax.driver.core.utils.UUIDs
import de.kaufhof.hajobs.{JobStatus, JobStatusRepository, JobType, LockRepository}
import org.mockito.ArgumentMatchers._
import org.mockito.Mockito._
import org.mockito.invocation.InvocationOnMock
import org.mockito.... |
Explain and rewrite the following Scala code: | package com.blinkbox.books.spray
import com.blinkbox.books.spray.Paging._
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class PagingTest extends FunSuite {
val baseUrl = "/my/base/url"
test("links for first page, including thi... |
Explain and rewrite the following Scala code: | package controllers
object WidgetForm {
import play.api.data.Forms._
import play.api.data.Form
/**
* A form processing DTO that maps to the form below.
*
* Using a class specifically for form binding reduces the chances
* of a parameter tampering attack and makes code clearer.
*/
case class Dat... |
Explain and rewrite the following Scala code: | // Hygienic Macros
// New to Scala 2.10 (SIP-16)
//
// The macros feature is still evolving. Here's a good starting
// place for details on the current implementation and future plans:
// http://scalamacros.org/index.html
//
// In fact, this example, the code in macors-Print-sip16.scala, is adapted from:
// http://sc... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 http4s.org
*
* 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 i... |
Explain and rewrite the following Scala code: | package com.rasterfoundry.backsplash.export
import geotrellis.vector.Extent
object TilesForExtent {
// generate a list of tiles that fall under the provided latlng extent
def latLng(extent: Extent, zoom: Int): List[(Int, Int)] = {
val blLat = extent.ymax
val blLng = extent.xmin
val trLat = extent.ymi... |
Explain and rewrite the following Scala code: | package se.gigurra.wallace.gamemodel
import scala.collection.mutable
case class WorldUpdatesQue() {
private val queuedExternalUpdates = new mutable.HashMap[WorldSimFrameIndex, Seq[WorldUpdate]]
def pop(iFrame: WorldSimFrameIndex): Seq[WorldUpdate] = {
queuedExternalUpdates.remove(iFrame).getOrElse(Seq.empty... |
Explain and rewrite the following Scala code: | package japgolly.univeq
import scala.annotation.nowarn
import utest._
@nowarn("msg=will always yield")
object RuntimeTest extends TestSuite {
def assertExists[A: UnivEq]: Unit =
()
def assertId[A](a: A)(implicit u: UnivEq[A]): Unit =
assert(u.univEq(a, a))
def assertPass[A](as: A*)(implicit u: UnivEq... |
Explain and rewrite the following Scala code: | package de.jagile.fitparse
import java.io.{InputStream, FileInputStream}
import com.garmin.fit._
import org.specs2.mutable._
import java.nio.file.{Files, Paths, Path}
import scala.collection.JavaConversions._
import scala.collection.mutable
case class MinMaxAvg[T](min: Option[T], max: Option[T], avg: Option[T])
cas... |
Explain and rewrite the following Scala code: | package com.github.golem.test
import com.github.golem.army.Commander
import com.github.golem.army.command._
import com.github.golem.model.{Pass, Engine, Human, Put}
import com.github.golem.model.Board.{Stone, Coords}
import org.scalatest.Matchers._
import akka.testkit.TestActorRef
import com.github.golem.army.command.... |
Explain and rewrite the following Scala code: | package controller
import org.scalatest._
import skinny.micro.Format
import skinny.test.MockApiController
import unit.DBSettings
class AngularProgrammersControllerSpec extends FunSpec with Matchers with DBSettings {
def createMockController = new AngularXHRProgrammersController with MockApiController
describe("... |
Explain and rewrite the following Scala code: | /*
* 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
* distrib... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012-2020 the original author or authors.
*
* 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 ap... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.partitioning.zk
import com.twitter.finagle.{Addr, Address}
import java.net.InetSocketAddress
import org.scalacheck.Gen
import org.scalatest.FunSuite
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import scala.util.Random
class ZkMetadataTest extends FunSuite with ScalaC... |
Explain and rewrite the following Scala code: | object Main14 {
def main(args: Array[String]) = {
println("Hi 14!")
MainLeaf.main(Array.empty)
}
}
|
Explain and rewrite the following Scala code: | package nasa.nccs.wps
import nasa.nccs.caching.RDDTransientVariable
import nasa.nccs.cdapi.data.{RDDRecord}
import nasa.nccs.cdapi.tensors.CDFloatArray
import nasa.nccs.cdas.utilities.appParameters
import nasa.nccs.esgf.process.{DataFragmentSpec, TargetGrid}
import nasa.nccs.utilities.Loggable
import scala.xml
object... |
Explain and rewrite the following Scala code: | package org.bitcoins.dlc.oracle.storage
import org.bitcoins.core.api.dlcoracle.db.RValueDb
import org.bitcoins.core.hd.{HDCoinType, HDPurpose}
import org.bitcoins.crypto.SchnorrNonce
import org.bitcoins.db.{CRUD, DbCommonsColumnMappers, SlickUtil}
import org.bitcoins.dlc.oracle.config.DLCOracleAppConfig
import slick.l... |
Explain and rewrite the following Scala code: | package com.modelfabric.akka.actor
import akka.cluster.ClusterEvent.CurrentClusterState
import akka.cluster.MemberStatus
import akka.actor.Actor.Receive
import com.modelfabric.akka.cluster.MemberRegistry
/**
* An Akka Cluster State Handler can receive State messages
*/
trait ClusterStateHandler extends MemberRegist... |
Explain and rewrite the following Scala code: |
package com.twitter.zipkin.hadoop
import org.specs.Specification
import com.twitter.zipkin.gen
import com.twitter.scalding._
import com.twitter.zipkin.hadoop.sources.{SpanSource, Util}
import scala.collection.JavaConverters._
class ServerResponsetimeSpec extends Specification with TupleConversions {
noDetailedDiff... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) <2015-2016>, see CONTRIBUTORS
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 The BigDL Authors.
*
* 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 agr... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.http
import com.twitter.conversions.StorageUnitOps._
import com.twitter.finagle.stats.NullStatsReceiver
import com.twitter.finagle.{ListeningServer, Service}
import com.twitter.io.{Buf, Reader, ReaderDiscardedException}
import com.twitter.util.{Future, Promise, Return, StorageUnit, Throw}
i... |
Explain and rewrite the following Scala code: | package com.github.lstephen.ootp.ai.regression
import com.github.lstephen.ootp.ai.io.{Printable, Printables}
import com.github.lstephen.ootp.ai.player.Player
import com.github.lstephen.ootp.ai.player.ratings.{
BattingRatings,
PitchingRatings
}
import com.github.lstephen.ootp.ai.site.Site
import com.github.lstephen... |
Explain and rewrite the following Scala code: | /**
*
* IncomingTransactionAPI
* Ledger wallet
*
* Created by Pierre Pollastri on 09/02/15.
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Ledger
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal... |
Explain and rewrite the following Scala code: | package scala.collection.parallel
package mutable
import org.scalacheck._
import org.scalacheck.Gen
import org.scalacheck.Gen._
import org.scalacheck.Prop._
import org.scalacheck.Properties
import org.scalacheck.Arbitrary._
import scala.collection._
import scala.collection.parallel.ops._
abstract class ParallelAr... |
Explain and rewrite the following Scala code: | package bad.robot.temperature
import java.lang.Math._
import bad.robot.temperature.PercentageDifference.percentageDifference
import org.specs2.mutable.Specification
import scala.Double._
class PercentageDifferenceTest extends Specification {
"Increase as a percentage (and rounding)" >> {
percentageDifference... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.