instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | package com.gateway.server
import org.vertx.java.core.http.HttpServer
import io.vertx.rxcore.java.eventbus.RxEventBus
import org.vertx.java.core.logging.Logger
import com.escalatesoft.subcut.inject.NewBindingModule
import NewBindingModule.newBindingModule
import com.gateway.server.exts._
import org.vertx.java.core.jso... |
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.outr.nextui.examples
import com.outr.nextui.{FontStyle, FontWeight, Label, UI}
import org.powerscala.Color
object LabelExample extends UI {
size.width := 800.0
size.height := 600.0
children += new Label {
text := "Centered Text"
position.center := ui.position.center
position.middle := u... |
Explain and rewrite the following Scala code: | import java.io.File
object SCL1644 extends Application {
override def main(args: Array[String]) {
val files: Array[File] = new File("c:/").listFiles()
/*start*/files.map(file => file.length)/*end*/
files
}
}
//Array[Long] |
Explain and rewrite the following Scala code: | import leon.lang.StaticChecks._
object StaticChecks1 {
def add(n: BigInt, m: BigInt): BigInt = {
require(n >= 0 && m >= 0)
if(m == 0) n else add(n, m-2) + 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: | /*
* Licensed to Tuplejump Software Pvt. Ltd. under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Tuplejump Software Pvt. Ltd. licenses this file
* to you under the Apache License, Version 2.0 (the
* "Li... |
Explain and rewrite the following Scala code: | package com.mycompany.scalcium.tokenizers
import scala.collection.immutable.List
import scala.collection.mutable.ArrayBuffer
import com.aliasi.chunk.{ChunkFactory, Chunker, Chunking, ChunkingImpl}
import com.aliasi.hmm.{HiddenMarkovModel, HmmDecoder}
import com.aliasi.sentences.{IndoEuropeanSentenceModel, SentenceChun... |
Explain and rewrite the following Scala code: | package HackerRank.Training.DataStructures.Stacks
import java.io.{ByteArrayInputStream, IOException, InputStream, PrintWriter}
import java.util.InputMismatchException
import scala.collection.generic.CanBuildFrom
import scala.language.higherKinds
import scala.reflect.ClassTag
/**
* Copyright (c) 2017 A. Roberto Fis... |
Explain and rewrite the following Scala code: | /* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\\___/_/... |
Explain and rewrite the following Scala code: | /* sbt -- Simple Build Tool
* Copyright 2011 Mark Harrah, Indrajit Raychaudhuri
*/
package sbt
/** Options for well-known tasks. */
object Opts {
object compile {
val deprecation = "-deprecation"
def encoding(enc: String) = Seq("-encoding", enc)
val explaintypes = "-explaintypes"
val nowarn = "-nowarn"
va... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2017 LREN CHUV for Human Brain Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version... |
Explain and rewrite the following Scala code: | // Copyright (c) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors)
//
// 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, inc... |
Explain and rewrite the following Scala code: | package com.oct.sclaav.visual.manipulators
import com.oct.sclaav.ImageManipulator
import com.sksamuel.scrimage.Image
import com.sksamuel.scrimage.filter.OilFilter
object OozeManipulator extends ImageManipulator {
override def apply(img: Image): Image = {
// img.filter(DiffuseFilter(10.0f))
// img.filter(Edg... |
Explain and rewrite the following Scala code: | package ca.innovativemedicine.vcf.parsers
import ca.innovativemedicine.vcf._
import java.util.{ concurrent => juc }
import scala.actors.Future
import scala.actors.Actor
import scala.actors.Futures
/**
* This will parse a VCF file concurrently. One thread is always dedicated to
* reading in the file and there will ... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2014-2015 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 utils
import java.io.File
/**
* Some utilities for use my multiple examples that deal with directory
* hierarchy, especially to illustrate partitioned tables stored in HDFS.
*/
object PartitionedTableHierarchy {
/**
* Clean up the output from the last run
*/
def deleteRecursively(file: File... |
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: | /* sbt -- Simple Build Tool
* Copyright 2008, 2009 Mark Harrah
*/
package xsbt
import xsbti.{AnalysisCallback,Logger,Problem,Reporter,Severity}
import xsbti.compile._
import scala.tools.nsc.{backend, io, reporters, symtab, util, Phase, Global, Settings, SubComponent}
import backend.JavaPlatform
import scala.tools.ut... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.annotator
class ScCharLiteralAnnotatorTest extends ScalaHighlightingTestBase {
def testEmptyCharLiteral(): Unit = {
val scalaText =
"""
|val test = ''
""".stripMargin
assertMatches(errorsFromScalaCode(scalaText)){
case Error("''", "Missing char v... |
Explain and rewrite the following Scala code: | package org.epl_lang.bytecode.tree
import org.epl_lang.bytecode.ParameterVisitor
import org.epl_lang.bytecode.util.Receiver
/**
* Parameter
*
* A representation of a parameter in a type parameter list.
*
* @param index the index of the parameter
* @param name the name of the parameter
* @author Ian Caf... |
Explain and rewrite the following Scala code: | /* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\\___/_/... |
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 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
* distribute... |
Explain and rewrite the following Scala code: | package gitbucket.core.util
import java.net.{URLDecoder, URLEncoder}
import java.security.SecureRandom
import java.util.{Base64, UUID}
import org.mozilla.universalchardet.UniversalDetector
import SyntaxSugars._
import javax.crypto.SecretKeyFactory
import javax.crypto.spec.PBEKeySpec
import org.apache.commons.io.input... |
Explain and rewrite the following Scala code: | package ilc
package feature
package integers
trait ToScala extends base.ToScala with Syntax {
private def int = "Int"
override def toScala(tau: Type): String = tau match {
case IntType => int
case _ => super.toScala(tau)
}
override def isScalaPrimitive(tau: Type) = tau match {
case IntType ... |
Explain and rewrite the following Scala code: | package com.atanana.parsers
import com.atanana.Connector
import com.atanana.data.TournamentData
import com.github.tototoshi.csv.CSVReader
import scala.io.Source
import scala.util.Try
class CsvParser {
def getTournamentsData(csv: String): List[TournamentData] = {
CSVReader.open(Source.fromString(csv)).all()
... |
Explain and rewrite the following Scala code: | /*
* The MIT License (MIT)
*
* Copyright (C) 2012 47 Degrees, LLC http://47deg.com hello@47deg.com
*
* 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 with... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2015 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 is ... |
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: | /*§
===========================================================================
EighthBridge
===========================================================================
Copyright (C) 2016 Gianluca Costa
===========================================================================
Licensed under the Apache Lic... |
Explain and rewrite the following Scala code: | object Main {
def is_p1(n: Int): Boolean = {
n % 3 == 0 | n % 5 == 0
}
def main(args: Array[String]): Unit = {
println((1 to 999).filter(this.is_p1).reduce(_+_))
}
}
|
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package codeInspection.booleans
import org.jetbrains.plugins.scala.codeInspection.{AbstractFix, AbstractInspection}
import com.intellij.codeInspection.{ProblemHighlightType, ProblemDescriptor, ProblemsHolder}
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.lang... |
Explain and rewrite the following Scala code: | package mesosphere.marathon
package core.task.tracker.impl
import java.util.concurrent.TimeoutException
import akka.actor.{ Status, Terminated }
import akka.testkit.{ TestActorRef, TestProbe }
import com.typesafe.config.ConfigFactory
import mesosphere.AkkaUnitTest
import mesosphere.marathon.core.base.ConstantClock
im... |
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 2015 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 to in writing, software
distr... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.thrift
import com.twitter.finagle.Service
import com.twitter.util.{Await, Future}
import org.specs.SpecificationWithJUnit
import org.specs.mock.Mockito
class ClientIdRequiredFilterSpec extends SpecificationWithJUnit with Mockito {
"ClientIdRequiredFilter" should {
val underlying = mo... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.stats
import com.twitter.app.GlobalFlag
import com.twitter.finagle.http.{HttpMuxHandler, Route, RouteIndex}
import com.twitter.finagle.util.DefaultTimer
import com.twitter.logging.{Level, Logger}
import com.twitter.util.{Future, FuturePool, Time}
import com.twitter.util.lint.{Category, Glob... |
Explain and rewrite the following Scala code: | package org.json4s
import java.io.InputStream
sealed abstract class JsonInput extends Product with Serializable {
private[json4s] def toReader(): java.io.Reader = this match {
case StringInput(x) =>
new java.io.StringReader(x)
case ReaderInput(x) =>
x
case StreamInput(x) =>
new java.io... |
Explain and rewrite the following Scala code: | package com.scalableQuality.quick.core.valueMapping
case object ToUpperCase extends ValueMapperFunction {
override def apply(value: Option[String]) = value.map(_.toUpperCase)
def apply(shouldInclude: Boolean): List[ValueMapperFunction] =
if (shouldInclude) List(ToUpperCase) else Nil
}
|
Explain and rewrite the following Scala code: | /** Default (Template) Project
*
* Copyright (c) 2017 Hugo Firth
* Email: <me@hugofirth.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/lice... |
Explain and rewrite the following Scala code: | package parsec.optimised
import scala.reflect.macros.blackbox.Context
import util.Zeroval
/**
* A ParseResult needs to know of a CPS encoding for a CharReader
* We specialise to `CharReader` since parsers above already do it too.
* TODO: abstract as and when needed.
*/
trait ParseResultOps { self: ReaderOps with ... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.thrift
import com.twitter.finagle.context.Contexts
import com.twitter.io.Buf
object Headers {
private[finagle] object Values {
def apply(headers: Seq[(Buf, Buf)]): Values = new Values(headers)
}
/**
* A mutable container for "header" like value information.
*
* @note... |
Explain and rewrite the following Scala code: | package unfiltered.specs2
import okhttp3._
import java.security.KeyStore
import java.io.FileInputStream
import javax.net.ssl._
/** Provides an Http client configured to handle ssl certs */
trait SecureClient extends Hosted {
val keyStorePath: String
val keyStorePasswd: String
val securePort: Int
val secureSch... |
Explain and rewrite the following Scala code: | import sbt._
object Dependencies {
val easyImage = ( "com.github.jkwiecien" % "EasyImage" % "2.1.0" )
.exclude( "com.android.support", "appcompat-v7" )
val flexbox = ( "com.google.android" % "flexbox" % "1.0.0" )
.exclude( "com.android.support", "recyclerview-v7" )
.exclude( "com.andro... |
Explain and rewrite the following Scala code: | package dao.impl
import javax.inject.Inject
import com.google.inject.Singleton
import dao.SuggestionDAO
import model.Suggestion
import model.table.SuggestionTable
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import play.api.libs.concurrent.Execution.Implicits._
import services.state.Ac... |
Explain and rewrite the following Scala code: | import sbt._
import sbt.Keys._
import xerial.sbt.Sonatype.SonatypeKeys._
object BuildSettings{
val buildVersion = scala.io.Source.fromFile("version").mkString.trim
val buildSettings = Defaults.defaultSettings ++ Seq(
version := buildVersion,
scalaVersion := "2.10.2",
scalacOptions ++= Seq("-unchecked... |
Explain and rewrite the following Scala code: | package c3.w1
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class ThreadsSuite extends FunSuite {
trait threads {
val test = new Threads
}
test("threads without monitor") {
new threads {
val t1 = test.noMonitor... |
Explain and rewrite the following Scala code: | package io.straight.ete.util
import io.straight.ete.config.{DataSetAttachedNode, OutputNode}
import io.straight.ete.core.EteGeneralException
import io.straight.ete.config.EteConfigBuildSupport._
import scalaz._
import Scalaz._
import scalaz.syntax.ToMonadPlusOps
/**
* @author rbuckland
*/
object EteHelper {
obj... |
Explain and rewrite the following Scala code: | package com.acework.js.components.bootstrap
import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react.ReactComponentC.ReqProps
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.prefix_<^._
import scala.scalajs.js.{UndefOr, undefined}
/**
* Created by weiyin on 09/03/15.
*/
o... |
Explain and rewrite the following Scala code: | // Copyright 2014 Commonwealth Bank of Australia
//
// 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 dbpedia.dataparsers
import dbpedia.dataparsers.util.Language
import dbpedia.dataparsers.util.wikiparser._
import scala.language.reflectiveCalls
/**
* Parses links to other instances.
*/
class ObjectParser(context : { def language : Language }, val strict : Boolean = false) extends DataParser
{
//TODO ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2020 Precog Data
*
* 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: | /*
* 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 tests.rescala.dynamic
import tests.rescala.testtools.RETests
class Toggle extends RETests {
multiEngined { engine =>
import engine._
/* toggle */
test("toggle the Initial Value Is Set Correctly") {
val e = Evt[Int]()
val v1 = Var(1)
val s1 = v1.map { _ + 1 }
val v2 = Va... |
Explain and rewrite the following Scala code: | /*
* (c) Copyright 2019 EntIT Software LLC, a Micro Focus company, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICE... |
Explain and rewrite the following Scala code: | package com.twitter.finatra.http.integration.tweetexample.main.controllers
import com.twitter.concurrent.exp.AsyncStream
import com.twitter.finagle.httpx.{Request, Response}
import com.twitter.finatra.http.Controller
import com.twitter.finatra.http.integration.tweetexample.main.domain.Tweet
import com.twitter.finatra.... |
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: | /*
* Licensed to Tuplejump Software Pvt. Ltd. under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Tuplejump Software Pvt. Ltd. licenses this file
* to you under the Apache License, Version 2.0 (the
* "Li... |
Explain and rewrite the following Scala code: | /*
* Copyright 2017 Sumo Logic
*
* 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: | /*
* 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 ... |
Explain and rewrite the following Scala code: | // Copyright © 2010-2016, Esko Luontola <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0
package org.specsy.examples.scala
import org.specsy.scala.ScalaSpecsy
import java.nio.file.{Files, Paths}
import java.util.UUID
c... |
Explain and rewrite the following Scala code: | package au.com.fairfax.pickler.macros
trait JBuilder[J] {
def makeNull(): J
def makeBoolean(b: Boolean): J
def makeNumber(x: Double): J
def makeString(s: String): J
def makeArray(elems: J*): J
def makeObject(fields: (String, J)*): J
}
trait JReader[J] {
def isUndefined(x: J): Boolean
def isArray(x: J)... |
Explain and rewrite the following Scala code: | package me.invkrh.showcase
import org.json4s._
import org.json4s.jackson.Serialization
import org.json4s.jackson.Serialization.{read, write}
object JsonSerde {
implicit val formats = Serialization.formats(NoTypeHints)
def serialize(obj: AnyRef): String = {
write(obj)
}
def deserialize[T: Manifest](jstr... |
Explain and rewrite the following Scala code: | package com.plasmaconduit.framework.mvc.controllers
import com.plasmaconduit.conveyance.Box
import com.plasmaconduit.framework.{HttpResponse, HttpRequest}
import com.plasmaconduit.framework.mvc.Controller
final case class AdhocController[R <: HttpRequest[R]](fn: (R) => Box[Throwable, HttpResponse]) extends Controller... |
Explain and rewrite the following Scala code: | package grasshopper.geocoder.api.stats
import akka.actor.{ Actor, ActorLogging, Props }
import com.typesafe.config.ConfigFactory
import feature.{ Feature, FeatureCollection }
import grasshopper.geocoder.model.{ GeocodeResponse, GeocodeStats }
import grasshopper.geocoder.protocol.GrasshopperJsonProtocol
import scala.c... |
Explain and rewrite the following Scala code: | package scalabpe.plugin
import scala.collection.mutable.HashMap
import scala.xml.Node
import scalabpe.core.DummyActor
import scalabpe.core.HashMapStringAny
import scalabpe.core.Logging
import scalabpe.core.Request
import scalabpe.core.Response
import scalabpe.core.ResponseFilter
import scalabpe.core.Router
class 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: | /**
* Copyright (c) 2012-2013, Tomasz Kaczmarzyk.
*
* This file is part of BeanDiff.
*
* BeanDiff 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 3 of the License, or
* (at your o... |
Explain and rewrite the following Scala code: | package scodec
package codecs
import java.security.MessageDigest
import java.util.Arrays
import java.util.zip.{ CRC32, Adler32, Checksum }
import scodec.bits.ByteVector
/**
* Creates checksum implementations of [[SignerFactory]].
*/
object ChecksumFactory {
/** Creates a `java.security.Digest` factory for the sp... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Coursera 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 t... |
Explain and rewrite the following Scala code: | package org.bitcoins.marshallers.rpc.bitcoincore.blockchain
import org.bitcoins.protocol.rpc.bitcoincore.blockchain.{ConfirmedUnspentTransactionOutput, ConfirmedUnspentTransactionOutputImpl}
import spray.json._
/**
* Created by Tom on 1/11/2016.
*/
object ConfirmedUnspentTransactionOutputMarshaller extends DefaultJ... |
Explain and rewrite the following Scala code: | /*
* This file is part of the \\BlueLaTeX 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 applicable ... |
Explain and rewrite the following Scala code: | package com.naokia.groonga4s.util.mapping
import com.naokia.groonga4s.response.Person
import org.specs2.mutable.Specification
import scala.reflect.runtime.universe._
import scala.reflect.{ClassTag, classTag}
case class PersonSimple(_key: String, mailAddress: String)
case class PersonWithSeq(_key: String, mailAddress... |
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.sksamuel.scapegoat.inspections.option
import com.sksamuel.scapegoat.InspectionTest
/** @author Stephen Samuel */
class ImpossibleOptionSizeConditionTest extends InspectionTest {
override val inspections = Seq(new ImpossibleOptionSizeCondition)
"options.size > x where x is > 1" - {
"should report... |
Explain and rewrite the following Scala code: | package es.ucm.fdi.sscheck.spark.demo.twitter
import org.scalacheck.Gen
import twitter4j.Status
import org.mockito.Mockito._
import es.ucm.fdi.sscheck.gen.UtilsGen
/** Generators for tweets
*/
object TwitterGen {
/** Generator of Status mocks with a getText method
* that returns texts of up to 140 cha... |
Explain and rewrite the following Scala code: | package nlpdata.structure
/** Represents a single predicate--argument structure.
*
* A CoNLL sentence contains a list of these;
* the words in the head and argument spans will be the same words
* that appear in the CoNLL sentence itself.
*
* @param pred the predicate of the PAS, including the head word
*... |
Explain and rewrite the following Scala code: | package org.http4s
package headers
import cats.data.NonEmptyList
import org.http4s.parser.HttpHeaderParser
import org.http4s.syntax.nonEmptyList._
object `Accept-Charset` extends HeaderKey.Internal[`Accept-Charset`] with HeaderKey.Recurring {
override def parse(s: String): ParseResult[`Accept-Charset`] =
HttpHe... |
Explain and rewrite the following Scala code: | package org.http4s
package headers
object `Sec-WebSocket-Accept` extends HeaderKey.Default
|
Explain and rewrite the following Scala code: | package me.dribba.components
trait DigitalSensorComponent {
} |
Explain and rewrite the following Scala code: | package com.lendap.spark.lsh
/**
* Created by maruf on 09/08/15.
*/
import org.apache.spark.mllib.linalg.SparseVector
import org.apache.spark.rdd.RDD
/** Build LSH model with data RDD. Hash each vector number of hashTable times and stores in a bucket.
*
*
* @param data RDD of sparse vectors with vector Ids. ... |
Explain and rewrite the following Scala code: | package scjson.converter
import scala.deriving.Mirror
import scutil.lang.Bijection
trait NewtypeJsonReaders {
def newtypeReader[S](using m:Mirror.ProductOf[S], ev: m.MirroredElemTypes <:< Tuple1[?], f:JsonReader[Tuple.Elem[m.MirroredElemTypes, 0]]):JsonReader[S] =
f.map { t => m.fromProduct(t *: EmptyTuple) }
d... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2015 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This progra... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017 CyberAgent
*
* 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, publish,... |
Explain and rewrite the following Scala code: | import java.io.PrintWriter
import breeze.linalg.{DenseMatrix, DenseVector}
import features._
import structures.{BFSCorpus, UniqueID, WordList}
import scala.io.Source
import scala.reflect.io.File
import scala.util.Random
/**
* Created by mechko on 12/20/14.
*/
trait FeatureMap extends Serializable {
val uid = ne... |
Explain and rewrite the following Scala code: | package is.hail.utils
import scala.language.implicitConversions
package object prettyPrint {
implicit def text(t: String): Doc = Text(t)
def space: Doc = text(" ")
// Prints as a newline, followed by the current indentation, unless part of a group
// printing in flat mode, in which case it prints as a space... |
Explain and rewrite the following Scala code: | package com.cloudray.scalapress.plugin.ecommerce.tag
import org.scalatest.{OneInstancePerTest, FunSuite}
import org.scalatest.mock.MockitoSugar
import com.cloudray.scalapress.plugin.ecommerce.tags.BasketLineCountTag
import com.cloudray.scalapress.plugin.ecommerce.domain.{BasketLine, Basket}
import com.cloudray.scalapr... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s.requests.security.roles
import com.sksamuel.elastic4s.testkit.DockerTests
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
class DeleteRoleTest extends AnyWordSpec with Matchers with DockerTests {
"delete role request" should {
"delete role"... |
Explain and rewrite the following Scala code: | /* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package xsbt.api
import xsbti.SafeLazy
import xsbti.api._
import sbt.Using
import sbinary._
import DefaultProtocol._
import Operations.{ read, write }
import java.io.File
import scala.collection.mutable
object SourceFormat extends Format[Source] {
import... |
Explain and rewrite the following Scala code: | package edu.gemini.spModel.test
import edu.gemini.pot.ModelConverters._
import edu.gemini.shared.util.immutable.None
import edu.gemini.shared.util.immutable.ScalaConverters._
import edu.gemini.skycalc.{Offset => SkyCalcOffset}
import edu.gemini.spModel.ags.AgsStrategyKey
import edu.gemini.spModel.core.{OffsetQ, Offset... |
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 com.foo.scada
/**
* Implementation of a Queue with restricted size.
* @param limit Size limit of the queue. If more elements are pushed into the queue, the oldest will be removed first if size will be exceeded
* @tparam T Type parameter for elements to be stored in queue
*/
class FiniteQueue[T](limit: Int)... |
Explain and rewrite the following Scala code: | package gapt.proofs.lk.transformations
import gapt.expr.formula.Formula
import gapt.expr.formula.hol.isAtom
import gapt.proofs.lk.LKProof
import gapt.proofs.lk.reductions.CutReduction
import gapt.proofs.lk.reductions.gradeReduction
import gapt.proofs.lk.reductions.leftRankReduction
import gapt.proofs.lk.reductions.rig... |
Explain and rewrite the following Scala code: | package com.mesosphere.cosmos.model
import com.mesosphere.cosmos.circe.Decoders.decode
import com.mesosphere.cosmos.circe.Decoders.mediaTypedDecode
import com.mesosphere.cosmos.finch.MediaTypedDecoder
import com.mesosphere.cosmos.finch.MediaTypedEncoder
import com.mesosphere.cosmos.http.MediaType
import com.mesosphere... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.psi.impl.base
import com.intellij.lang.ASTNode
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.extensions.ifReadAllowed
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes
import org.jetbrains.plugins.scala.lang.parser.ScalaElementTypes.FIELD_ID
... |
Explain and rewrite the following Scala code: | package models.monitoring
/**
* User: yesnault
* Date: 15/11/13
*/
import play.api.mvc._
import play.api.http.Status
import com.codahale.metrics._
import com.codahale.metrics.MetricRegistry._
import play.api.libs.concurrent.Execution.Implicits._
class MetricsFilter extends EssentialFilter {
val registry: Metri... |
Explain and rewrite the following Scala code: | // Copyright (C) 2019 MapRoulette contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
package org.maproulette.controllers.api
import javax.inject.Inject
import akka.util.ByteString
import org.maproulette.Config
import org.maproulette.data._
import org.maproulette.models... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.