instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /*
* Copyright 2011 Simple Finance, 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 applicable law or agree... |
Explain and rewrite the following Scala code: | /*
* 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 swave.core.impl.util
import scala.annotation.tailrec
import shapeless._
import swave.core._
import sw... |
Explain and rewrite the following Scala code: | package com.dt.scala.type_parameterization
/**
* @author Wang Jialin
* Date 2015/7/12
* Contact Information:
* WeChat: 18610086859
* QQ: 1740415547
* Email: 18610086859@126.com
* Tel: 18610086859
*/
class Animal { def breathe: this.type = this }
class Cat extends Animal { def eat: this.type = this }... |
Explain and rewrite the following Scala code: | val _list = _iprot.readListBegin()
if (_list.size == 0) {
_iprot.readListEnd()
Nil
} else {
val _rv = new mutable$ArrayBuffer[{{eltType}}](_list.size)
var _i = 0
while (_i < _list.size) {
_rv += {
{{#eltReadWriteInfo}}
{{>readValue}}
{{/eltReadWriteInfo}}
}
_i += 1
}
_iprot.readListEnd()... |
Explain and rewrite the following Scala code: | package ua.kata
import org.scalatest.{FunSuite, Matchers}
class BinaryTreeTest extends FunSuite with Matchers {
private val emptyTree: BinaryTree = BinaryTree()
test("created tree has size 0") {
emptyTree should have size 0
}
test("tree contains added item") {
val tree: BinaryTree = emptyTree.add(1)... |
Explain and rewrite the following Scala code: | import leon.lang._
import leon.lang.synthesis._
import leon.annotation._
object Delete {
sealed abstract class List
case class Cons(head: BigInt, tail: List) extends List
case object Nil extends List
def size(l: List) : BigInt = (l match {
case Nil => BigInt(0)
case Cons(_, t) => 1 + size(t)
}) ensu... |
Explain and rewrite the following Scala code: | /* Rewriting on Formulas on Sequent Calculus Proofs */
package at.logic.gapt.proofs.lk.algorithms
import at.logic.gapt.expr.HOLFormula
import at.logic.gapt.language.hol._
import at.logic.gapt.proofs.lk.base.{ FSequent, LKProof, Sequent }
import at.logic.gapt.proofs.occurrences.{ FormulaOccurrence, defaultFormulaOccur... |
Explain and rewrite the following Scala code: | package io.fintrospect.renderers
import com.twitter.finagle.http.Response
import io.fintrospect.formats.Argo.JsonFormat.{array, boolean, obj, string}
import io.fintrospect.formats.Argo.ResponseBuilder._
import io.fintrospect.util.ExtractionError
object JsonErrorResponseRenderer {
def badRequest(badParameters: Seq[E... |
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.imaginea.activegrid.core.models
import com.typesafe.scalalogging.Logger
import org.neo4j.graphdb.Node
import org.slf4j.LoggerFactory
/**
* Created by shareefn on 20/12/16.
*/
case class ScriptDefinition(override val id: Option[Long],
name: Option[String],
... |
Explain and rewrite the following Scala code: | package javaee6.web.cache
import javax.enterprise.context.ApplicationScoped
import javax.enterprise.inject.{Disposes, Produces}
import javax.inject.Inject
import org.infinispan.Cache
import org.infinispan.manager.EmbeddedCacheManager
class EmbeddedCacheProvider {
@Inject
private var cacheManager: EmbeddedCacheMa... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.memcached.integration
import _root_.java.lang.{Boolean => JBoolean}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfter, FunSuite, Outcome}
import com.twitter.finagle.builder.ClientBuilder
import com.twitter.finagle.memcached.Client
... |
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.zookeeper
import org.apache.zookeeper.CreateMode
import org.apache.zookeeper.ZooDefs.Ids
import org.scalatest.BeforeAndAfter
import org.scalatest.funsuite.AnyFunSuite
class ZkInstanceTest extends AnyFunSuite with BeforeAndAfter {
@volatile var inst: ZkInstance = _
before {
inst = ... |
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 2014 Eric Zoerner
*
* 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 com.lge.metr
import java.io.File
import java.nio.file.Path
import scala.collection.JavaConversions.iterableAsScalaIterable
import scala.collection.mutable.ListBuffer
import scala.sys.process.fileToProcess
import org.eclipse.jgit.lib.AnyObjectId
import org.eclipse.jgit.lib.Constants
import org.eclipse.jgit.li... |
Explain and rewrite the following Scala code: | package com.varunvats.practice.random
import scala.annotation.tailrec
import scala.util.Random
object RandomIntUsingRandomBool {
def apply(bound: Int): Int = {
require(bound > 0, "Bound must be positive.")
randomInt(0, bound)
}
@tailrec
private def randomInt(min: Int, max: Int): Int = {
if (min ... |
Explain and rewrite the following Scala code: | import sbt._
import Keys._
//import com.typesafe.sbt.JavaVersionCheckPlugin.autoImport._
import _root_.bintray.BintrayPlugin.autoImport._
import _root_.bintray.InternalBintrayKeys._
object Release {
lazy val launcherRemotePath = SettingKey[String]("launcher-remote-path")
lazy val deployLauncher = TaskKey[Unit](
... |
Explain and rewrite the following Scala code: | //cannot.inline.value.functional.type
val /*caret*/increment: Int => Int = _ + 1
increment(5)
|
Explain and rewrite the following Scala code: | /**
* CompactPairArraySpec.scala
*
* Overview, created November 2012
* @author Jonathan Stray
*
*/
package com.overviewdocs.nlp
import org.specs2.mutable.Specification
class CompactStringToIntMapSpec extends Specification {
"CompactStringToIntMap" should {
"basic operations" in {
// Must start empty... |
Explain and rewrite the following Scala code: | package codacy.plugins.test.implicits
import com.codacy.analysis.core.model._
import com.codacy.plugins.api.duplication.DuplicationCloneFile
import com.codacy.plugins.api.results
import Ordering.Implicits._
object OrderingInstances {
implicit val duplicationCloneFileOrdering: Ordering[DuplicationCloneFile] = Order... |
Explain and rewrite the following Scala code: | package com.wix.mysql.support
import java.util.TimeZone
import com.wix.mysql.EmbeddedMysql
import com.wix.mysql.config.Charset._
import com.wix.mysql.config.MysqldConfig.SystemDefaults
import com.wix.mysql.config.{Charset, MysqldConfig}
import com.wix.mysql.utils.Utils
import org.specs2.matcher.{Matcher, Matchers}
t... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.worksheet.processor
import com.intellij.openapi.editor.Editor
import com.intellij.psi._
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiElement
import org.jetbrains.plugins.scala.lang.psi.api.ScalaFile
/**
* User: Dmitry.Naydano... |
Explain and rewrite the following Scala code: | def test(p: => Int) {
val a = p _
/*start*/a/*end*/
}
//() => Int |
Explain and rewrite the following Scala code: | package lila.team
import akka.actor.ActorSelection
import lila.notify.Notification.Notifies
import lila.notify.TeamJoined.{Id, Name}
import lila.notify.{Notification, TeamJoined, NotifyApi}
private[team] final class Notifier(notifyApi: NotifyApi) {
def acceptRequest(team: Team, request: Request) = {
val notifi... |
Explain and rewrite the following Scala code: | /******************************************************************************
* Copyright (c) 2014, Equal Experts Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of ... |
Explain and rewrite the following Scala code: | //Semi- Useless Test: shows that my class passes the verifier, but java.lang.Object will be a custom class, and will be a case class model with a toString that works
import com.julianpeeters.toolbox.provider._
import models.{ ClassData, FieldData }
import com.novus.salat._
import com.novus.salat.global._
import com.mo... |
Explain and rewrite the following Scala code: | /* ___ _ ___ _ _ *\
** / __| |/ (_) | | The SKilL Generator **
** \__ \ ' <| | | |__ (c) 2013-16 University of Stuttgart **
** |___/_|\_\_|_|____| see LICENSE ... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package annotator
package quickfix.modifiers
import com.intellij.codeInsight.intention.IntentionAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.ScMod... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011-2018 GatlingCorp (http://gatling.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 applic... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s.handlers.index
import com.sksamuel.elastic4s.json.{XContentFactory, XContentFieldValueWriter}
import com.sksamuel.elastic4s.requests.indexes.IndexRequest
object IndexContentBuilder {
def apply(request: IndexRequest): String =
request.source match {
case Some(json) => json
... |
Explain and rewrite the following Scala code: | package com.novocode.squery.session
import java.sql.Connection
import javax.sql.DataSource
/**
* A session factory based on a DataSource.
*/
class DataSourceSessionFactory(driver: String, ds: DataSource) extends SessionFactory {
Class.forName(driver)
protected[squery] def createConnection(): Connection = ds.g... |
Explain and rewrite the following Scala code: | /* Copyright 2009-2021 EPFL, Lausanne */
object Unit1 {
def foo(u: Unit): Unit = ({
u
}) ensuring(res => false)
}
|
Explain and rewrite the following Scala code: | package models
import java.net.InetAddress
import com.datastax.driver.core.Row
import com.websudos.phantom.dsl._
import helpers._
import models.cassandra._
import org.joda.time.DateTime
import scala.concurrent.Future
/**
* @author zepeng.li@gmail.com
*/
trait UserLoginIPCanonicalNamed extends CanonicalNamed {
... |
Explain and rewrite the following Scala code: | package de.tu_berlin.formic.datastructure.tree.client
import akka.actor.ActorRef
import de.tu_berlin.formic.common.datastructure.DataStructureName
import de.tu_berlin.formic.common.{ClientId, DataStructureInstanceId}
/**
* @author Ronny Bräunlich
*/
class FormicIntegerTreeFactory extends FormicTreeDataStructureF... |
Explain and rewrite the following Scala code: | // Copyright (c) 2018 Ben Zimmer. All rights reserved.
package bdzimmer.secondary.export.controller
import bdzimmer.secondary.export.model.WorldItems.WorldItem
import bdzimmer.secondary.export.model.WorldItems
import bdzimmer.secondary.export.view.Html._
import bdzimmer.secondary.export.view.WebResource
import bdzimm... |
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.scalding.platform
import com.twitter.scalding.{Config, Execution, TypedPipe, TypedTsv}
import org.scalatest.{Matchers, WordSpec}
import scala.io.Source
object InAndOutExecution extends Function[Config, Execution[Unit]] {
override def apply(config: Config): Execution[Unit] =
TypedPipe
.... |
Explain and rewrite the following Scala code: | package com.ubirch.avatar.test.base
import com.ubirch.avatar.storage.ESStorageCleanup
import org.scalatest.{AsyncFeatureSpec, BeforeAndAfterAll, BeforeAndAfterEach, Matchers}
/**
* author: cvandrei
* since: 2017-02-28
*/
trait ElasticsearchSpecAsync extends AsyncFeatureSpec
with Matchers
with BeforeAndAfte... |
Explain and rewrite the following Scala code: | /*
* Copyright 2012-2017 Johannes Rudolph
*
* 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 ... |
Explain and rewrite the following Scala code: | package io.github.tailhq.dynaml.graphics.charts.repl
import io.github.tailhq.dynaml.graphics.charts.highcharts._
/**
* User: austin
* Date: 3/25/15
*/
/**
* Defines auxiliary tools available to plots, such as adding a Title
*/
trait HighchartsStyles extends Hold[Highchart] with Labels[Highchart] with WebPlotHigh... |
Explain and rewrite the following Scala code: | package controllers
import model.RouteMap
import com.typesafe.scalalogging.slf4j.Logging //This gives better support for slf4j interface than play's Logger.
import play.api.mvc._
import play.api.libs.json.Json
import scala.collection.mutable
object Application extends Controller with Logging {
val mappedRoutes: R... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.cbt
import java.nio.file.Paths
import javax.swing.Icon
import com.intellij.openapi.module.{Module, ModuleManager}
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.plugins.scala.icons.Icons
import org.jetbrains.sbt.RichVirtualFil... |
Explain and rewrite the following Scala code: | package edu.berkeley.veloxms.storage
import org.apache.commons.lang3.NotImplementedException
import edu.berkeley.veloxms.util.Logging
import tachyon.r.sorted.ClientStore
import tachyon.TachyonURI
import scala.util._
import java.io.IOException
// import java.util.HashMap
import java.nio.ByteBuffer
// import com.typesa... |
Explain and rewrite the following Scala code: | /* Copyright 2009-2016 EPFL, Lausanne */
import leon.annotation.extern
import leon.lang._
object IntegralColor {
def isValidComponent(x: Int) = x >= 0 && x <= 255
def getRed(rgb: Int): Int = {
(rgb & 0x00FF0000) >>> 16
} ensuring isValidComponent _
def getGreen(rgb: Int): Int = {
(rgb & 0x0000FF00)... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2012, 2013, 2014, 2015, 2016 SURFnet BV
* 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, thi... |
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) 2014-2015 by Nokia.
* See the LICENCE.txt file distributed with this work for additional
* information regarding copyright ownership.
*
* 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 o... |
Explain and rewrite the following Scala code: | /* *\\
** Squants **
** **
** Scala Quantities and Units of Measure Library and DSL **
** (c) 2013-2015, G... |
Explain and rewrite the following Scala code: | package filodb.coordinator.queryplanner
import filodb.core.metadata.{Dataset, DatasetOptions, Schemas}
import filodb.core.query.{ColumnFilter, PromQlQueryParams, QueryConfig, QueryContext, RangeParams}
import filodb.query._
import filodb.query.LogicalPlan._
import filodb.query.exec._
/**
* Holder for the shard key r... |
Explain and rewrite the following Scala code: | /*
* -------------------------------------------------------------------------------------------------
* - Project: Objectify -
* - Copyright: ©2014 Matygo Educational Incorporated operating as Learndot -
* - Author: ... |
Explain and rewrite the following Scala code: | /*
# Copyright 2016 Georges Lipka
#
# 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 wri... |
Explain and rewrite the following Scala code: | package org.scaladebugger.api.profiles.java.requests.monitors
import com.sun.jdi.event.MonitorContendedEnteredEvent
import org.scaladebugger.api.lowlevel.JDIArgument
import org.scaladebugger.api.lowlevel.events.EventManager
import org.scaladebugger.api.lowlevel.events.EventType._
import org.scaladebugger.api.lowlevel.... |
Explain and rewrite the following Scala code: | package $package$
import $package$.R
import android.os.Build.VERSION_CODES.LOLLIPOP
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
import org.scalatest.{FlatSpec, Matchers, RobolectricSuite}
@Config(sdk = Array(LOLLIPOP))
class UnitTest extends FlatSpec with Matchers with Robolectr... |
Explain and rewrite the following Scala code: | package mesosphere.marathon
package core.task.tracker.impl
import akka.actor.ActorRef
import mesosphere.marathon.core.instance.Instance
import mesosphere.marathon.core.instance.update.InstanceUpdateOperation
import mesosphere.marathon.state.{ PathId, Timestamp }
import scala.concurrent.{ ExecutionContext, Future }
p... |
Explain and rewrite the following Scala code: | package com.github.gdefacci
import scalaz.{ -\\/, \\/, \\/- }
package object ddd {
type CommandRunner[S, C, E, Err] = (S, C) => Err \\/ (Seq[E], S)
type StateChangeCommandRunner[S, C, E, Err] = (S, C) => Err \\/ Seq[StateChange[S, E]]
type CommandsRunner[S, C, E, Err] = (S, Seq[C]) => Err \\/ (Seq[E], S)
... |
Explain and rewrite the following Scala code: | /** Copyright 2016 - 2021 Martin Mauch (@nightscape)
*
* 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 applicab... |
Explain and rewrite the following Scala code: | /*
* Copyright 2011 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 t... |
Explain and rewrite the following Scala code: | package com.airbnb.aerosolve.demo.TwentyNews;
import org.apache.spark.{SparkContext, SparkConf}
import org.slf4j.{LoggerFactory, Logger}
import com.typesafe.config.ConfigFactory
/*
* Runs an arbitrary job given a config resource name.
* The config must contain
* job_name : name_of_job
* jobs = [ list of jobs ]
*... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2013-2014 Telefónica Investigación y Desarrollo S.A.U.
*
* 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
*
* Unles... |
Explain and rewrite the following Scala code: | package com.tonybeltramelli.desktop.util
import scala.collection.mutable.{Map => MutMap}
import com.github.aztek.porterstemmer.PorterStemmer
import scala.collection.mutable.Iterable
import java.io.File
import java.io.FileWriter
class Helper {
}
object Helper {
val ZIP_PATH = "/zips"
val QRELS_PATH = "/qrels"
v... |
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-2014, KAIST, S-Core.
All rights reserved.
Use is subject to license terms.
This distribution may include materials developed by third parties.
**********************************************************... |
Explain and rewrite the following Scala code: | package com.enkidu.lignum.parsers.ast.statement.conditional
import com.enkidu.lignum.parsers.ast.statement.Statement
trait ConditionalStatement extends Statement |
Explain and rewrite the following Scala code: | /*
* filter: inliner warnings;
*/
import java.lang.Thread.holdsLock
import scala.collection.mutable.StringBuilder
object Util {
def checkLocks(held: AnyRef*)(notHeld: AnyRef*) = {
val sb = new StringBuilder
for (lock <- held) {
sb.append(if (holdsLock(lock)) '.' else '!')
}
print("%5s|" forma... |
Explain and rewrite the following Scala code: | package org.greencheek.spray.cache.memcached.perftests
import net.spy.memcached.util.StringUtils;
import org.openjdk.jmh.annotations._
import java.util.concurrent.TimeUnit
@State(Scope.Thread)
class KeyBench {
/**
* 12 chars long
*/
val SHORT_KEY : String = "user:michael";
/**
* 240 chars long
*... |
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.avsystem.scex
package compiler.presentation
import java.util.concurrent.{ExecutionException, TimeUnit}
import java.{lang => jl, util => ju}
import com.avsystem.scex.compiler.ExpressionDef
import com.avsystem.scex.compiler.ScexCompiler.{CompilationFailedException, CompileError}
import com.avsystem.scex.com... |
Explain and rewrite the following Scala code: | package com.typesafe.sbt.mocha
object Compat {
}
|
Explain and rewrite the following Scala code: | package db
/**
* Created by hps1 on 16.02.14.
*/
case class User(name: String, id: Option[Int] = None)
|
Explain and rewrite the following Scala code: | package com.rasterfoundry.api.campaign
import com.rasterfoundry.akkautil._
import com.rasterfoundry.api.utils.queryparams.QueryParametersCommon
import com.rasterfoundry.database.Implicits._
import com.rasterfoundry.database._
import com.rasterfoundry.datamodel._
import akka.http.scaladsl.server._
import cats.effect.I... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com>
* Copyright (C) 2017-2018 Alexis Seigneurin.
*
* 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 o... |
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) 2014 - 2017 Contributors as noted in the AUTHORS.md file
*
* 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)... |
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 envisia GmbH
*
* 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 org.villane.shttpc
import xml._
object BetterXPath {
implicit def betterXPath(node: NodeSeq) = new BetterXPath(node)
}
/**
* Supports a subset of XPath expressions in the form of
*
* /tag1/tag2[@attr='stringLiteral']/tag2
* /tag1/tag2[tag4=@attr2]/tag2
*/
class BetterXPath(node: NodeSeq)... |
Explain and rewrite the following Scala code: | package com.wixpress.petri.laboratory
import org.apache.http.client.config.RequestConfig
import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.ByteArrayEntity
import org.apache.http.impl.client.HttpClientBuilder
trait BiAdapterBuilder {
def create(key: String, url: String, timeoutMs: String)... |
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.tools.partest.{ ReplTest, Welcoming }
import scala.tools.nsc.{ GenericRunnerSettings, Settings }
import scala.tools.nsc.settings.MutableSettings
object Test extends ReplTest with HangingRepl with Welcoming {
def script = testPath changeExtension "script"
override def transformSettings(s: Settings) = ... |
Explain and rewrite the following Scala code: | package wakfutcp.protocol.messages.server
import wakfutcp.protocol.{Codec, ServerMessage}
final case class ItemIdCacheUpdateMessage(
squashing: Boolean,
uids: Array[Long]
) extends ServerMessage {
override val id = 5300
}
object ItemIdCacheUpdateMessage {
import Codec._
import cats.syntax.apply._
implic... |
Explain and rewrite the following Scala code: | /*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This file is part of Rudder.
*
* Rudder is free software: you can redistribute it and/or modify
* it under the... |
Explain and rewrite the following Scala code: | package mesosphere.marathon.api.v2
import javax.ws.rs.core.{ MediaType, Response }
import javax.ws.rs.{ Consumes, GET, Path, Produces }
import com.google.inject.Inject
import mesosphere.chaos.http.HttpConf
import mesosphere.marathon.api.{ MarathonMediaType, LeaderInfo }
import mesosphere.marathon.event.EventConfigura... |
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.twitter.finagle.memcached.partitioning
import com.twitter.finagle.Stack.Params
import com.twitter.finagle.memcached.protocol._
import com.twitter.finagle.{Memcached, _}
import com.twitter.hashing.KeyHasher
import com.twitter.io.Buf
/**
* MemcachedPartitioningService provides Ketama consistent hashing bas... |
Explain and rewrite the following Scala code: | package org.lolhens.minechanics.core.storageaccess.nbt
import net.minecraft.nbt.NBTTagString
class NBTString(override val obj: NBTTagString) extends ValidNBTObject[NBTTagString](obj) {
//override def getStringValue: String = obj.func_150285_a_
} |
Explain and rewrite the following Scala code: | package sparkz.classifiers
trait FeaturesWithBooleanLabel[Features] {
def features: Features
def isTrue: Boolean
}
trait MetaData[MetaData] {
def metaData: MetaData
}
object EmptyMetaData extends MetaData[Unit] {
def metaData: Unit = ()
}
|
Explain and rewrite the following Scala code: | package com.example.playscalajs
import com.example.playscalajs.shared.SharedMessages
import org.scalajs.dom
object ScalaJSExample {
def main(args: Array[String]): Unit = {
dom.document.getElementById("scalajsShoutOut").textContent = SharedMessages.itWorks + "-a-change"
}
}
|
Explain and rewrite the following Scala code: | /*
* Copyright 2009-2010 LinkedIn, 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: | /*
* The MIT License (MIT)
*
* Copyright (c) 2014 Heiko Blobner
*
* 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... |
Explain and rewrite the following Scala code: | /*
* ____ ____ _____ ____ ___ ____
* | _ \\ | _ \\ | ____| / ___| / _/ / ___| Precog (R)
* | |_) | | |_) | | _| | | | | /| | | _ Advanced Analytics Engine for NoSQL Data
* | __/ | _ < | |___ | |___ |/ _| | | |_| | Copyright (C) 2010 - 2013 SlamData, In... |
Explain and rewrite the following Scala code: | package skinny.dbmigration
import org.scalatest._
import scalikejdbc.ConnectionPool
class DBMigrationSpec extends FlatSpec with Matchers with DBMigration {
Class.forName("org.h2.Driver")
ConnectionPool.add(Symbol("DBMigrationSpec"), "jdbc:h2:mem:DBMigrationSpec;MODE=PostgreSQL", "sa", "sa")
it should "have #m... |
Explain and rewrite the following Scala code: | package beam.analysis.via
import java.util.{ArrayList, Collections, List}
import java.util
import beam.analysis.plots.GraphsStatsAgentSimEventsListener
import beam.sim.OutputDataDescription
import beam.utils.OutputDataDescriptor
object ExpectedMaxUtilityHeatMapObject extends OutputDataDescriptor {
// private val f... |
Explain and rewrite the following Scala code: | // Copyright (C) 2017 Calin Cruceru <calin.cruceru@stud.acs.upb.ro>.
//
// See the LICENCE file distributed with this work for additional
// information regarding copyright ownership.
package org.symnet
package models.iptables.virtdev
package devices
import ivds._
import models.iptables.core.{Chain, Table}
import typ... |
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 net.scalytica.symbiotic.elasticsearch
import com.typesafe.config.{Config, ConfigFactory}
import org.scalatest.{MustMatchers, WordSpec}
class ElasticSearchConfigSpec extends WordSpec with MustMatchers {
val esHost = sys.props
.get("CI")
.orElse(sys.env.get("CI"))
.map(_ => "elasticsearch")
.... |
Explain and rewrite the following Scala code: | package SimpleDSL
import scala.util.parsing.combinator._
import scala.util.parsing.input._
sealed trait SDSLToken
case class IDENTIFIER(str: String) extends SDSLToken
case class LITERAL(int: Int) extends SDSLToken
case object APPLY extends SDSLToken
case object EQ extends SDSLToken
case object GT extends SDSLToken
c... |
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 not u... |
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.