instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /**
* This file is part of the TA Buddy project.
* Copyright (c) 2012-2014 Alexey Aksenov ezh@ezh.msk.ru
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Global License version 3
* as published by the Free Software Foundation with the addition... |
Explain and rewrite the following Scala code: | package fr.janalyse.ssh
import com.jcraft.jsch.{UserInfo, UIKeyboardInteractive}
/* Attention
* - L'option PasswordAuthentication doit être à "yes" sinon impossible de s'authentifier
* (Configuration au niveau du serveur SSH) SSI on n'implemente pas "promptKeyboardInteractive"
*
*/
case class SSHUserInfo(passwo... |
Explain and rewrite the following Scala code: | package skinny.controller
import org.scalatra.test.scalatest._
import scalikejdbc._
import skinny.orm.SkinnyCRUDMapper
import skinny.validator._
import skinny.ParamType
class SkinnyApiResourceSpec extends ScalatraFlatSpec {
behavior of "SkinnyApiResource"
Class.forName("org.h2.Driver")
GlobalSettings.loggingS... |
Explain and rewrite the following Scala code: | package com.github.ligangty.scala.jsoup.nodes
import com.github.ligangty.scala.jsoup.helper.Strings
import com.github.ligangty.scala.jsoup.helper.Validator._
import com.github.ligangty.scala.jsoup.nodes.Element._
import com.github.ligangty.scala.jsoup.parser.{Parser, Tag}
import com.github.ligangty.scala.jsoup.select.... |
Explain and rewrite the following Scala code: | package i.f.workshop.finch
import com.twitter.finagle.Httpx
import com.twitter.util.Await
import io.finch.request._
import io.finch.route._
object Greetings extends App {
// GET /hi/:name
val hi: Router[String] =
get("hi" / string) { name: String =>
s"Hi, $name!"
}
// GET /hello/:name?title=Mr.... |
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: | /* ## Project release process
*/
package ohnosequences.sbt.nice
import sbt._, Keys._, complete._, DefaultParsers._
import ohnosequences.sbt.nice.release._
case object ReleasePlugin extends sbt.AutoPlugin {
override def trigger = allRequirements
// TODO: almost all other plugins:
override def requires =
pl... |
Explain and rewrite the following Scala code: | package net.rrm.ehour.ui.admin.config.panel
import net.rrm.ehour.appconfig.EhourSystemConfig
import net.rrm.ehour.ui.admin.config.MainConfigBackingBean
import net.rrm.ehour.ui.common.component.{AjaxFormComponentFeedbackIndicator, ValidatingFormComponentAjaxBehavior}
import net.rrm.ehour.ui.common.panel.AbstractBasePan... |
Explain and rewrite the following Scala code: | package datasource
import akka.actor.{ActorRef, ActorSystem}
import akka.kafka.scaladsl.Consumer
import akka.kafka.{ConsumerSettings, Subscriptions}
import akka.stream.ActorMaterializer
import com.mongodb.BasicDBObject
import com.mongodb.util.JSON
import org.apache.kafka.common.serialization.StringDeserializer
import ... |
Explain and rewrite the following Scala code: | package endpoints.testsuite.client
import com.github.tomakehurst.wiremock.client.WireMock._
import endpoints.algebra.BasicAuthentication
import endpoints.testsuite.BasicAuthTestApi
trait BasicAuthTestSuite[T <: BasicAuthTestApi] extends ClientTestBase[T] {
def basicAuthSuite() = {
"Client interpreter" should ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2021 HM Revenue & Customs
*
* 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 a... |
Explain and rewrite the following Scala code: | package models.db
import honor.{Honors, HonorCategory}
import models.join.HonorWithAdmiral
import scalikejdbc._
case class Honor(
id: Long,
memberId: Long,
category: Int,
name: String,
setBadge: Boolean,
invisible: Boolean) {
def save()(implicit session: DBSession = Honor.autoSession): Hono... |
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 ... |
Explain and rewrite the following Scala code: | object Logarithms {
opaque type Logarithm = Double
object Logarithm {
// These are the ways to lift to the logarithm type
def apply(d: Double): Logarithm = math.log(d)
def safe(d: Double): Option[Logarithm] =
if (d > 0.0) Some(math.log(d)) else None
}
// Extension methods define opaque ty... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017 Magomed Abdurakhmanov, Hypertino
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
package com.hypertino.facade.filters.chain.after_rep... |
Explain and rewrite the following Scala code: | package com.microsoft.awt.routes
import com.microsoft.awt.data.SessionDAO
import com.microsoft.awt.data.SessionDAO._
import com.microsoft.awt.forms.MaxResultsForm
import com.microsoft.awt.models.Session
import org.scalajs.nodejs.express.{Application, Request, Response}
import org.scalajs.nodejs.mongodb._
import scala... |
Explain and rewrite the following Scala code: | package io.druid.indexer
import java.util.{Map => jMap}
import io.druid.segment.ProgressIndicator
import org.apache.spark.Logging
import org.apache.spark.sql.Row
import org.apache.spark.sql.types._
import org.joda.time.format.DateTimeFormatter
package object spark2 {
import scala.language.implicitConversions
ty... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 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 applicable l... |
Explain and rewrite the following Scala code: | package com.velankani.apps.connectxml
import org.apache.commons.cli.{Options, ParseException, PosixParser}
import org.apache.spark.mllib.linalg.Vector
import org.apache.spark.mllib.feature.HashingTF
import twitter4j.auth.OAuthAuthorization
import twitter4j.conf.ConfigurationBuilder
object Utils {
val CONSUMER_KEY ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 The SIRIS Project
*
* 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: | /*
* Copyright (C) 2015 Stratio (http://stratio.com)
*
* 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 app... |
Explain and rewrite the following Scala code: | package com.verizon.bda.trapezium.dal.solr
import java.io.File
import com.typesafe.config.{Config, ConfigFactory}
import org.apache.log4j.Logger
import scopt.OptionParser
object ClearSolrCluster {
case class ClearSolrNodes(configDir: String = null,
configFile: String = null,
... |
Explain and rewrite the following Scala code: | /* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt.internal.util
import Types._
/**
* A minimal heterogeneous list type. For background, see
* http://apocalisp.wordpress.com/2010/07/06/type-level-programming-in-scala-part-6a-heterogeneous-list basics/
*/
sealed trait HList {
type Wrap[M[_... |
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: | package com.twitter.finagle
import com.twitter.conversions.storage._
import com.twitter.finagle.client._
import com.twitter.finagle.dispatch.SerialServerDispatcher
import com.twitter.finagle.http.codec.{HttpClientDispatcher, HttpServerDispatcher}
import com.twitter.finagle.http.filter.DtabFilter
import com.twitter.fin... |
Explain and rewrite the following Scala code: | package net.scalytica.symbiotic.core.session
import japgolly.scalajs.react.Callback
import japgolly.scalajs.react.ScalazReact._
import japgolly.scalajs.react.extra.router._
import net.scalytica.symbiotic.models.AuthToken
import net.scalytica.symbiotic.models.party.User
import net.scalytica.symbiotic.routing.SymbioticR... |
Explain and rewrite the following Scala code: | package de.hska.wifl1011.ws1314.projektarbeit
class Auctioneer(auctionhouse: Auctionhouse, auctionsCount: Int) {
var auctions: Int = auctionsCount
while (auctions > 0) {
auctionhouse ! AddAuction(new Auction(scala.util.Random.nextInt()))
auctions -= 1
}
override def toString(): String = {
"Auc... |
Explain and rewrite the following Scala code: | package scorex.account
import scorex.crypto.EllipticCurveImpl
@SerialVersionUID(8568952246932352318L)
case class PrivateKeyAccount(seed: Array[Byte], privateKey: Array[Byte], override val publicKey: Array[Byte])
extends PublicKeyAccount(publicKey) {
def this(seed: Array[Byte], keyPair: (Array[Byte], Array[Byte])... |
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 ... |
Explain and rewrite the following Scala code: | import org.scalatest.FunSuite
case class Foo() {
}
class UserTests extends FunSuite {
test("a user should exist") {
val f = Foo()
assert(f != null)
}
}
|
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.ing.bakery.utils
import cats.implicits._
import cats.effect.{ContextShift, Effect, IO, Resource, Sync, Timer}
import org.scalactic.source
import org.scalatest.compatible.Assertion
import org.scalatest.funspec.FixtureAsyncFunSpecLike
import org.scalatest.{ConfigMap, FutureOutcome, Tag}
import scala.concurr... |
Explain and rewrite the following Scala code: | /*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictio... |
Explain and rewrite the following Scala code: | package home
import PortScanner.Scanner._
object Entry {
val usage: String = """
SKandy: Usage Guide
<run SKandy> -scanLocalForPort <port> :
Scans a local network for a particular port on all IPs
Prints all the found IPs
<run SKandy> -scanIPForPorts <IP> :
Scans a particular IP f... |
Explain and rewrite the following Scala code: | package nicol
import org.lwjgl.opengl.{GL11, DisplayMode, Display}
/**
* A Scene is an object that has a state and is a master to many other object. There may not be more than one Scene active
* at the same time.
*/
trait Scene extends (() => Unit) with Mutable {
def >>(that: Scene) = Scene {
this.apply
... |
Explain and rewrite the following Scala code: | package gitbucket.core.api
import gitbucket.core.model.CommitState
/**
* https://developer.github.com/v3/repos/statuses/#create-a-status
* api form
*/
case class CreateAStatus(
/* state is Required. The state of the status. Can be one of pending, success, error, or failure. */
state: String,
/* context is a ... |
Explain and rewrite the following Scala code: | package com.arcusys.learn.scorm.tracking.states.impl.liferay
import com.arcusys.learn.persistence.liferay.model.LFGlblObjectiveState
import com.arcusys.learn.persistence.liferay.service.{ LFActivityStateTreeLocalServiceUtil, LFGlblObjectiveStateLocalServiceUtil }
import com.arcusys.learn.storage.impl.liferay.LiferayCo... |
Explain and rewrite the following Scala code: | package io.aigar.game
import scala.math.round
import com.typesafe.scalalogging.LazyLogging
import com.github.jpbetz.subspace.Vector2
import io.aigar.score.ScoreModification
import io.aigar.game.Vector2Utils.Vector2Addons
object Virus {
final val Min = 10
final val Mass = 100
final val RespawnRetryAttempts = 15
... |
Explain and rewrite the following Scala code: | package by.bsuir.mastering.pavelverk.serialization
object StringUtil {
def generateRandomString(length : Int, mode : Mode) : String = {
val buffer = new StringBuffer()
val chars = mode.value
val charsLength = chars.length()
for (i <- 0 until length) {
val index : Int = (M... |
Explain and rewrite the following Scala code: | package org.singingwizard.genetics.prographs
import scala.runtime.ScalaRunTime
trait PortTag {
}
case class Port[T](name: String, tpe: Type[T], tags: Set[PortTag] = Set()) {
type ElementType = T
}
trait OperationBase {
val inputs: IndexedSeq[AnyPort]
val outputs: IndexedSeq[AnyPort]
override def toString()... |
Explain and rewrite the following Scala code: | // Jubatus: Online machine learning framework for distributed environment
// Copyright (C) 2014-2015 Preferred Networks and Nippon Telegraph and Telephone Corporation.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License version 2.1... |
Explain and rewrite the following Scala code: | package com.fulldeep.evaluation;
import com.fulldeep.indexation._
import com.fulldeep.modeles._
import scala.util.Random
class EvalIRModele(val model:IRmodele.IRmodele, val measure:EvalMeasure,val queries: List[Query]){
var mean :Seq[Float]=Seq()
var std :Seq[Float]=Seq()
var evalValue:Float=0.0f... |
Explain and rewrite the following Scala code: | object Settings {
// when changing this, also look at 'scripts/gradingImpl' and the files in s3/settings
// val courseId = "progfun-2012-001"
def baseURL(courseId: String) =
courseId match {
case "progfun-003" | "reactive-001" =>
"https://class.coursera.org/" + courseId
case "progfun-epfl... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 Mohiva Organisation (license at mohiva dot com)
*
* 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 req... |
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 ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2021 Asakusa Framework Team.
*
* 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 ... |
Explain and rewrite the following Scala code: | package com.eevolution.context.dictionary.domain.api.service
import com.eevolution.context.dictionary.api
import com.eevolution.context.dictionary.domain.model.Migration
trait MigrationService extends api.Service[Migration, Int] {
//Definition
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2019 CJWW Development
*
* 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 agree... |
Explain and rewrite the following Scala code: | package skinny.controller.feature
import skinny.Format
import skinny.engine.context.SkinnyEngineContext
import skinny.engine.json.EngineJSONStringOps
import skinny.engine.response.ResponseStatus
import skinny.logging.LoggerProvider
import skinny.exception.ViewTemplateNotFoundException
import skinny.json.JSONStringOpsC... |
Explain and rewrite the following Scala code: | package napplelabs.swish.commands
import napplelabs.swish.{ServerConfig, Swish}
/**
* Created by IntelliJ IDEA.
* User: zkim
* Date: Nov 30, 2009
* Time: 1:43:00 AM
* To change this template use File | Settings | File Templates.
*/
object ScpPullFile {
def apply(remoteFile: String, localPath: String, sc: S... |
Explain and rewrite the following Scala code: | package me.shadaj.gcj.parser
import java.io.PrintWriter
import scala.io.Source
import Timing._
class Problem[T <: TestCase: TestCaseSeqConverter] {
def solve(in: String, out: String, unneededLines: Int) {
val input = Source.fromFile(in)
val output = new PrintWriter(out)
input.getLines.drop(unneededLi... |
Explain and rewrite the following Scala code: | package opennlp.scalabha.classify
import opennlp.scalabha.util.LogNum
import scala.io.Source
/**
* An application that reads in a standard format set of CSVs representing
* instances, trains a Naive Bayes model, and then outputs the predictions
* on a second set of instances (ignoring the labels).
*/
object Class... |
Explain and rewrite the following Scala code: | package actors
import akka.actor.Actor
import play.api.libs.json.Json
import models.Category
class CategoriesActor extends Actor {
def receive = {
case ListCategories() =>
sender() ! Json.toJson(Category.list)
}
}
case class ListCategories() |
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 ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Frugal Mechanic (http://frugalmechanic.com)
*
* 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... |
Explain and rewrite the following Scala code: | package jp.co.bizreach.play2stub
import java.io.File
import java.net.{URL, URI}
import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.{ObjectMapper, JsonNode}
import jp.co.bizreach.play2stub.RoutesCompiler.Route
import org.apache.commons.io.{FilenameUtils, FileUtils}
import play.... |
Explain and rewrite the following Scala code: | package ee.cone.c4gate
import ee.cone.c4actor._
import ee.cone.c4di.c4
trait ActorAccessAppBase
trait ManagementAppBase extends ActorAccessApp /*with PrometheusApp*/ with SyncTxFactoryImplApp
// trait PrometheusAppBase extends DefPublishFullCompressorApp
trait AvailabilityAppBase
trait DefPublishFullCompressorAppBa... |
Explain and rewrite the following Scala code: | package signal
import collection.immutable._
object PSD {
/** Estimates the power spectral density of a signal.
*
* === Algorithm ===
* The PSD is estimated using a Fast Fourier Transform. The sequence of
* steps is as follows:
*
* 1. The signal is transformed using the FFT.
*
* ... |
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 ... |
Explain and rewrite the following Scala code: | package spark.storage
package object Selector {
type T = (Any) => Option[Any]
} |
Explain and rewrite the following Scala code: | package main.scala.overlapping.timeSeriesOld
import breeze.linalg.DenseVector
import main.scala.overlapping.containers.TSInstant
import scala.reflect.ClassTag
/**
* Created by Francois Belletti on 9/24/15.
*/
abstract class Predictor[IndexT : ClassTag]
extends Serializable{
def selection: (TSInstant[IndexT],... |
Explain and rewrite the following Scala code: | package temportalist.compression.main.client.model
import java.util
import com.google.common.base.Function
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.block.model.SimpleBakedModel.Builder
import net.minecraft.client.renderer.block.model.{BuiltInModel, IBakedModel, SimpleBakedModel}
impo... |
Explain and rewrite the following Scala code: | package utils.pageobjects.s_about_you
import utils.WithBrowser
import utils.pageobjects._
/**
* PageObject pattern associated to S7 about you EEA pension and insurance.
*/
final class GPaymentsFromAbroadPage(ctx:PageObjectsContext) extends ClaimPage(ctx, GPaymentsFromAbroadPage.url) {
declareYesNo("#eeaGuardQuest... |
Explain and rewrite the following Scala code: | import com.twitter.conversions.time._
import com.twitter.finagle.http.{HttpMuxer, Request, Response, Status}
import com.twitter.finagle.Service
import com.twitter.logging.Formatter
import com.twitter.server.TwitterServer
import com.twitter.util.{Await, Future, Time}
import java.net.InetSocketAddress
object AdvancedSer... |
Explain and rewrite the following Scala code: | /*
* @author Genc Mazlami
*
* Copyright 2013 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
*
* U... |
Explain and rewrite the following Scala code: | import scala.quoted._
class Foo {
def f[T2: Type](e: Expr[T2])(using QuoteContext) = e match {
case '{ $x: *:[Int, $t] } =>
'[ *:[Int, $t] ]
}
}
|
Explain and rewrite the following Scala code: | package jadeutils.xmpp.utils
import java.io.BufferedReader
import java.io.BufferedWriter
import java.io.Reader
import java.io.Writer
import java.io.InputStream
import java.io.InputStreamReader
import java.io.IOException
import java.io.OutputStream
import java.io.OutputStreamWriter
import java.net.Socket
import java.n... |
Explain and rewrite the following Scala code: | package com.github.andr83.parsek.formatter
import java.util.Locale
import com.github.andr83.parsek._
import com.github.nscala_time.time.Imports._
import org.joda.time.format.{DateTimeFormat, DateTimeFormatter}
/**
* @author andr83
*/
@SerialVersionUID(1L)
trait DateFormatter extends Serializable {
def format(dat... |
Explain and rewrite the following Scala code: | package sri.web.examples.styles
import sri.web.styles.WebStyleSheet
object Theme extends WebStyleSheet {
val flexOneAndCenter = style(flex := 1,
alignItems.center,
justifyContent.center)
val flexOneAndDirectionRow = style(flex := 1, flexDirection.row)
val bigText = style(fontWeight := "500",
font... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012-2014 Comcast Cable Communications Management, LLC
*
* 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
*
* Unl... |
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 scala.compiletime.ops.double.*
object Test {
summon[2.0 + 3.0 =:= 6.0 - 1.0]
summon[1763.0 =:= 41.0 * 43.0]
summon[2.0 + 2.0 =:= 3.0] // error
summon[29.0 * 31.0 =:= 900.0] // error
summon[Double <:< Double + 1.0] // error
summon[1.0 + Double <:< Double]
val t0: 2.0 + 3.0 = 5.0
val t1: 2.0 + 2.... |
Explain and rewrite the following Scala code: | /**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
/**
* @param options Additional arguments to the compiler.
For example, -deprecation.
* @param classpath The dependency classpath for this target, must ... |
Explain and rewrite the following Scala code: | /* date: Dec 16, 2011
FILE PORT <was CMD LINE ARGUMENT>
Provides the following services:
Extract filename: PathFile.getFileName(s)
Extract pathname: PathFile.getPathName(s)
Stores pathname in Session provided
current filename has path: Session.setPath(..)
If current filename lacks a pathname... |
Explain and rewrite the following Scala code: | trait Super[T]
case class Sub[T](v: T) extends Super[T]
def upgrade[I, O](f: I => Set[O]): I => Set[Super[O]] = f andThen (z => /*start*/z.map(Sub(_))/*end*/)
//Set[Super[O]] |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2008 Scalable Solutions.
*/
package se.scalablesolutions.skalman
import javax.persistence.{EntityManager, NoResultException}
import java.util.{List => JList}
import javax.ejb.{TransactionAttribute, TransactionAttributeType}
import scala.collection.jcl.Conversions._
import ManagedComponentCont... |
Explain and rewrite the following Scala code: | import scala.tools.partest._
object Test extends DirectTest {
override def extraSettings: String = "-usejavacp -Vprint:patmat,posterasure -Ystop-after:posterasure"
override def code =
"""object A {
| def unapplySeq(a: Int) = new collection.SeqFactory.UnapplySeqWrapper(collection.mutable.ArrayBuffer(1,... |
Explain and rewrite the following Scala code: | package scamr.io
import org.apache.hadoop.io.{Writable, IntWritable, ArrayWritable}
class IntArrayWritable(values: Array[IntWritable]) extends ArrayWritable(classOf[IntWritable]) {
if (values != null) this.set(values.asInstanceOf[Array[Writable]])
def this() = this(null)
}
|
Explain and rewrite the following Scala code: | /**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... |
Explain and rewrite the following Scala code: | package scalax.collection.constrained
import collection.Set
import org.scalatest.{Suite, Suites}
import org.scalatest.Informer
import org.scalatest.matchers.ShouldMatchers
import org.scalatest.Ignore
import scalax.collection.GraphPredef._
import scalax.collection.GraphEdge._
import generic.GraphFactory
imp... |
Explain and rewrite the following Scala code: | package com.earldouglas.xwp
import sbt._
import sbt.Def.taskKey
import sbt.Def.settingKey
import sbt.Keys._
object WarPlugin extends AutoPlugin {
import Keys.{`package` => pkg}
override def requires = WebappPlugin
object autoImport {
val inheritJarManifest =
settingKey[Boolean]("inherit .jar manifes... |
Explain and rewrite the following Scala code: | package com.karasiq.shadowcloud.server.http.webzinc
import java.net.{URI, URLDecoder}
import scala.concurrent.Future
import akka.NotUsed
import akka.http.scaladsl.model.headers.`Content-Disposition`
import akka.http.scaladsl.server.{Directives, Route}
import akka.stream.scaladsl.Source
import akka.util.ByteString
i... |
Explain and rewrite the following Scala code: | package coursier.bootstrap.launcher.credentials
import utest._
import scala.compat.java8.OptionConverters._
object DirectCredentialsTests extends TestSuite {
val tests = Tests {
test("no password in toString") {
val cred = new DirectCredentials("host", "alex", "1234")
assert(cred.getUsernameOpt.as... |
Explain and rewrite the following Scala code: | package edu.mit.csail.sdg.ormolu.form.ops
import edu.mit.csail.sdg.ormolu.rel.Relation
import edu.mit.csail.sdg.ormolu.form.Formula
import edu.mit.csail.sdg.hsqldb.data.access.table.Values
import edu.mit.csail.sdg.hsqldb.syntax.value.CaseSpec
import edu.mit.csail.sdg.hsqldb.data.access.Subquery
/**
* A co... |
Explain and rewrite the following Scala code: | package scala.collection
import scala.{collection => sc}
import scala.collection.{mutable => scm, immutable => sci, concurrent => scc}
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.junit.Test
import scala.reflect.ClassTag
import org.junit.Assert._
/* Tests various maps by making sure the... |
Explain and rewrite the following Scala code: | package equellatests.pages.moderate
import com.tle.webtests.framework.PageContext
import equellatests.browserpage.{CommonXPath, LoadablePage, TitledPage}
import equellatests.sections.search._
import org.openqa.selenium.By
case class ManageTasksPage(ctx: PageContext)
extends TitledPage("Manage tasks", "access/mana... |
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 mllib.perf.clustering
import java.util.Random
import breeze.linalg.{DenseMatrix => BDM, DenseVector => BDV}
import org.json4s.JValue
import org.json4s.JsonDSL._
import org.apache.spark.SparkContext
import org.apache.spark.mllib.clustering.GaussianMixture
import org.apache.spark.mllib.linalg.{Vector, Vectors}... |
Explain and rewrite the following Scala code: | import sbt._
object Version {
val hadoop = "2.6.0"
val logback = "1.1.2"
val mockito = "1.10.19"
val scala = "2.11.7"
val scalaTest = "2.2.4"
val slf4j = "1.7.6"
val spark = "1.6.0"
}
object Library {
val hadoopClient = "org.apache.hadoop" % "hadoop-client" % Version.hadoop
val logbackClassic = "ch.... |
Explain and rewrite the following Scala code: | package main.scala.dao;
/**
* @author terry
*/
object Scopus{
import main.scala.model.{Scopus=>ScopusObject}
def create(p:ScopusObject){
// query='INSERT INTO '+cf+' (scopus_eid,scopus_pii,scopus_ait_sort_date,'+
// 'scopus_doi,scopus_pmid,scopus_title,scopus_volume... |
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) 2015 Stratio (http://stratio.com)
*
* 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 app... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 helloscala.com
*
* 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 ... |
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 ... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015, deepsense.io
*
* 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 ... |
Explain and rewrite the following Scala code: | /**
* 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 i... |
Explain and rewrite the following Scala code: | package com.twitter.scalding
import scala.collection.mutable.{Buffer, ListBuffer}
import scala.annotation.tailrec
import cascading.tuple.Tuple
import cascading.tuple.TupleEntry
import org.apache.hadoop.mapred.JobConf
import org.apache.log4j.Logger
import org.apache.log4j.varia.NullAppender
object JobTest {
def appl... |
Explain and rewrite the following Scala code: | package net.sansa_stack.query.spark.datalake
import net.sansa_stack.datalake.spark.{Run, SparkExecutor}
import org.apache.spark.sql.{DataFrame, SparkSession}
object DataLakeEngine {
/**
* Run the sparkAll query engine
* @param queryFile the file containing queries or a single query
* @param mappingsFile t... |
Explain and rewrite the following Scala code: | package net.janvsmachine.fpinscala
import org.scalacheck.Gen
import org.scalacheck.Prop._
import org.scalatest.PropSpec
import Stream._
import org.scalatestplus.scalacheck
/**
* Tests for the Stream methods re-implemented using unfold.
* These should all behave as their explicitly implemented counterparts.
*/
clas... |
Explain and rewrite the following Scala code: | class C {
def foo: Int = 0
}
class E extends C {
override def foo: Int = {
(None: Option[Int]).getOrElse {
class C
E.super.foo
}
}
}
object Test {
def main(args: Array[String]) {
new E().foo
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.