instruction stringclasses 1
value | output stringlengths 5 1M |
|---|---|
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Explain and rewrite the following Scala code: | /*
* 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.sisioh.aws4s.dynamodb.document
import java.nio.ByteBuffer
import java.util
import com.amazonaws.services.dynamodbv2.document.Item
import org.sisioh.aws4s.PimpedType
import scala.collection.JavaConverters._
object ItemFactory {
def fromMap(attributes: Map[String, AnyRef]): Item =
Item.fromMap(attr... |
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"); yo... |
Explain and rewrite the following Scala code: | //class IntWrapper(val underlying: Int) extends AnyVal
object Outer {
println(this.getClass.getName)
//class Inner(val x: Int) extends AnyVal
class Inner {
println("hello")
}
}
Outer
new Outer.Inner
|
Explain and rewrite the following Scala code: | package almhirt.common
import scalaz.Validation.FlatMap._
final case class TraverseWindow(skip: TraverseWindow.LowerBound, take: TraverseWindow.Length)
object TraverseWindow {
val noWindow = TraverseWindow(SkipNone, TakeAll)
implicit class TraverseWindowOps(val self: TraverseWindow) extends AnyVal {
def toI... |
Explain and rewrite the following Scala code: | package net.sf.latexdraw.parsers.pst.parser
import scala.util.parsing.combinator.syntactical.TokenParsers
import net.sf.latexdraw.glib.models.interfaces.IGroup
import net.sf.latexdraw.glib.models.interfaces.IShape
/**
* Defines an interface for a parser parsing basic PST expressions.<br>
*<br>
* This file is part... |
Explain and rewrite the following Scala code: | /*
Copyright 2015 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 to in writing, soft... |
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 codecheck.github.operations
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import org.json4s.JArray
import codecheck.github.api.GitHubAPI
import codecheck.github.exceptions.NotFoundException
import codecheck.github.models.Organization
import codecheck.github.models.Or... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
package org.apache.spark.streaming.kafka
import kafka.common.TopicAndPartition
import org.apache.spark.{Partition, SparkContext, SparkConf}
import org.apache.spa... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2013-2020 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... |
Explain and rewrite the following Scala code: | /*
* Copyright 2019 Scanamo
*
* 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 w... |
Explain and rewrite the following Scala code: | package models
import java.sql.{ Connection, Statement, PreparedStatement }
import org.joda.time.DateTime
import com.github.nscala_time.time.Imports._
import org.joda.time.format.DateTimeFormat
/** Uses the JDBC interfance, and not Anorm or Slick, to insert rows into the database. This object
* is used for testing ... |
Explain and rewrite the following Scala code: | package com.webtrends.harness.component.zookeeper.discoverable.typed
import akka.actor.{ActorContext, ActorRef, ActorSystem}
import akka.util.Timeout
import akka.pattern._
import com.webtrends.harness.HarnessConstants
import com.webtrends.harness.command.typed.ExecuteTypedCommand
import com.webtrends.harness.component... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.http
import com.twitter.conversions.time._
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class CookieMapTest extends FunSuite {
test("no cookies") {
val request = Request()
request.cookies.isEmp... |
Explain and rewrite the following Scala code: | /**
* Copyright (c) 2002-2014, OnPoint Digital, Inc. All rights reserved
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS... |
Explain and rewrite the following Scala code: | /*
* Copyright 2014 E-Terra Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... |
Explain and rewrite the following Scala code: | /*
* Copyright 2016 Uncharted Software 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 o... |
Explain and rewrite the following Scala code: | /**
* Copyright 2015 Adrian Hurtado (adrianhurt)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... |
Explain and rewrite the following Scala code: | package org.atmosphere.cpr
import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
import akka.actor.ActorSystem
import grizzled.slf4j.Logger
import org.scalatra.atmosphere.{ ScalatraBroadcaster, WireFormat }
import org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY
import scala.col... |
Explain and rewrite the following Scala code: | /*
Copyright 2014 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... |
Explain and rewrite the following Scala code: | package demo.components.elementalui
import chandu0101.macros.tojs.GhPagesMacros
import chandu0101.scalajs.react.components.elementalui._
import demo.components.CodeExample
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.TagOf
import japgolly.scalajs.react.vdom.html_<^._
import org.scalajs.dom.html.D... |
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.thrift
import com.twitter.finagle._
import com.twitter.finagle.filter.PayloadSizeFilter
import com.twitter.util.{Future, Stopwatch}
import org.apache.thrift.protocol.{TBinaryProtocol, TMessage, TMessageType, TProtocolFactory}
import org.apache.thrift.transport.TMemoryInputTransport
import o... |
Explain and rewrite the following Scala code: | package aiouniya.spark.util
import aiouniya.spark.util.UserMode.UserMode
import org.apache.commons.codec.digest.DigestUtils
/**
* Created by zstorm on 2017/6/6.
*/
object UseridUtil {
def getUserType(userid: String): UserType.UserType = {
if (userid == null || userid.length == 0) {
retu... |
Explain and rewrite the following Scala code: | /***********************************************************************
* Copyright (c) 2017-2022 IBM
* Copyright (c) 2013-2022 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which ac... |
Explain and rewrite the following Scala code: | package nars.gui
import java.awt._
import java.awt.event._
import nars.entity.Concept
import ConceptWindow._
//remove if not needed
import scala.collection.JavaConversions._
object ConceptWindow {
/**
Used to adjust the screen position
*/
private var instanceCount: Int = 0
}
/**
* Window displaying the c... |
Explain and rewrite the following Scala code: |
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author Robert Davis, John Miller
* @builder scalation.linalgebra.bld.BldSymTriMatrix
* @version 1.3
* @date Sun Sep 16 14:09:25 EDT 2012
* @see LICENSE (MIT style license file).
*/
package scalation.linalgebra
impo... |
Explain and rewrite the following Scala code: | package services.publisher
import common.publisher.{BasicPubSubService, Param, Event}
import javax.inject.{Inject, Singleton}
import model.Post
import monix.execution.Scheduler
import scala.language.postfixOps
@Singleton
class PostPubSubServiceImpl @Inject()(implicit scheduler: Scheduler) extends BasicPubSubService[... |
Explain and rewrite the following Scala code: | /* sbt -- Simple Build Tool
* Copyright 2009 Mark Harrah
*/
package sbt
package classfile
import java.io.{ DataInputStream, File, InputStream }
import scala.annotation.switch
// Translation of jdepend.framework.ClassFileParser by Mike Clark, Clarkware Consulting, Inc.
// BSD Licensed
//
// Note that unlike the rest... |
Explain and rewrite the following Scala code: | package com.cloudray.scalapress.plugin.asset.maxsize
import java.io.{ByteArrayInputStream, InputStream}
import com.cloudray.scalapress.media.AssetLifecycleListener
import org.springframework.stereotype.Component
import com.sksamuel.scrimage.Image
import org.springframework.beans.factory.annotation.Autowired
import org... |
Explain and rewrite the following Scala code: | package elcurto99.scalaquestrade.models
/**
*
* @see http://www.questrade.com/api/documentation/rest-operations/enumerations/enumerations
*/
object Currency extends Enumeration {
type Currency = Value
val USD, CAD = Value
}
object ListingExchange extends Enumeration {
type ListingExchange = Value
val T... |
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 2022 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Explain and rewrite the following Scala code: | // Copyright (c) 2013-2020 Rob Norris and Contributors
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT
package example
import cats.effect._
import doobie._
import doobie.hikari._
import doobie.implicits._
object HikariExample extend... |
Explain and rewrite the following Scala code: | package peregin.gpv.video
import com.xuggle.mediatool.IMediaReader
import com.xuggle.xuggler.ICodec
import peregin.gpv.util.Logging
object MediaInfo extends Logging {
def logInfo(mr: IMediaReader): Unit = {
// show some video info
val container = mr.getContainer
info(s"duration = ${container.getDurati... |
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 ccn.packet
import org.scalatest.{Matchers, FlatSpec}
case class CCNPacketTest() extends FlatSpec with Matchers {
"A CCNName beginning with 'COMPUTE'" should "yield true for isCompute" in {
CCNName("COMPUTE", "cmp1", "cmp2").isCompute shouldBe true
}
"A CCNName not beginning with 'COMPUTE'" should ... |
Explain and rewrite the following Scala code: | /*******************************************************************************
* Copyright (c) 2019. Carl Minden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the ... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2012 - 2020 Splice Machine, Inc.
*
* This file is part of Splice Machine.
* Splice Machine 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, or (at your option) ... |
Explain and rewrite the following Scala code: | package sohu.com.test
/**
* Created by root on 2017/5/11.
*/
object test02 {
}
|
Explain and rewrite the following Scala code: | package org.oxbow.codebridge.ui
import javafx.beans.property.SimpleObjectProperty
import org.oxbow.codebridge.scm.Repository
trait RepositoryAware {
val repositoryProperty = new SimpleObjectProperty[Repository](null)
def repository = repositoryProperty.get
def repository_=(repo: Repository) = reposi... |
Explain and rewrite the following Scala code: | /**
* Copyright (C) 2011 - 101loops.com <dev@101loops.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... |
Explain and rewrite the following Scala code: | package gitbucket.core.service
import gitbucket.core.model.Issue
import gitbucket.core.util._
import gitbucket.core.util.StringUtil
import Directory._
import SyntaxSugars._
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.treewalk.TreeWalk
import org.eclipse.jgit.lib.FileMode
import org.eclipse.jgit.api... |
Explain and rewrite the following Scala code: | /*
* Copyright 2009-2016 DigitalGlobe, 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 ag... |
Explain and rewrite the following Scala code: | package com.gilt.handlebars.scala.visitor
import com.gilt.handlebars.scala.Handlebars
import org.scalatest.{ FunSpec, Matchers }
import com.gilt.handlebars.scala.helper.Helper
import com.gilt.handlebars.scala.binding.dynamic._
/**
* User: chicks
* Date: 12/29/13
*/
class BuiltInHelperSpec extends FunSpec with Matc... |
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 fpinscala.gettingstarted
// A comment!
/* Another comment */
/** A documentation comment */
object MyModule {
def abs(n: Int): Int =
if (n < 0) -n
else n
private def formatAbs(x: Int) = {
val msg = "The absolute value of %d is %d"
msg.format(x, abs(x))
}
def main(args: Array[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 org.eclipse.jetty.server.Server
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.log.{Log => JettyLog, Slf4jLog}
import org.slf4j.LoggerFactory
object SimpleServer {
import scala.language.implicitConversions
val log = LoggerFactory.getLogger("simpleserver")
// Jet... |
Explain and rewrite the following Scala code: | package org.jetbrains.plugins.scala
package lang.adjustTypes.tests
import org.jetbrains.plugins.scala.lang.adjustTypes.AdjustTypesTestBase
/**
* Nikolay.Tropin
* 7/11/13
*/
class AdjustTypesTests extends AdjustTypesTestBase {
def testSimpleJava() = doTest()
def testParameterizedJava() = doTest()
def testJ... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2017 Magomed Abdurakhmanov, Hypertino
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
package com.hypertino.hyperbus.transport
import jav... |
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 spider
package cli
import spider.spider3w3n._
import spider.Util.{ cwd, tryOption, errorExit }
import spider.Util.DateTimeUtil.{ fromFormatString }
import spider.database.DBConfig
import slick.jdbc.JdbcBackend.Database
import com.github.nscala_time.time.Imports._
import scala.util.{ Try, Success, Failure }
... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2013-14 Lars Hupel, Miles Sabin
*
* 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 applicabl... |
Explain and rewrite the following Scala code: | package me.fornever.checktimer
import java.time.Duration
import javafx.animation.{KeyFrame, Timeline}
import javafx.event.{ActionEvent, EventHandler}
import me.fornever.checktimer.dto.TrackDto
import scalafx.animation.Animation
import scalafx.beans.binding.{Bindings, StringBinding}
import scalafx.beans.property.Obje... |
Explain and rewrite the following Scala code: | package geotrellis.op
import java.io.{File,FileInputStream,FileOutputStream}
import scala.math.{max,min,sqrt}
import geotrellis.geometry.Polygon
import geotrellis.data.ColorBreaks
import geotrellis.Raster
import geotrellis.{Extent,RasterExtent}
import geotrellis._
import geotrellis.statistics._
import geotrellis.ra... |
Explain and rewrite the following Scala code: | /*
* Copyright 2001-2013 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... |
Explain and rewrite the following Scala code: | package pl.touk.nussknacker.ui.initialization
import akka.http.scaladsl.testkit.ScalatestRouteTest
import org.scalatest.{BeforeAndAfterEach, FlatSpec, Matchers}
import pl.touk.nussknacker.engine.api.process.ProcessName
import pl.touk.nussknacker.test.PatientScalaFutures
import pl.touk.nussknacker.ui.api.helpers.TestFa... |
Explain and rewrite the following Scala code: | package io.apibuilder.avro
import org.apache.avro.Schema
import scala.jdk.CollectionConverters._
import io.apibuilder.spec.v0.models._
object ApiBuilder {
sealed trait Type {
def name: String
def required: Boolean
}
case class SimpleType(
name: String,
required: Boolean = true
) extends Type... |
Explain and rewrite the following Scala code: | package models.messages.client
/**
* Created by basso on 28/04/15.
*/
case class UserAlreadyLoggedIn(username: String) extends ClientManagerMessage
|
Explain and rewrite the following Scala code: | /*
* Copyright 2013 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: | package breeze.linalg
import breeze.generic.UFunc
import breeze.linalg.svd.SVD
import dev.ludovic.netlib.LAPACK.{getInstance => lapack}
import breeze.linalg.support.CanTraverseValues
import breeze.linalg.support.CanTraverseValues.ValuesVisitor
import breeze.math.Field
/**
* Computes the rank of a matrix.
*
* The r... |
Explain and rewrite the following Scala code: | package com.mayreh.kaiyote.resource
import java.io.File
import com.mayreh.kaiyote.backend.Backend
import com.mayreh.kaiyote.data.{FileGroup, FileOwner, FilePermission}
case class DirectoryState(
exists: Boolean,
mode: Option[FilePermission] = None,
owner: Option[FileOwner] = None,
group: Option[FileGroup] = ... |
Explain and rewrite the following Scala code: | package com.karasiq.shadowcloud.test.crypto
import java.security.NoSuchAlgorithmException
import com.karasiq.shadowcloud.crypto.EncryptionModule
import com.karasiq.shadowcloud.model.crypto.{EncryptionMethod, EncryptionParameters}
import com.karasiq.shadowcloud.test.utils.CoreTestUtils.modules
import com.karasiq.shado... |
Explain and rewrite the following Scala code: | package spire.math
import scala.reflect.ClassTag
// scalatest
import org.scalatest.FunSuite
// we need to disable our own === to avoid messing up ScalaTest.
import spire.implicits.{eqOps => _, _}
import java.math.MathContext
// nice alias
import scala.{specialized => spec}
class NumericTest extends FunSuite {
... |
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 infrastructure.attachment
import java.io.File
import domain.attachment._
import model.FileImage
import scalikejdbc.DBSession
import util.CurrentDateUtil
/**
* AttachmentFileRepositoryの実装クラス.
*/
class AttachmentFileRepositoryImpl extends AttachmentFileRepository {
/**
* @inheritdoc
*/
override de... |
Explain and rewrite the following Scala code: | import scala.util.Random
/**
* Keeps track of all references.
*/
object ObjectRef {
var current: Int = 0
def reset(): Unit = current = 0
def next(): Int = {
current = current + 1
current
}
}
object ObjectGenerator {
/**
* Creates a leaf object
* @param clazz Which class to use
* @... |
Explain and rewrite the following Scala code: | package net.ruippeixotog.scalascraper.scraper
import com.typesafe.config.Config
import net.ruippeixotog.scalascraper.util.ConfigReader
import org.jsoup.select.Elements
import scala.collection.convert.WrapAsScala._
import scala.util.Try
trait HtmlValidator[+R] {
def matches(doc: Elements): Boolean
def result: Opt... |
Explain and rewrite the following Scala code: | /*
* Accio is a platform to launch computer science experiments.
* Copyright (C) 2016-2018 Vincent Primault <v.primault@ucl.ac.uk>
*
* Accio is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version... |
Explain and rewrite the following Scala code: | package org.synyx.git
import java.io.File
class RepositoryConfig(val name: String, val folder: File, val url: String) {
def isCheckedOut(): Boolean = {
new File(folder, ".git").exists()
}
}
|
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 typeclass.data
import typeclass.Monad
import scalaprops.Gen
case class Id[A](value: A)
object Id {
implicit def gen[A](implicit genA: Gen[A]): Gen[Id[A]] =
genA.map(Id(_))
implicit val monad: Monad[Id] = new Monad[Id] {
def pure[A](a: A): Id[A] = Id(a)
def flatMap[A, B](fa: Id[A])(f: A => I... |
Explain and rewrite the following Scala code: | package org.analogweb.scala
import java.util.concurrent.ForkJoinPool
import scala.util.Try
import scala.concurrent.ExecutionContext
object Execution {
object Implicits {
implicit val defaultContext: ExecutionContext =
create
def create = {
def getInt(name: String, f: String => Int): Int =
... |
Explain and rewrite the following Scala code: | package com.eevolution.context.dictionary.infrastructure.service
import java.util.UUID
import akka.NotUsed
import com.eevolution.context.dictionary.domain._
import com.eevolution.context.dictionary.domain.model.ReplicationDocument
import com.eevolution.utils.PaginatedSequence
import com.lightbend.lagom.scaladsl.api.{... |
Explain and rewrite the following Scala code: | /*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; y... |
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 latis.ops
import latis.dm._
import latis.util.iterator.PeekIterator
import latis.time.Time
import scala.collection.mutable.ListBuffer
import latis.dm.implicits._
import latis.data.Data
import scala.math.Ordering.String._
import latis.metadata.Metadata
/**
* Puts the original Function into bins where each dom... |
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.karasiq.bootstrap.alert
import com.karasiq.bootstrap.BootstrapImplicits._
import com.karasiq.bootstrap.ModifierFactory
import scalatags.JsDom.all._
final class AlertStyle private[alert] (name: String) extends ModifierFactory {
val createModifier: Modifier = s"alert-$name".addClass
}
object AlertStyle ... |
Explain and rewrite the following Scala code: | package com.eneco.trading.kafka.connect.twitter
import java.util
import java.util.concurrent.{TimeUnit, LinkedBlockingQueue, Executors}
import com.eneco.trading.kafka.connect.twitter.domain.TwitterStatus
import com.twitter.hbc.httpclient.BasicClient
import com.twitter.hbc.twitter4j.Twitter4jStatusClient
import org.apa... |
Explain and rewrite the following Scala code: | package is.hail.expr.ir.agg
import is.hail.annotations.{Region, RegionPool, RegionValue}
import is.hail.asm4s._
import is.hail.backend.ExecuteContext
import is.hail.backend.spark.SparkTaskContext
import is.hail.expr.ir
import is.hail.expr.ir._
import is.hail.io.BufferSpec
import is.hail.types.physical._
import is.hail... |
Explain and rewrite the following Scala code: | /*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package org.scalajs.testing.bridge
import sbt... |
Explain and rewrite the following Scala code: | /**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... |
Explain and rewrite the following Scala code: | package spark
/**
* An object that defines how the elements in a key-value pair RDD are partitioned by key.
* Maps each key to a partition ID, from 0 to `numPartitions - 1`.
*/
abstract class Partitioner extends Serializable {
def numPartitions: Int
def getPartition(key: Any): Int
}
/**
* A [[spark.Partitione... |
Explain and rewrite the following Scala code: | println ("Fábrica.")
println ("Ingresar los datos que se piden por favor.")
println (" ")
println ("¿Cuántas piezas se va a comprar? ")
val pie = readInt ()
println ("¿Cuál es el costo de las piezas? ")
val cos = readFloat ()
val costotal = cos * pie
println (" ")
println ("El total a pagar es de: " +costotal)... |
Explain and rewrite the following Scala code: | package com.twitter.finagle.stats
import java.util.concurrent.ConcurrentHashMap
import scala.ref.WeakReference
/**
* CumulativeGauge provides a gauge that is composed of the (addition)
* of several underlying gauges. It follows the weak reference
* semantics of Gauges as outlined in StatsReceiver.
*/
private[fina... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2009 Sony Pictures Imageworks Inc.
*
* 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: | package controllers
import models.User
import play.Logger
import play.api.mvc._
import play.api.libs.concurrent.Execution.Implicits._
import utils.Utils.{getUserByToken, AUTH_TOKEN_HEADER}
import scala.concurrent.Future
case class AuthenticatedRequest[A](user: User, request: Request[A]) extends WrappedRequest[A](req... |
Explain and rewrite the following Scala code: | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Explain and rewrite the following Scala code: | /**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... |
Explain and rewrite the following Scala code: | /*
* Copyright (c) 2013-2014, ARM Limited
*
* 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, p... |
Explain and rewrite the following Scala code: | package skadi.container
import scala.reflect.Manifest
import skadi.beans.Bean
import skadi.beans.Scope
/**
* Provides methods for the retrieval, adding and removal of the beans from the
* container, as well as accessing information about the beans that are
* registered within the container.
*
* @author Nikola M... |
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 org.numenta.nupic.encoders.scala
import org.numenta.nupic.encoders.scala.Encoders._
import org.joda.time.format.ISODateTimeFormat
import org.numenta.nupic.Parameters.KEY
import org.numenta.nupic.{encoders => jencoders}
import org.numenta.nupic.scala.Parameters
object MultiEncoder {
def apply(encoders: jenco... |
Explain and rewrite the following Scala code: | /** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */
package avro.examples.baseball
final case class Wrestler(number: Int, first_name: String, last_name: String, nicknames: Seq[Mascot]) |
Explain and rewrite the following Scala code: | package org.littlewings.tweetbot.standard.lyrics
import com.typesafe.config.ConfigFactory
import scala.collection.JavaConverters._
object MediaFactory extends ConfigCharacterEscaper {
def create(artist: Artist, mediaNameAlias: String): Media = {
val config =
ConfigFactory
.load(s"job-data/${artis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.