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 ... |
Explain and rewrite the following Scala code: | package io.getquill.context.cassandra
import io.getquill.context.Context
import io.getquill.NamingStrategy
trait CassandraContext[N <: NamingStrategy]
extends Context[CqlIdiom, N]
with Ops |
Explain and rewrite the following Scala code: | package dotty.tools.dotc
package transform
import core._
import Symbols._, Types._, Contexts._, DenotTransformers._, Flags._
import util.Spans._
import SymUtils._
import StdNames._, NameOps._
class MixinOps(cls: ClassSymbol, thisPhase: DenotTransformer)(using Context) {
import ast.tpd._
val superCls: Symbol = cl... |
Explain and rewrite the following Scala code: | package temportalist.esotericraft.galvanization.common.item
import java.util
import com.mojang.realmsclient.gui.ChatFormatting
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.relauncher.{Side, SideOnly}
/**
*
* Created by TheTemportalist on 5/5/20... |
Explain and rewrite the following Scala code: | package de.khamrakulov.play.metrics
import javax.inject.{Inject, Named, Singleton}
import play.api.Logger
import play.api.inject.ApplicationLifecycle
/**
* @author Timur Khamrakulov <timur.khamrakulov@gmail.com>.
*
* LifecycleManager starts and stops reporters on application startup and stop
*/
@Singleton
cl... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s
import com.sksamuel.elastic4s.admin._
import com.sksamuel.elastic4s.alias.{AliasesDsl, GetAliasDefinition}
import com.sksamuel.elastic4s.analyzers.{AnalyzerDsl, CommonGramsTokenFilter, EdgeNGramTokenFilter, NGramTokenFilter, ShingleTokenFilter, SnowballTokenFilter, StemmerTokenFilter, To... |
Explain and rewrite the following Scala code: | package com.rockymadden.stringmetric.filter
import com.rockymadden.stringmetric.StringFilter
/** Ensures ASCII symbols do not matter. */
trait AsciiSymbolFilter extends StringFilter {
abstract override def filter(charArray: Array[Char]): Array[Char] =
super.filter(
charArray.filter(c =>
!((c >= 32 && c <= 4... |
Explain and rewrite the following Scala code: | package me.laiseca.urlmapper
import java.util.StringTokenizer
import me.laiseca.urlmapper.trie.{NilTrie, Trie}
/**
* Created by Xabier Laiseca on 20/07/14.
*/
class UrlMatcher {
def matchUrl[T](url: String, paths: PathTrie[T]): List[UrlMapping[T]] = {
def mappings(current: UrlSegment, rest: List[String], p... |
Explain and rewrite the following Scala code: | package filodb.core.metadata
import com.typesafe.config.Config
import com.typesafe.scalalogging.StrictLogging
import net.ceedubs.ficus.Ficus._
import org.scalactic._
import filodb.core.GlobalConfig
import filodb.core.Types._
import filodb.core.binaryrecord2._
import filodb.core.downsample.{ChunkDownsampler, Downsampl... |
Explain and rewrite the following Scala code: | package co.rc.smservice.api.infrastructure.acl.dtos
/**
* Class that represents a expiration time dto
* @param value Expiration time value
* @param unit Expiration time unit
*/
case class ExpirationTimeDTO( value: Int, unit: String ) {
require( List( "seconds", "minutes", "hours", "days" ).contains( unit ),
... |
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: | /*
* 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 lila
package object forum extends PackageObject {
private[forum] def teamSlug(id: String) = s"team-$id"
private[forum] val logger = lila.log("forum")
}
|
Explain and rewrite the following Scala code: | /**
* Copyright (c) 2012, www.quartzsource.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
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 t... |
Explain and rewrite the following Scala code: | /*******************************************************************************
* Copyright (C) 2012 Łukasz Szpakowski.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either ver... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Miroslav Janíček
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... |
Explain and rewrite the following Scala code: | package com.cave.metrics.data
import play.api.libs.json._
import play.api.libs.functional.syntax._
case class Schedule(orgName: String, teamName: Option[String], clusterName: Option[String], notificationUrl: String, alert: Alert) {
def databaseName = teamName.map(_ + ".").getOrElse("") + orgName
}
object Schedule ... |
Explain and rewrite the following Scala code: | package com.prezi.haskell.gradle.extension.impl
import com.prezi.haskell.gradle.ApiHelper._
import com.prezi.haskell.gradle.Names
import com.prezi.haskell.gradle.extension.ProjectExtender
import com.prezi.haskell.gradle.external.{Git, HaskellTools}
import com.prezi.haskell.gradle.tasks.{GenerateStackYaml, StackPathTas... |
Explain and rewrite the following Scala code: | /*
* This file is part of EasyForger which is released under GPLv3 License.
* See file LICENSE.txt or go to http://www.gnu.org/licenses/gpl-3.0.en.html for full license details.
*/
package com.easyforger.recipes.test
import com.easyforger.recipes.RecipeOps
import net.minecraft.block.Block
import net.minecraft.init.... |
Explain and rewrite the following Scala code: | package com.bounscale
class HerokuWriter extends BaseWriter {
override def output(str : String){
println(str)
}
}
|
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.wheaties.predicate.defined
class NotDefinedForException(args: Any*) extends Exception{
override def toString() = "Not Defined For %s" format (args mkString (","))
}
|
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: | /*
* FScapePlatform.scala
* (FScape)
*
* Copyright (c) 2001-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.proc.impl
i... |
Explain and rewrite the following Scala code: | package cromwell.engine.workflow.lifecycle.execution.job
import akka.actor.SupervisorStrategy.{Escalate, Stop}
import akka.actor.{ActorInitializationException, ActorRef, LoggingFSM, OneForOneStrategy, Props}
import cromwell.backend.BackendCacheHitCopyingActor.CopyOutputsCommand
import cromwell.backend.BackendJobExecut... |
Explain and rewrite the following Scala code: | package endpoints
package documented
package openapi
import scala.collection.generic.CanBuildFrom
import scala.language.higherKinds
/**
* An interpreter for [[algebra.JsonSchemas]] that produces a JSON schema for
* a given algebraic data type description.
*/
trait JsonSchemas extends algebra.JsonSchemas {
im... |
Explain and rewrite the following Scala code: | /*
* Most of these test cases are ported from http://github.com/sinatra/sinatra/tree master/test/routing_test.rb
*/
package org.scalatra
import test.scalatest.ScalatraFunSuite
class RouteTestServlet extends ScalatraServlet {
get("/foo") {
"matched simple string route"
}
get(params.getOrElse("booleanTest"... |
Explain and rewrite the following Scala code: | /* ____ __ ____ ____ ____,,___ ____ __ __ ____
* ( _ \\ /__\\ (_ )(_ _)( ___)/ __) ( _ \\( )( )( _ \\ Read
* ) / /(__)\\ / /_ _)(_ )__) \\__ \\ )___/ )(__)( ) _ < README.txt
* (_)\\_)(__)(__)(____)(____)(____)(___/ (__) (______)(____/ LICENSE.txt
*/
pack... |
Explain and rewrite the following Scala code: | package com.box.castle.core.worker.tasks
import java.nio.charset.Charset
import com.box.castle.core.config.{CommitterConfig, InitialOffset}
import org.json4s._
import org.json4s.ext.EnumNameSerializer
import org.json4s.jackson.JsonMethods._
import org.json4s.jackson.Serialization
import scala.util.control.NonFatal
... |
Explain and rewrite the following Scala code: | package at.logic.gapt.proofs.expansion
import at.logic.gapt.expr.Polarity.{ Negative, Positive }
import at.logic.gapt.expr._
import at.logic.gapt.formats.babel.{ BabelExporter, BabelSignature }
import at.logic.gapt.utils.Doc
import Doc._
class ExpansionTreePrettyPrinter( sig: BabelSignature ) extends BabelExporter( u... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 http4s.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... |
Explain and rewrite the following Scala code: | /*
* 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: | package net.sansa_stack.test.conformance
import org.apache.jena.rdf.model.Model
/**
* A test case to test the conformance of a particular forward chaining reasoner rule.
*
* @author Lorenz Buehmann
*/
case class TestCase(id: String, description: String, testCaseType: String, inputGraph: Model, outputGraph: Mo... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Explain and rewrite the following Scala code: | package com.softwaremill.codebrag.dao.finders.views
import org.joda.time.DateTime
case class CommitReactionsView(entireCommitReactions: ReactionsView, inlineReactions: Map[String, Map[String, ReactionsView]])
case class ReactionsView(comments: Option[List[ReactionView]], likes: Option[List[ReactionView]])
trait Rea... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package text.vector.wordembedding.fastText
import java.io.{IOException, PrintWriter}
import java.nio.charset.{CodingErrorAction, StandardCharsets}
import java.nio.file.{Files, Paths}
import text.StringNone
import util.Config
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.sys.process.Process
... |
Explain and rewrite the following Scala code: | /*
* Derived from https://github.com/spray/spray/blob/v1.1-M7/spray-http/src/main/scala/spray/http/parser/SimpleHeaders.scala
*
* Copyright (C) 2011-2012 spray.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 obtai... |
Explain and rewrite the following Scala code: | package com.twitter.lsh.stores
import com.twitter.logging.Logger
import com.twitter.lsh.hashing.HashFamily
import com.twitter.lsh.vector._
import com.twitter.storehaus.FutureOps
import com.twitter.storehaus.algebra.MergeableStore
import com.twitter.util.Future
/**
* Base implementations of the HashTableManager
* If... |
Explain and rewrite the following Scala code: | package stronghold.combinatorics
/**
* problem description: http://rosalind.info/problems/mmch/
*/
object MaximumMatchings {
object SampleData {
val sample: List[String] =
List(
">Rosalind_92",
"AUGCUUC"
)
}
import SampleData.sample
import utils.UtilityFunctions.{Fasta, r... |
Explain and rewrite the following Scala code: | package ru.pavkin.todoist.api.core
import shapeless.tag
import shapeless.tag._
object tags {
/**
* Tag for project ids
*/
trait ProjectId
/**
* Tag for label ids
*/
trait LabelId
/**
* Tag for task ids
*/
trait TaskId
/**
* Tag for user ids
*/
trait UserId
/**
* T... |
Explain and rewrite the following Scala code: | import sbt._
object Resolvers {
val ivyLocal = Resolver.file("local-ivy", file(Path.userHome.absolutePath + "/.ivy2/local"))
val tanukkii007 = Resolver.bintrayRepo("tanukkii007", "maven")
}
|
Explain and rewrite the following Scala code: | package skinny.controller.feature
import org.scalatra.test.scalatest.ScalatraFlatSpec
import skinny._
import skinny.controller.SkinnyController
class FormParamsFeatureSpec extends ScalatraFlatSpec {
behavior of "FormParamsFeature"
class Controller extends SkinnyController {
def single = formParams.getAs[Stri... |
Explain and rewrite the following Scala code: | package com.larskroll.whloot
import spray.util._
import spray.http._
import akka.actor.{ ActorLogging, Actor }
import akka.pattern.{ ask, pipe }
import scala.concurrent._
import scala.concurrent.duration._
import akka.util.Timeout
import spray.routing.{ HttpService, Route }
import spray.routing.directives._
import spr... |
Explain and rewrite the following Scala code: | package org.fedoraproject.mobile
import Badges.Badge
import Implicits._
import scalaz._, Scalaz._
import android.app.Activity
import android.content.{ Context, Intent }
import android.net.Uri
import android.util.Log
import android.view.{ LayoutInflater, View, ViewGroup }
import android.view.View.OnClickListener
imp... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2015-2017 EpiData, Inc.
*/
package controllers
import _root_.providers.DemoProvider
import play.api.Logger
import play.api.i18n.Messages
import play.api.libs.json.{ JsValue, Json }
import play.api.mvc._
import securesocial.controllers.ProviderController._
import securesocial.core._
import securesoc... |
Explain and rewrite the following Scala code: | package smallcheck
/**
* Methods to invoke SmallCheck
*/
object Drivers {
import Property.{TestCase, Pass, Fail, Inappropriate}
/** Run SmallCheck on a property from depth 0 to a given depth d */
def smallCheck(d: Int, p: Property) = iterCheck(0, Some(d), p)
/** Run SmallCheck on collection of properties... |
Explain and rewrite the following Scala code: | package com.eclipsesource.schema
import java.net.{URL, URLStreamHandler}
import com.eclipsesource.schema.drafts.{Version4, Version7}
import com.eclipsesource.schema.internal._
import com.eclipsesource.schema.internal.refs.{DocumentCache, Ref, SchemaRefResolver, SchemaResolutionScope}
import com.eclipsesource.schema.i... |
Explain and rewrite the following Scala code: | package scalafiddle.server
import javax.inject.Inject
import play.api.http.DefaultHttpFilters
import play.filters.cors.CORSFilter
import play.filters.gzip.GzipFilter
class Filters @Inject() (corsFilter: CORSFilter, gzipFilter: GzipFilter) extends DefaultHttpFilters(corsFilter, gzipFilter)
|
Explain and rewrite the following Scala code: | /* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2016, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/... |
Explain and rewrite the following Scala code: | package flaky.history
import java.io.{ByteArrayInputStream, File}
import org.scalatest.{Matchers, WordSpec}
import scala.io.Source
class HistoryReportDescriptionSpec extends WordSpec with Matchers {
private val fileContent =
"""|<HistoryReportDescription>
| <timestamp> 123456 </timestamp>
| <... |
Explain and rewrite the following Scala code: | package com.github.skozlov.ai
import java.awt.BorderLayout
import java.awt.event.{MouseEvent, MouseAdapter}
import javax.swing.{DefaultListModel, JList}
import scala.swing.event.ButtonClicked
import scala.swing.{Button, BorderPanel}
class AgentTypesUI(implicit model: Model) extends BorderPanel{
tooltip = "Double-cl... |
Explain and rewrite the following Scala code: | package eu.reactivesystems.league.infra
import eu.reactivesystems.league.impl.{
ClubRegistered,
GamePlayed,
ResultRevoked
}
import eu.reactivesystems.league.impl.LeagueEntity._
import spray.json.JsonFormat
import scala.reflect.ClassTag
/**
* TODO..
*/
object JsonRegistry {
val mappings: Map[String, JsonF... |
Explain and rewrite the following Scala code: | // Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package com.google.protobuf.struct
/** `ListValue` is a wrapper around a repeated field of values.
*
* The JSON representation for `ListValue` is JSON array.
*
* @param values
* Repeated field... |
Explain and rewrite the following Scala code: | package com.normation.cfclerk.xmlwriters
import net.liftweb.common._
import com.normation.cfclerk.domain._
import com.normation.cfclerk.xmlparsers.CfclerkXmlConstants._
import scala.xml._
trait SectionSpecWriter {
def serialize(rootSection:SectionSpec):Box[NodeSeq]
}
class SectionSpecWriterImpl extends SectionS... |
Explain and rewrite the following Scala code: | package com.shocktrade.autonomous.dao
import io.scalajs.npm.mongodb.ObjectID
import scala.scalajs.js
/**
* Robot Data
* @author Lawrence Daniels <lawrence.daniels@gmail.com>
*/
class RobotData(val _id: js.UndefOr[ObjectID] = js.undefined,
val playerID: js.UndefOr[String],
val fa... |
Explain and rewrite the following Scala code: | package skinny
import scala.language.implicitConversions
/**
* Skinny validator provides easy-to-understand and readable DSLs to validate inputs.
*/
package object validator {
/**
* Accepts key and value.
*
* @param kv key and value
* @return param definition
*/
def param(kv: (String, Any)): Key... |
Explain and rewrite the following Scala code: | package com.datafellas.g3nerator.model
import com.typesafe.config.ConfigFactory
import notebook.io.ConfigurationMissingException
import org.scalatest.{Matchers, OptionValues, TryValues, WordSpec}
import scala.collection.JavaConverters._
class SecuredUrlTests extends WordSpec with Matchers with TryValues with OptionV... |
Explain and rewrite the following Scala code: | package com.giampaolotrapasso.ydl.datastore
import com.typesafe.scalalogging.LazyLogging
import io.vertx.core.{AsyncResult, Handler, Vertx => JVertx}
import io.vertx.ext.jdbc.JDBCClient
import io.vertx.ext.sql.SQLClient
import io.vertx.lang.scala.ScalaVerticle
import io.vertx.scala.core.eventbus.Message
import play.ap... |
Explain and rewrite the following Scala code: | package com.mehmetakiftutuncu.muezzinapi
import java.time.LocalDate
import com.mehmetakiftutuncu.muezzinapi.models.PrayerTimesOfDay
package object services {
def filterOutOldPrayerTimes(prayerTimes: List[PrayerTimesOfDay]): List[PrayerTimesOfDay] = {
val today: LocalDate = LocalDate.now()
prayerTimes.filt... |
Explain and rewrite the following Scala code: | final class Opt[+A >: Null](val value: A) extends AnyVal {
def get: A = value
def isEmpty = value == null
}
object Opt {
final val None = new Opt[Null](null)
def unapply[A >: Null](x: A): Opt[A] = if (x == null) None else Opt(x)
def empty[A >: Null] = None
def apply[A >: Null](value: A): Opt[A] = if (value... |
Explain and rewrite the following Scala code: | package org.bjean.sample.wordcount.aws.support
import org.scalatest.Assertions
import org.scalatest.concurrent.AsyncAssertions
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success}
object ScalaTestFutureHelper {
implicit class Failing[A](val f: Future[A])(implicit ec: ExecutionC... |
Explain and rewrite the following Scala code: | package org.dama.datasynth.schema
import scala.reflect.runtime.universe._
/**
* Created by joangui on 13/04/2017.
* Represents the schema of the graph to be generated. It support NodeTypes and EdgeTypes.
* Each NodeType has a "name" and a number of "instances" to generate. The NodeType also may
* include a li... |
Explain and rewrite the following Scala code: | package org.receiver2d.engine
import java.util.concurrent.TimeUnit
import java.util.logging.{Level, Logger}
import org.receiver2d.engine.graphics.{DisplayHandler, Renderer}
import org.receiver2d.engine.io.{ErrorHandler, LogHandler}
import org.receiver2d.engine.physics.{PhysicsException, Mechanics}
import scala.colle... |
Explain and rewrite the following Scala code: | //缓存RDD
linesWithSpark.cache()
//多次调用结果一致
linesWithSpark.count()
//定义但不执行
val lines = sc.textFile("data.txt")
val lineLengths = lines.map(s => s.length)
//开始执行
val totalLength = lineLengths.reduce((a, b) => a + b)
//持久化-在reduce之前,当计算一次后存储到内存
lineLengths.persist() |
Explain and rewrite the following Scala code: | import scala.collection.immutable.BitSet
import scala.io.Source
import scala.math._
import scala.util.Random
import scala.util.hashing.MurmurHash3
import scala.annotation.tailrec
case class BloomFilter[A <: String](capacity: Int, falseProbability: Float, bits: BitSet = BitSet.empty) {
type HashFunction = (A => 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: | /*
* 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 org.scalatra
package atmosphere
import org.atmosphere.cpr.{Action => AtmoAction, BroadcasterFactory, AtmosphereResponse, AtmosphereRequest, AtmosphereFramework}
import org.atmosphere.container._
import java.util.UUID
import org.atmosphere.cpr.ApplicationConfig._
import org.atmosphere.cpr.FrameworkConfig._
impo... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package play.core.server.netty
import io.netty.handler.codec.http.DefaultHttpHeaders
import org.specs2.mutable._
import play.api.mvc._
class NettyHeadersWrapperSpec extends Specification {
val headers: Headers = {
val nettyHeaders = n... |
Explain and rewrite the following Scala code: | package unfiltered.netty
import unfiltered.specs2.SecureClient
import unfiltered.response.{ Ok, ResponseString }
import unfiltered.request.{ GET, Path => UFPath}
import unfiltered.netty.cycle.{ Plan, SynchronousExecution }
import io.netty.handler.ssl.{
NotSslRecordException,
SslHandshakeCompletionEvent
}
import io... |
Explain and rewrite the following Scala code: | package de.fuberlin.wiwiss.silk.runtime.resource
import java.io.InputStream
import scala.io.{Codec, Source}
/**
* A resource, such as a file, which is required by a plugin.
*/
trait Resource {
/**
* The local name of this resource.
*/
def name: String
/**
* Loads the resource.
*
* @return An ... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | package com.benoj.janus.suppliers
import akka.actor.ActorRef
object Actors {
case class IdSupplier(actor: ActorRef)
}
|
Explain and rewrite the following Scala code: | package TurboRav
import Chisel._
class FpgaRamTest(c: FpgaRam) extends JUnitTester(c) {
def write_and_then_read_back(addr: Long, word: Long, word_length_bytes: Int): Unit = {
println("write_and_then_read_back(addr: %x, word: %x, word_length_bytes: %x)".format(
addr, word, word_length_bytes
)
)
... |
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 org.gosanjeev.datasift
import com.typesafe.config.ConfigFactory
import com.typesafe.config.Config
import org.json4s._
import JsonDSL._
import org.json4s.native.JsonMethods._
import org.json4s.DefaultFormats
import org.json4s.native.JsonMethods._
import java.io.{File, FileWriter, PrintWriter}
import org.gosanje... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package annotator
package element
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.externalLibraries.bm4.Implicit0Pattern
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil.inNameContext
import org.jetbrains.plugins.scala.lang.psi.api.base.ScS... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2007 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This p... |
Explain and rewrite the following Scala code: | /*
* Copyright 2015 Heiko Seeberger
*
* 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: | import com.github.nscala_time.time.Imports._
import org.joda.time.format.DateTimeFormatter
import org.joda.time.DateTime.parse
object Birthday {
val df : DateTimeFormatter = DateTimeFormat.forPattern("yyyy: EEEE")
val idf : DateTimeFormatter = DateTimeFormat.forPattern("MM/dd")
var dt : DateTime = new DateTime
... |
Explain and rewrite the following Scala code: | package stasiak.karol.fimpp
import java.lang.reflect.{Field, Modifier, Constructor, Method}
import Modifier.STATIC
import Modifier.PRIVATE
import javax.swing.JFrame
import java.util
import collection.mutable.ListBuffer
object JavaInterop {
def normalizeFromFim(str: String) = str.toLowerCase.replaceAll(" ","").repl... |
Explain and rewrite the following Scala code: | /*
* Copyright (C) 2014 AyaIB Developers (http://github.com/fauu/AyaIB)
*
* This software is licensed under the GNU General Public License
* (version 3 or later). See the COPYING file in this distribution.
*
* You should have received a copy of the GNU Library General Public License
* along with this software. I... |
Explain and rewrite the following Scala code: | package org.bitcoins.core.protocol
import org.bitcoins.core.config.TestNet3
import org.bitcoins.core.gen.{CryptoGenerators, ScriptGenerators}
import org.bitcoins.core.protocol.script.P2SHScriptPubKey
import org.bitcoins.core.util.CryptoUtil
import org.scalacheck.{Prop, Properties}
/**
* Created by chris on 7/21/16.... |
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: | // 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 of the License at
//
// http://www.apache... |
Explain and rewrite the following Scala code: | package teststate.domzipper
trait SharedExports extends teststate.util.Exports {
final implicit def toMofNOps(i: Int): MofN.IntExt =
new MofN.IntExt(i)
final type HtmlScrub = teststate.domzipper.HtmlScrub
final val HtmlScrub = teststate.domzipper.HtmlScrub
implicit def htmlScrub: HtmlScrub =
HtmlSc... |
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2015 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala.lang.psi.impl.base.types
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.psi.ScalaPsiElementImpl
impo... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Explain and rewrite the following Scala code: | package java.lang
import scala.scalajs.js
class Runtime private {
def exit(status: Int): Unit =
halt(status)
//def addShutdownHook(hook: Thread): Unit
//def removeShutdownHook(hook: Thread): Unit
def halt(status: Int): Unit = {
val envInfo = scala.scalajs.runtime.environmentInfo
envInfo.exitFun... |
Explain and rewrite the following Scala code: | package com.sksamuel.elastic4s.searches
import com.sksamuel.elastic4s.{DocumentRef, Indexable}
import com.sksamuel.elastic4s.searches.queries.{SpanQueryDefinition, _}
import com.sksamuel.elastic4s.searches.queries.funcscorer.FunctionScoreQueryDefinition
import org.apache.lucene.search.join.ScoreMode
import org.elastic... |
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 ml.combust.mleap.core.classification
import ml.combust.mleap.core.types.{ScalarType, StructField, TensorType}
import org.apache.spark.ml.linalg.{Matrices, Vectors}
import org.scalatest.FunSpec
/**
* Created by hollinwilkins on 5/23/17.
*/
class LogisticRegressionModelSpec extends FunSpec {
describe("Bin... |
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 xsbt
import xsbti.compile.SingleOutput
import java.io.File
import _root_.scala.tools.nsc.reporters.ConsoleReporter
import _root_.scala.tools.nsc.Settings
import xsbti._
import xsbti.api.SourceAPI
import sbt.IO.withTemporaryDirectory
import xsbti.api.ClassLike
import xsbti.api.Definition
import xsbti.api.Def
im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.