instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
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 a {
abstract class BoxingConversions[Boxed, Unboxed] {
def box(x: Unboxed): Boxed
def unbox(x: Boxed): Unboxed
}
class Meter(val underlying: Double) extends AnyVal with _root_.b.Printable {
def + (other: Meter): Meter =
new Meter(this.underlying + other.underlying)
def / (other: Met... |
Explain and rewrite the following Scala code: | /*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala
/** Throwing th... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2017 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | package org.brandonhaynes.timr.checkpoints
import org.apache.hadoop.fs.{Path, PathFilter}
/** Input filter for jobs that utilize checkpointing. Because (at least by default) checkpoint strategies
* commit results to the DFS under the same location as the step output*, if we don't somehow filter these
* DFS files... |
Explain and rewrite the following Scala code: | package com.gregghz.room
import java.nio.file.Files
import sbinary.DefaultProtocol.StringFormat
import sbt._
import sbt.Cache.seqFormat
import sbt.Keys._
import scala.collection.JavaConverters._
import xsbt.api._
object RoomProcessing {
lazy val processRoomAnnotations: TaskKey[Unit] =
TaskKey[Unit]("processRoo... |
Explain and rewrite the following Scala code: | package org.broadinstitute.clio.server.dataaccess
import akka.NotUsed
import akka.stream.scaladsl.Source
import io.circe.syntax._
import io.circe.{Json, JsonObject}
import org.broadinstitute.clio.server.dataaccess.elasticsearch.ElasticsearchIndex
import org.broadinstitute.clio.transfer.model.ClioIndex
import scala.co... |
Explain and rewrite the following Scala code: | package dotty.tools.dotc
package transform
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core.Contexts._
import dotty.tools.dotc.core.DenotTransformers.IdentityDenotTransformer
import dotty.tools.dotc.core.Flags._
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core._
import dotty.tools.dotc.t... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.thrift.transport
import com.twitter.finagle.thrift.Protocols
import com.twitter.test.B.Client
import org.apache.thrift.transport.TMemoryBuffer
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
abstract class ... |
Explain and rewrite the following Scala code: | package com.greencatsoft.greenlight.grammar
object Predicates {
trait Empty extends Word {
override def description: String = "empty"
}
trait Defined extends Word {
override def description: String = "defined"
}
trait Words {
object empty extends Empty
object defined extends Defined
}
... |
Explain and rewrite the following Scala code: | package korolev
import java.util.concurrent.ConcurrentLinkedQueue
import scala.language.higherKinds
import scala.util.{Failure, Success}
abstract class Dux[F[+_]: Async, State] {
def state: State
def subscribe[U](f: State => U): Dux.Unsubscribe
def onDestroy[U](f: () => U): Dux.Unsubscribe
def destroy(): Uni... |
Explain and rewrite the following Scala code: | // Run with -explaintypes to see information about shadowing failures
import scala.reflect.{ClassTag, classTag}
object Test extends dotty.runtime.LegacyApp{
ObjectArrayClone;
PolymorphicArrayClone;
}
object ObjectArrayClone{
val it : Array[String] = Array("1", "0"); // error
val cloned = it.clone();... |
Explain and rewrite the following Scala code: | /*
* Shadowsocks - A shadowsocks client for Android
* Copyright (C) 2014 <max.c.lv@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at y... |
Explain and rewrite the following Scala code: | package ch.wsl.rest
import ch.wsl.model.shared.JSONField
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner
@RunWith(classOf[JUnitRunner])
class FormServiceSpec extends BaseSpec {
import ch.wsl.rest.service.JsonProtocol._
"Form masks" should {
"return the available form list" in {
... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Coral realtime streaming analytics (http://coral-streaming.github.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... |
Explain and rewrite the following Scala code: | package hr.element.beepo
package Model
package postgres
import org.pgscala.PGSessionFactory
import hr.ngs.patterns.IServiceLocator
class SmsIptRequestRepositoryPlus(
sessionFactory: PGSessionFactory
, locator : IServiceLocator
) extends SmsIptRequestRepository(sessionFactory, locator)
with ISmsIptRequestRep... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 Thomson Reuters
*
* 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 ag... |
Explain and rewrite the following Scala code: | package org.bitcoins.oracle.server
import akka.actor.ActorSystem
import akka.stream.scaladsl.Source
import org.bitcoins.commons.util.{DatadirParser, ServerArgParser}
import org.bitcoins.dlc.oracle.DLCOracle
import org.bitcoins.dlc.oracle.config.DLCOracleAppConfig
import org.bitcoins.server.routes.{BitcoinSServerRunner... |
Explain and rewrite the following Scala code: | /* Copyright 2009-2016 EPFL, Lausanne */
object Field1 {
abstract sealed class A
case class B(size: Int) extends A
def foo(): Int = {
val b = B(3)
b.size
} ensuring(_ == 3)
}
|
Explain and rewrite the following Scala code: | package no.netcompany.testdatagen.generators
// Copyright (C) 2014 Lars Reed -- GNU GPL 2.0 -- see LICENSE.txt
import no.netcompany.testdatagen.utils.IO
import no.netcompany.testdatagen.{ExtendedDelegate, ExtendedGenerator}
/**
* This generator reads lines from an input file and creates a list of values,
* from wh... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s.aliases
import com.sksamuel.elastic4s.http.index.admin.{AliasActionResponse, AliasExistsResponse}
import com.sksamuel.elastic4s.http.index.alias.{Alias, IndexAliases}
import com.sksamuel.elastic4s.Index
import com.sksamuel.elastic4s.testkit.DockerTests
import org.scalatest.{Matchers, Wor... |
Explain and rewrite the following Scala code: | package im.actor.server
import akka.actor._
import akka.contrib.pattern.DistributedPubSubExtension
import akka.kernel.Bootable
import akka.stream.ActorMaterializer
import im.actor.server.activation.gate.{ GateCodeActivation, GateConfig }
import im.actor.server.activation.internal.{ ActivationConfig, InternalCodeActiv... |
Explain and rewrite the following Scala code: | package com.bigjason.semver.internal
import com.bigjason.semver.Version
sealed trait Range {
def satisfiedBy(v: Version): Boolean
}
case class EqualTo(rhs: Version) extends Range {
override def satisfiedBy(v: Version): Boolean = v == rhs
}
case class GreaterThan(rhs: Version) extends Range {
override def sati... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012 Eike Kettner
*
* 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... |
Explain and rewrite the following Scala code: | package bench
// TODO These Case Exceptions move to Other File
case class ApplicationConfigException(msg: String) extends Exception
case class UnknownCSVFormatException(msg: String) extends Exception
case class UnknownMessageException(msg: String) extends Exception
case class NotASymbolicLinkException(msg: String) ext... |
Explain and rewrite the following Scala code: | package org.clulab.dynet
import java.io.PrintWriter
import edu.cmu.dynet.{Expression, ExpressionVector, GruBuilder, LstmBuilder, ParameterCollection, RnnBuilder}
import org.slf4j.{Logger, LoggerFactory}
import scala.collection.mutable.ArrayBuffer
import org.clulab.dynet.Utils._
import org.clulab.utils.Configured
/**... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 Dennis Vriend
*
* 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 t... |
Explain and rewrite the following Scala code: | package com.dominikgruber.fpinscala.chapter06
/**
* Exercise 10
* Generalize the functions unit, map, map2, flatMap, and sequence. Add them as
* methods on the State case class where possible. Otherwise you should put them
* in a State companion object.
*/
case class State[S,+A](run: S => (A,S)) {
import State.... |
Explain and rewrite the following Scala code: | package io.vamp.model.resolver
import io.vamp.common.Namespace
import io.vamp.common.notification.NotificationProvider
import io.vamp.model.artifact.LocalReference
import io.vamp.model.notification.ParserError
trait NamespaceValueResolver extends ValueResolver {
this: NotificationProvider ⇒
def resolveWithNamesp... |
Explain and rewrite the following Scala code: | package com.socrata.datacoordinator.resources.collocation
import com.rojoma.json.v3.ast.JString
import com.rojoma.json.v3.util.{AutomaticJsonCodecBuilder, JsonKeyStrategy, Strategy}
import com.socrata.datacoordinator.external.CollocationError
import com.socrata.datacoordinator.id.DatasetInternalName
import com.socrata... |
Explain and rewrite the following Scala code: | /*
* VariableElimination.scala
* Variable elimination algorithm.
*
* Created By: Avi Pfeffer (apfeffer@cra.com)
* Creation Date: Jan 1, 2009
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for information.
*
* See http://www.gith... |
Explain and rewrite the following Scala code: |
/*
Partial application
'partial' is a higher-order function for performing partial application.
The name comes from the fact that its input function is being applied to some but not
all of the arguments it requires.
It takes a parameter f, a function that needs params of type A and B to return a value
of type C... |
Explain and rewrite the following Scala code: | package chandu0101.scalajs.react.components.maps
import chandu0101.scalajs.react.components.fascades._
import chandu0101.scalajs.react.components.util.CommonUtils
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._
import org.scalajs.dom.{Event, document, html}
import scala.scalajs.js
impor... |
Explain and rewrite the following Scala code: | package test.scala
import fuel.util.{Parsers, Utils}
import org.junit.Test
import org.junit.Assert._
final class TestTools {
@Test
def testParsePropertiesFileEmpy(): Unit = {
val text =
"""
|
|
""".stripMargin
val opt = Parsers.parsePropertiesFile(text)
assertEquals(Map(), ... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017 Andrzej Jozwik
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publ... |
Explain and rewrite the following Scala code: | package com.twitter.server.handler
import com.twitter.concurrent.AsyncStream
import com.twitter.finagle.Service
import com.twitter.finagle.http.{ParamMap, Request, Response}
import com.twitter.finagle.tracing.SpanId
import com.twitter.io.{Reader, Buf}
import com.twitter.server.handler.EventRecordingHandler._
import co... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017 Mario Pastorelli (pastorelli.mario@gmail.com)
*
* 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 sonic
import cats.{Alternative,... |
Explain and rewrite the following Scala code: | /*
* OpenVC, an open source VHDL compiler/simulator
* Copyright (C) 2010 Christian Reisinger
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the ... |
Explain and rewrite the following Scala code: | package org.jetbrains.bsp.project.test.environment
import com.intellij.execution.configurations.RunConfiguration
import org.jetbrains.plugins.scala.testingSupport.test.scalatest.ScalaTestRunConfiguration
import org.jetbrains.plugins.scala.testingSupport.test.testdata.{AllInPackageTestData, ClassTestData}
import scala... |
Explain and rewrite the following Scala code: | package chapter.eight
import scala.collection.immutable.Stack
object ExerciseTen {
case class MyStack[+A](val myElems: List[A]) extends Stack[A](myElems)
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2014–2017 SlamData 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: | import scala.collection.JavaConverters._
// Mutable in-memory index. Used for mutable graphs where we care
// about performance.
class Index[K <% Ordered[K], V] {
// TODO(michaelochurch): replace with mutable.TreeMap when it exists
private val data = new java.util.TreeMap[K, Set[V]]
// Include (k, v) in the in... |
Explain and rewrite the following Scala code: | package com.twitter.io
import com.twitter.concurrent.AsyncStream
import com.twitter.io.Reader.ReaderDiscarded
import com.twitter.util.{Return, Await, Future, Promise}
import java.io.{ByteArrayOutputStream, OutputStream}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.prop.Ge... |
Explain and rewrite the following Scala code: | /* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\\___/_/... |
Explain and rewrite the following Scala code: | package com.cengallut.textual
import java.awt.event._
import scala.swing._
class ComponentEventDemo extends ComponentListener {
def componentHidden(e: ComponentEvent) = {
println("Component Hidden")
}
def componentMoved(e: ComponentEvent) = {
println("Component moved")
}
def componentResize... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 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: | /*
* Copyright (c) 2017 A. Alonso Dominguez
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge,... |
Explain and rewrite the following Scala code: | package model.ui
/**
* The menu point enumeration used for displaying the current active menu point on the page
*
* @author Stefan Bleibinhaus
*
*/
object MenuPoint extends Enumeration {
val Home = Value("Home")
val About = Value("About")
val Admin = Value("Admin")
} |
Explain and rewrite the following Scala code: | package keystoneml.nodes.learning
import breeze.linalg._
import edu.berkeley.cs.amplab.mlmatrix.{NormalEquations, RowPartitionedMatrix}
import keystoneml.nodes.stats.{StandardScaler, StandardScalerModel}
import keystoneml.nodes.util.Densify
import org.apache.spark.rdd.RDD
import keystoneml.utils.MatrixUtils
import key... |
Explain and rewrite the following Scala code: | package io.github.binaryfoo.lagotto
import scala.collection.mutable.ListBuffer
object Collapser {
def coalesce[T <: Coalesced with LogEntry](seq: Iterator[T], selector: T => String): Iterator[Coalesced] = {
case class CurrentGroup(key: String, members: ListBuffer[T]) {
def toStream: Stream[Coalesced] =... |
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: | /**
* © 2019 Refinitiv. 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 License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... |
Explain and rewrite the following Scala code: | package hu.bme.mit.ire.nodes.unary
import hu.bme.mit.ire.SingleForwarder
import hu.bme.mit.ire.messages.{ChangeSet, ReteMessage}
class MapperNode(override val next: (ReteMessage) => Unit,
val function: (Any) => Any, val index: Int,
override val expectedTerminatorCount: Int = 1
... |
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.twitter.finagle.memcached.unit.protocol.text
import com.twitter.finagle.memcached.protocol.text.client.ClientFramer
import com.twitter.io.Buf
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class FramerTest extends FunSuit... |
Explain and rewrite the following Scala code: | package io.ubiqesh.uplink.persistence.inmemory
import io.ubiqesh.uplink.vertx.UplinkServer
import io.ubiqesh.uplink.vertx.messaging.Endpoint
import org.slf4j.LoggerFactory
import io.ubiqesh.uplink.common.Path
import io.ubiqesh.uplink.vertx.event.changelog.ChangeLog
import io.ubiqesh.uplink.vertx.event.changelog.Change... |
Explain and rewrite the following Scala code: | /*
* Copyright 2018 Analytics Zoo 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... |
Explain and rewrite the following Scala code: | package bio4j.data.uniprot.flat
import bio4j.data.uniprot._, seqOps._
/*
Example:
```
ID CYC_BOVIN Reviewed; 104 AA.
ID GIA2_GIALA Reviewed; 296 AA.
ID Q5JU06_HUMAN Unreviewed; 268 AA.
```
*/
case class ID(val value: String) extends ... |
Explain and rewrite the following Scala code: | package spatial.codegen.scalagen
import argon.codegen.scalagen.ScalaCodegen
import argon.core._
import spatial.aliases._
trait ScalaGenControl extends ScalaCodegen {
def localMems: List[Exp[_]]
protected def emitControlDone(ctrl: Exp[_]): Unit = { }
protected def emitControlIncrement(ctrl: Exp[_], iter: Seq[B... |
Explain and rewrite the following Scala code: | import sbt._
class EscalatorProject(info: ProjectInfo) extends DefaultProject(info) {
val swing = "org.scala-lang" % "scala-swing" % "2.8.1"
val compiler = "org.scala-lang" % "scala-compiler" % "2.8.1"
val specs = "org.scala-tools.testing" %% "specs" % "1.6.7"
val scalacheck = "org.scala-tools.testing" %% "sca... |
Explain and rewrite the following Scala code: | class C
trait TypeMember {
type X
type Y
type Z
}
object Test extends TypeMember {
type A = X with Y
type B = Z with A
type F = A with B
def main(args: Array[String]): Unit = {
import reflect.runtime.universe._
val t1 = typeOf[F with C]
val t2 = typeOf[(A with B) with C]
val t3 = typeOf... |
Explain and rewrite the following Scala code: |
package com.spike.giantdataanalysis.spark.streaming
package object example {
import org.apache.spark.SparkConf
import org.apache.spark.streaming._
// configuration and context
val conf = new SparkConf().setMaster("local[2]").setAppName("Spark Streaming Examples")
val ssc = new StreamingContext(conf, Se... |
Explain and rewrite the following Scala code: | package com.docsearch.search
case class SearchResult(documentName: String, documentPosition: Int, score: Int)
|
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 breeze.linalg
/*
Copyright 2012 David Hall
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: | /**
* Copyright (c) 2016, Anthony Anderson<Illyohs>
* 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
* li... |
Explain and rewrite the following Scala code: | package net.ruippeixotog.scalafbp.runtime
/**
* A data structure holding the current data routes for a running network.
*
* This class provides efficient bidirectional querying: both the routes from a source (out) port and the routes to a
* target (in) port can be obtained in constant time. It also provides me... |
Explain and rewrite the following Scala code: | package com.criteo.vizatra.vizsql
class Optimizer(db : DB) {
def optimize(sel : SimpleSelect) : SimpleSelect = {
val newWhere = sel.where.map(preEvaluate)
val newProj = sel.projections.map {
case ExpressionProjection(exp, alias) => ExpressionProjection(preEvaluate(exp), alias)
case x => x
}
... |
Explain and rewrite the following Scala code: | package co.blocke.scalajack
package json4s
import org.json4s._
import org.json4s.{ Diff, JNothing, JObject }
import TestUtil._
import munit._
import munit.internal.console
import co.blocke.scalajack._
import co.blocke.scalajack.json4s._
import co.blocke.scala_reflection.RType
class Json4sSpec extends FunSuite:
val... |
Explain and rewrite the following Scala code: | package test.scala.com.skene
import org.specs2.mutable._
import org.specs2.mock._
import scala.concurrent._
import scala.concurrent.duration._
import java.util.concurrent.Executor
import com.roundeights.skene._
class RecoverTest extends Specification with Mockito {
/** Blocks while waiting for the given future ... |
Explain and rewrite the following Scala code: | package me.invkrh.raft.deploy.actor
import java.io.File
import scala.concurrent.Await
import scala.concurrent.duration._
import akka.actor.{ActorNotFound, ActorRef, Props}
import akka.testkit.TestProbe
import com.typesafe.config.ConfigFactory
import me.invkrh.raft.core.ServerConf
import me.invkrh.raft.deploy.remote... |
Explain and rewrite the following Scala code: | package org.liquidizer.snippet
import scala.xml._
import net.liftweb.util._
import net.liftweb.http._
import net.liftweb.http.js._
import net.liftweb.http.js.JsCmds._
import net.liftweb.common._
import net.liftweb.mapper._
import net.liftweb.util.Mailer._
import Helpers._
import org.liquidizer.model._
import org.li... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2022 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | package de.hska.wifl1011.seminararbeit
import scala.concurrent.{ future, Future }
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.Random
object Main {
type Tire = String
def getNewTireAsFuture(): Future[Tire] = future {
Thread.sleep(Random.nextInt(100))
"Tire By Brand XY"
}... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.codeInspection.monads
import com.intellij.codeInspection.ProblemsHolder
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.codeInspection.AbstractInspection
import org.jetbrains.plugins.scala.codeInspection.monads.NestedStatefulMonadsInspection._
import org.jetbra... |
Explain and rewrite the following Scala code: | //: ----------------------------------------------------------------------------
//: Copyright (C) 2015 Verizon. 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 Licen... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012-2016 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: | package reactivemongo.api.commands
import scala.util.control.NoStackTrace
import reactivemongo.bson.BSONValue
import reactivemongo.core.errors.DatabaseException
sealed trait WriteResult {
def ok: Boolean
def n: Int
def writeErrors: Seq[WriteError]
def writeConcernError: Option[WriteConcernError]
/** The ... |
Explain and rewrite the following Scala code: | package scala.generator
import java.util.UUID
import com.github.ghik.silencer.silent
import lib.Datatype
import lib.Text.{appendSpace, initLowerCase}
import play.api.libs.json._
import io.apibuilder.spec.v0.models.Deprecation
import scala.util.{Failure, Success, Try}
sealed trait ScalaDatatype {
def asString(orig... |
Explain and rewrite the following Scala code: | package chandu0101.scalajs.facades.examples.pages.components.pouchdb
import chandu0101.scalajs.facades.examples.pages.common.CodeExample
import chandu0101.scalajs.facades.examples.util.Constants._
import chandu0101.scalajs.facades.pouchdb.{PouchDB, ReplicateOptions}
import japgolly.scalajs.react._
import japgolly.scal... |
Explain and rewrite the following Scala code: | package compact_enumeration
import CustomData._
import Stub._
import scala.util._
/**
* @author gadgil
*/
object Verify {
/**
* Attempts to prove positivity on domain by gluing
* @param func given function
* @param domain (full) interval
*
* @param pfs given proofs, only those giving positiv... |
Explain and rewrite the following Scala code: | package org.ucl.compgs04.scm.git
import org.ucl.compgs04.model._
import org.ucl.compgs04.scm.Scm
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Future}
case class Chunk(positionStart: Int, positionEnd: Int)
case class Diff(commitHas... |
Explain and rewrite the following Scala code: | package inloopio.math
/**
* Exception thrown when a matrix or vector is accessed at an index, or dimension,
* which does not logically exist in the entity.
*/
class IndexException(index: Int, cardinality: Int) extends IllegalArgumentException("Index " + index + " is outside allowable range of [0," + cardinality + '... |
Explain and rewrite the following Scala code: | /*
* Copyright 2007-2010 WorldWide Conferencing, 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
*
* Unless required by applica... |
Explain and rewrite the following Scala code: | package uk.co.turingatemyhamster.shoppinglist.shoppinglist.impl
import java.time.Instant
import java.util.UUID
import akka.NotUsed
import com.lightbend.lagom.scaladsl.persistence.PersistentEntity
import play.api.libs.json.{Format, Json}
import uk.co.turingatemyhamster.shoppinglist.shoppinglist.api._
import scala.col... |
Explain and rewrite the following Scala code: | package chill
import sbt._
import Keys._
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys._
import scalariform.formatter.preferences._
import com.typesafe.sbt.SbtScalariform._
import scala.collection.JavaConverters._
object ChillBuild extends Build {... |
Explain and rewrite the following Scala code: | package cgta.serland
package json
import scala.scalajs.js
//////////////////////////////////////////////////////////////
// Copyright (c) 2014 Ben Jackman
// All Rights Reserved
// please contact ben@jackman.biz
// for licensing inquiries
// Created by bjackman @ 4/30/14 5:29 PM
//////////////////////////////////////... |
Explain and rewrite the following Scala code: | package ch.wsl.box.rest.logic.functions
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.marshalling.Marshal
import akka.http.scaladsl.model.HttpHeader.ParsingResult
import akka.stream.Materializer
import akka.util.ByteString
import scala.concurrent.{ExecutionContext, Future}
ob... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014-2016 Panavista Technologies, 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
*
* Unless required by applica... |
Explain and rewrite the following Scala code: | package szxcvbn
import java.lang.Character.{isLowerCase, isDigit, isUpperCase}
object Predef {
// type Password = IndexedSeq[Char]
private val Log2 = math.log(2)
def log2(n: Double) = math.log(n) / Log2
val Log2of10 = log2(10)
val Log2of26 = log2(26)
def bruteForceCardinality(password: String) = {
... |
Explain and rewrite the following Scala code: | package com.enkidu.lignum.parsers.ast.statement.modifers
case object Volatile extends Modifier
|
Explain and rewrite the following Scala code: | object Trees {
class PackageDef
class ValDef
}
class ReplCompiler {
type PackageDef = Trees.PackageDef
type ValDef = Trees.ValDef
def errors[A]: A = ???
def success: ValDef = ???
def typeCheck(cond: Boolean): ValDef =
if (cond) success else errors // failure goes away with `errors[ValDef]`
}
|
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2012-2014 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apach... |
Explain and rewrite the following Scala code: | package controllers.api
import entity._
import play.api.libs.json.{JsValue, Json}
import scala.language.implicitConversions
/**
* Samsara Aquarius
* REST Data Converter
*/
object RestConverter {
implicit val categoryFormat = Json.format[Category] // JSON automated mapping
implicit val articleFormat = Jso... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2018 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012 Twitter 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 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 may ... |
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 edu.utexas.cs.sdao.reyes.shading
import edu.utexas.cs.sdao.reyes.graph.SurfaceNode
/**
* The base class for lights that support shadow-mapping.
*/
abstract class ShadowMappedLight(attenuateConst: Float = 0.3f,
attenuateLin: Float = 0.6f,
atte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.