code stringlengths 5 1M | repo_name stringlengths 5 109 | path stringlengths 6 208 | language stringclasses 1
value | license stringclasses 15
values | size int64 5 1M |
|---|---|---|---|---|---|
/*
* 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 ... | maropu/spark | sql/core/src/main/scala/org/apache/spark/sql/functions.scala | Scala | apache-2.0 | 187,382 |
package TAPLcomp2.tyarith
import scala.util.parsing.combinator.ImplicitConversions
import scala.util.parsing.combinator.syntactical.StandardTokenParsers
sealed trait Ty
case object TyBool extends Ty
case object TyNat extends Ty
sealed trait Term
case object TmTrue extends Term
case object TmFalse extends Term
c... | hy-zhang/parser | Scala/Parser/src/TAPLcomp2/tyarith/parser.scala | Scala | bsd-3-clause | 1,507 |
package com.twitter.finagle.zipkin.core
import com.twitter.conversions.DurationOps._
import com.twitter.finagle.tracing._
import com.twitter.util._
import java.net.{InetAddress, InetSocketAddress}
import org.scalatest.funsuite.AnyFunSuite
class RawZipkinTracerTest extends AnyFunSuite {
val traceId = TraceId(Some(S... | twitter/finagle | finagle-zipkin-core/src/test/scala/com/twitter/finagle/zipkin/core/RawZipkinTracerTest.scala | Scala | apache-2.0 | 2,531 |
package at.nonblocking.cliwix.core
import org.junit.Test
import at.nonblocking.cliwix.core.command.{CommandResult, CompanyListCommand}
import at.nonblocking.cliwix.core.handler.Handler
import at.nonblocking.cliwix.model.Company
import java.{util=>jutil}
class ExceptionTranslationTest {
@Test(expected = classOf[Cli... | nonblocking/cliwix | cliwix-core/src/test/scala/at/nonblocking/cliwix/core/ExceptionTranslationTest.scala | Scala | agpl-3.0 | 697 |
package org.bitcoins.node.networking.peer
import akka.actor.ActorRef
import akka.util.Timeout
import org.bitcoins.core.api.chain.{ChainApi, FilterSyncMarker}
import org.bitcoins.core.bloom.BloomFilter
import org.bitcoins.core.number.Int32
import org.bitcoins.core.p2p._
import org.bitcoins.core.protocol.transaction.Tra... | bitcoin-s/bitcoin-s | node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageSender.scala | Scala | mit | 9,028 |
package snakesladders.domain.models
import snakesladders.domain.models.GameDefinitions.GameDefinition
import snakesladders.domain.models.Players.Player
case class Game(
gameDefinition: GameDefinition,
players: Seq[Player]
)
| sibex/snakes-and-ladders | src/main/scala/snakesladders/domain/models/Game.scala | Scala | mit | 230 |
package org.littlewings.javaee7.typed
import javax.enterprise.context.ApplicationScoped
import javax.enterprise.inject.Typed
class Book
trait Shop[T]
class Business
@Typed(Array(classOf[Shop[Book]]))
@ApplicationScoped
class BookShop extends Business with Shop[Book]
| kazuhira-r/javaee7-scala-examples | cdi-typed/src/main/scala/org/littlewings/javaee7/typed/BookShop.scala | Scala | mit | 272 |
package com.twitter.finagle.naming
import com.twitter.finagle._
import com.twitter.util.Activity
/**
* Interpret names against a Dtab. Differs from
* [[com.twitter.finagle.Namer Namers]] in that the passed in
* [[com.twitter.finagle.Dtab Dtab]] can affect the resolution process.
*/
trait NameInterpreter {
/**
... | adriancole/finagle | finagle-core/src/main/scala/com/twitter/finagle/naming/NameInterpreter.scala | Scala | apache-2.0 | 948 |
/*
* 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 ... | indhub/mxnet | scala-package/infer/src/main/scala/org/apache/mxnet/infer/package.scala | Scala | apache-2.0 | 925 |
import org.scalatest.FunSuite
@identity case class InteropIdentity(x: Int)
@placebo case class InteropPlacebo(x: Int)
class InteropCaseSynthesis extends FunSuite {
test("case module synthesis for identity") {
assert(InteropIdentity.toString === "InteropIdentity")
}
test("case module synthesis for placebo")... | scalamacros/paradise | tests/src/test/scala/annotations/run/InteropCaseSynthesis.scala | Scala | bsd-3-clause | 385 |
package colossus.streaming
/**
* A `Signal` is a callback mechanism used by both [[Source]] and [[Sink]] to manage forward/back-pressure. In both cases it is returned when a requested operation cannot immediately complete, but can at a later point in time. For example, when pulling from a [[Source]], if no item is... | tumblr/colossus | colossus/src/main/scala/colossus/streaming/Signal.scala | Scala | apache-2.0 | 2,059 |
package sttp.client3
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import java.io.IOException
import java.net.URI
class SttpBackendOptionsProxyTest2 extends AnyFlatSpec with Matchers {
it should "throw UnsupportedOperationException with reason" in {
val proxySetting = ... | softwaremill/sttp | core/src/test/scalajvm/sttp/client3/SttpBackendOptionsProxyTest2.scala | Scala | apache-2.0 | 872 |
/*
* Copyright 2001-2008 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... | epishkin/scalatest-google-code | src/main/scala/org/scalatest/FeatureSpec.scala | Scala | apache-2.0 | 74,610 |
package wandou.collection
import scala.collection.generic.CanBuildFrom
import scala.collection.generic.MutableMapFactory
import scala.collection.mutable.Map
import scala.collection.mutable.MapLike
@SerialVersionUID(1L)
final class WeakKeyHashMap[A, B] extends Map[A, B]
with MapLike[A, B, WeakKeyHashMap[A, B]]
... | wandoulabs/wandou-math | wandou-util/src/main/scala/wandou/collection/WeakKeyHashMap.scala | Scala | apache-2.0 | 2,737 |
package com.blinkbox.books.spray
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
import scala.concurrent.duration._
import scala.util.Try
import spray.http.DateTime
import spray.http.StatusCodes._
import spray.routing.{ HttpService, Route }
import spray.testkit.Scal... | blinkboxbooks/common-spray.scala | src/test/scala/com/blinkbox/books/spray/CachableDirectiveTest.scala | Scala | mit | 2,952 |
package com.jdrews.logstation.tailer
import java.io._
import akka.actor.{Actor, ActorLogging, ActorRef}
import com.google.common.xml.XmlEscapers
import com.jdrews.logstation.config.BridgeController
import com.jdrews.logstation.service.ServiceShutdown
import com.jdrews.logstation.webserver.LogMessage
import com.osinka... | jdrews/logstation | src/main/scala/com/jdrews/logstation/tailer/LogTailerActor.scala | Scala | apache-2.0 | 3,968 |
package scalariform
object Utils {
def writeText(file: java.io.File, text: String, encodingOpt: Option[String] = None): Unit = {
import java.io.{ OutputStreamWriter, FileOutputStream }
val encoding = encodingOpt getOrElse (System getProperty "file.encoding")
val writer = new OutputStreamWriter(new FileOu... | mdr/scalariform | cli/src/main/scala/scalariform/Utils.scala | Scala | mit | 421 |
package es.ucm.fdi.sscheck.testing
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner
import org.specs2.ScalaCheck
import org.specs2.scalacheck.{Parameters, ScalaCheckProperty}
import org.specs2.specification.BeforeAfterEach
import org.scalacheck.{Prop, Gen}
import org.scalacheck.Arbitrary.arbitrary... | MiguelPeralvo/sscheck | src/test/scala/es/ucm/fdi/sscheck/testing/SequentialScalacheckOriginal.scala | Scala | apache-2.0 | 2,608 |
package pl.edu.agh.mplt.parser.AMPL.declarations
import org.scalatest.{Matchers, FlatSpec}
import pl.edu.agh.mplt.parser.phrase.set._
import pl.edu.agh.mplt.parser.phrase.expression.{Bin, Number}
import pl.edu.agh.mplt.parser.{AMPLParser, IntercodeImplicits}
import pl.edu.agh.mplt.parser.member.SetMember
import... | marek1840/MPLT | src/test/scala/pl/edu/agh/mplt/parser/AMPL/declarations/SetDeclarationTest.scala | Scala | mit | 4,713 |
import lib.Timing.measureTask
import lib._
import model._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
import scala.concurrent.duration.Duration
import scala.sys.process._
import scalax.file.PathMatcher.IsDirectory
import scalax.io.Codec
/*
* Vary BFG runs by:
* Java version
... | digitalquest/bfg-repo-cleaner | bfg-benchmark/src/main/scala/Benchmark.scala | Scala | gpl-3.0 | 3,424 |
/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */
package com.test.ARecord
import com.test.MoneyDecimal
final case class ARecord(GroupId: String = "", MediaCostCPMInUSD: Option[MoneyDecimal.Value], SupplyVendor: Option[String]) | makubi/avrohugger-maven-plugin | src/test/resources/unit/avrohugger-maven-plugin/expected/ARecord.scala | Scala | apache-2.0 | 243 |
package code.rest
import net.liftweb.http.{Req,OutputStreamResponse}
import net.liftweb.http.rest._
object Numbers extends RestHelper {
// Generate numbers, converted to Array[Byte]
def infinite = Stream.from(1).map(num2bytes)
def num2bytes(x: Int) = (x + "\\n") getBytes("utf-8")
serve {
case Req("nu... | gruenewa/lift-testbox | src/main/scala/code/rest/Numbers.scala | Scala | apache-2.0 | 422 |
package michid.script.shell
import michid.script.oak.fixtures.oakFixtures
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class RunScriptIT extends FunSuite with ScriptRunner {
oakFixtures.values.foreach(oakFixture => {
test(s"... | mduerig/script-oak | script-oak-shell/src/test/scala/michid/script/shell/RunScriptIT.scala | Scala | apache-2.0 | 770 |
/*
* 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 ... | cin/spark | core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala | Scala | apache-2.0 | 36,821 |
/*
* 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 ... | spark0001/spark2.1.1 | core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala | Scala | apache-2.0 | 4,766 |
/**
*
* IncomingTransactionDialogFragment
* Ledger wallet
*
* Created by Pierre Pollastri on 22/01/15.
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Ledger
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software... | Morveus/ledger-wallet-android | app/src/main/scala/com/ledger/ledgerwallet/app/m2fa/IncomingTransactionDialogFragment.scala | Scala | mit | 4,211 |
/*
* 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 ... | bravo-zhang/spark | mllib/src/test/scala/org/apache/spark/ml/feature/OneHotEncoderEstimatorSuite.scala | Scala | apache-2.0 | 15,927 |
/*
* Copyright (c) 2014-2015 by its authors. Some rights reserved.
* See the project homepage at: http://www.monifu.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://... | sergius/monifu | monifu/shared/src/test/scala/monifu/reactive/internals/operators/MinBySuite.scala | Scala | apache-2.0 | 2,394 |
/*
* WebBrowser.scala
* (Mellite)
*
* Copyright (c) 2012-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.mellite
import... | Sciss/Mellite | app/src/main/scala/de/sciss/mellite/WebBrowser.scala | Scala | agpl-3.0 | 1,829 |
package org.hmrc.pricing.models
object Checkout {
type Discount = BigDecimal
def total(basket: Basket, discounts: (Basket => Discount)*): BigDecimal = {
val discount = discounts.distinct.foldLeft(BigDecimal(0)) {
(discountAcc, discount) => discountAcc + discount(basket)
}
basket.total - disco... | alexflav23/hm | src/main/scala/org/hmrc/pricing/models/Checkout.scala | Scala | apache-2.0 | 936 |
package ch.wsl.box.client.views
/**
* Created by andre on 4/3/2017.
*/
import ch.wsl.box.client.routes.Routes
import ch.wsl.box.client.services.{ClientConf, Labels, Navigate}
import ch.wsl.box.client.styles.{BootstrapCol, GlobalStyles}
import io.udash._
import io.udash.bootstrap.BootstrapStyles
import io.udash.b... | Insubric/box | client/src/main/scala/ch/wsl/box/client/views/DataListView.scala | Scala | apache-2.0 | 3,445 |
package spark.partial
import java.util.{HashMap => JHashMap}
import java.util.{Map => JMap}
import scala.collection.mutable.HashMap
import scala.collection.Map
import scala.collection.JavaConversions.mapAsScalaMap
import spark.util.StatCounter
/**
* An ApproximateEvaluator for means by key. Returns a map of key to... | koeninger/spark | core/src/main/scala/spark/partial/GroupedMeanEvaluator.scala | Scala | bsd-3-clause | 2,146 |
package net.lshift.diffa.agent.client
/**
* Copyright (C) 2010-2011 LShift Ltd.
*
* 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
... | 0x6e6562/diffa | agent/src/test/scala/net/lshift/diffa/agent/client/ConfigurationRestClient.scala | Scala | apache-2.0 | 2,664 |
package org.dama.datasynth.common.generators.property.empirical
import java.io.{BufferedReader, InputStreamReader}
import org.dama.datasynth.common.generators.property.PropertyGenerator
import org.dama.datasynth.common.utils.FileUtils.File
import org.dama.datasynth.runtime.spark.utils.RndGenerator
import scala.io.So... | DAMA-UPC/DataSynth | src/main/scala/org/dama/datasynth/common/generators/property/empirical/DistributionBasedGenerator.scala | Scala | gpl-3.0 | 2,799 |
package io.pipeline.prediction.jvm
import java.io.BufferedInputStream
import java.io.BufferedOutputStream
import java.io.FileOutputStream
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
object ZipFileUtil {
def unzip(filename: String, outputPath: String): Unit = {
val BUFFER = 2048;
try {
... | shareactorIO/pipeline | prediction.ml/jvm/src/main/scala/io/pipeline/prediction/jvm/ZipFileUtil.scala | Scala | apache-2.0 | 1,385 |
package com.cobble.swaggg.tileentity
import net.minecraft.server.gui.IUpdatePlayerListBox
import net.minecraft.tileentity.TileEntity
class TileEntitySwagExtractor extends TileEntity with IUpdatePlayerListBox {
override def update(): Unit = {
// println("Test")
}
def onClick(): Unit = {
pr... | Cobbleopolis/Swaggg | src/main/java/com/cobble/swaggg/tileentity/TileEntitySwagExtractor.scala | Scala | lgpl-2.1 | 355 |
/*
* Copyright 2018 Analytics Zoo Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... | intel-analytics/analytics-zoo | zoo/src/main/scala/com/intel/analytics/zoo/pipeline/api/keras/layers/Select.scala | Scala | apache-2.0 | 4,017 |
/*
* 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 ... | akopich/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala | Scala | apache-2.0 | 112,466 |
package tastytest
object TestJColour extends Suite("TestJColour") {
test(assert(JColour.Red == JColour.Red))
test(assert(JColour.Green != JColour.Blue))
test(assert(JColour.Blue.compareTo(JColour.Red) > 0))
}
| lrytz/scala | test/tasty/run/src-2/tastytest/TestJColour.scala | Scala | apache-2.0 | 218 |
/*
* 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... | wzhongyuan/BigDL | spark/dl/src/test/scala/com/intel/analytics/bigdl/nn/tf/LRNGradSpec.scala | Scala | apache-2.0 | 1,235 |
package namedTypeArgsR {
object t1 {
def construct[Elem, Coll[_]](xs: Elem*): Coll[Elem] = ???
val xs3 = construct[Coll = List](1, 2, 3)
val xs2 = construct[Coll = List, Elem = Int](1, 2, 3)
}
}
| som-snytt/dotty | tests/pos/reference/named-typeargs.scala | Scala | apache-2.0 | 207 |
package com.sksamuel.avro4s
import java.io.ByteArrayOutputStream
import java.util.UUID
import org.scalatest.concurrent.TimeLimits
import org.scalatest.{Matchers, WordSpec}
import shapeless.{:+:, Coproduct, CNil}
class AvroInputStreamTest extends WordSpec with Matchers with TimeLimits {
case class Booleans(bool: B... | YuvalItzchakov/avro4s | avro4s-core/src/test/scala/com/sksamuel/avro4s/AvroInputStreamTest.scala | Scala | mit | 15,988 |
package xitrum.scope.request
import io.netty.handler.codec.http.multipart.FileUpload
import xitrum.Action
import xitrum.exception.MissingParam
import xitrum.util.DefaultsTo
/**
* Use "manifest" for Scala 2.10 and "typeOf" for Scala 2.11:
* https://github.com/ngocdaothanh/xitrum/issues/155
*
* Cache manifests bec... | georgeOsdDev/xitrum | src/main/scala-2.10/xitrum/scope/request/ParamAccess.scala | Scala | mit | 3,546 |
package com.avast.syringe.config.perspective
import com.avast.syringe.config.internal.{InjectableProperty, ConfigClassAnalyzer}
import org.scalatest.{FlatSpec, BeforeAndAfter}
import com.google.common.collect.Lists
import java.util.ArrayList
import com.avast.syringe.config.PropertyValueConverter
import java.lang.refle... | avast/syringe | src/test/scala/com/avast/syringe/config/perspective/InjectionSuite.scala | Scala | bsd-3-clause | 8,115 |
/*
* 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 java.nio
private[nio] final class Hea... | scala-js/scala-js | javalib/src/main/scala/java/nio/HeapCharBuffer.scala | Scala | apache-2.0 | 3,384 |
/*
* Copyright 2012 Tumblr 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... | pteichman/zipkin | zipkin-redis/src/main/scala/com/twitter/zipkin/storage/redis/RedisStorage.scala | Scala | apache-2.0 | 2,572 |
package net.scalax.cpoi
import net.scalax.cpoi.utils.Alias
package object api extends Alias
| scalax/poi-collection | src/main/scala/net/scalax/cpoi/api/package.scala | Scala | mit | 94 |
val name: type = value | MartinThoma/LaTeX-examples | documents/Programmierparadigmen/scripts/scala/val-syntax.scala | Scala | mit | 22 |
/*
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
distr... | AaroC357/scalding | scalding-hadoop-test/src/main/scala/com/twitter/scalding/platform/HadoopSharedPlatformTest.scala | Scala | apache-2.0 | 1,747 |
package org.scalameter
import collection._
trait Gen[T] extends Serializable {
self =>
def map[S](f: T => S): Gen[S] = new Gen[S] {
def warmupset = for (x <- self.warmupset) yield f(x)
def dataset = for (params <- self.dataset) yield params
def generate(params: Parameters) = f(self.generate(param... | lossyrob/scalpel | src/main/scala/org/scalameter/Gen.scala | Scala | bsd-3-clause | 4,185 |
package org.webant.extension.link
import java.sql.SQLException
import org.apache.commons.dbutils.handlers.BeanListHandler
import org.apache.log4j.LogManager
import org.webant.commons.entity.Link
import org.webant.commons.link.JdbcLinkProvider
import scala.collection.JavaConverters._
class HsqldbLinkProvider extends... | sutine/webant | webant-extension/src/main/scala/org/webant/extension/link/HsqldbLinkProvider.scala | Scala | apache-2.0 | 6,040 |
package es.uvigo.ei.sing.biomsef
package controller
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.libs.functional.syntax._
import play.api.libs.json._
import play.api.mvc._
import entity._
import searcher._
object SearcherController extends Controller {
lazy val searcher = new... | agjacome/biomsef | src/main/scala/controller/SearcherController.scala | Scala | mit | 1,100 |
/*
* 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 ... | taroplus/spark | sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/orc/OrcSourceSuite.scala | Scala | apache-2.0 | 29,543 |
package se.nimsa.sbx.app.routing
import java.util.UUID
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.server._
import org.scalatest.{FlatSpecLike, Matchers}
import se.nimsa.sbx.anonymization.{AnonymizationProfile, ConfidentialityOption}
import se.nimsa.sbx.anonymization.AnonymizationProtocol.... | slicebox/slicebox | src/test/scala/se/nimsa/sbx/app/routing/BoxRoutesTest.scala | Scala | apache-2.0 | 13,765 |
/*
* Copyright 2012 Pellucid and Zenexity
*
* 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... | Enalmada/datomisca | integration/src/it/scala/datomisca/MovieGraph2SampleSpec.scala | Scala | apache-2.0 | 7,345 |
object Moo {
implicit class IdOps[V](self: V) {
def left[A]: Either[V, A] = Left(self)
def right[E]: Either[E, V] = Right(self)
}
implicit class EitherOps[E, A](self: Either[E, A]) {
def flatMap[EE >: E, B](f: A => Either[EE, B]): Either[EE, B] = self match {
case Left(e) => Left(e)
case... | ilinum/intellij-scala | testdata/typeInference/bugs5/SCL8232.scala | Scala | apache-2.0 | 971 |
/***
* Copyright 2014 Rackspace US, 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 applica... | tylerroyal/api-checker | core/src/main/scala/com/rackspace/com/papi/components/checker/ValidatorException.scala | Scala | apache-2.0 | 766 |
package com.twitter.finagle.memcached.unit.util
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
import com.twitter.finagle.memcached.util.Bufs.RichBuf
import com.twitter.io.Buf
@RunWith(classOf[JUnitRunner])
class BufsTest extends FunSuite {
test("RichBuf.toInt... | suls/finagle | finagle-memcached/src/test/scala/com/twitter/finagle/memcached/unit/util/BufsTest.scala | Scala | apache-2.0 | 1,902 |
/**
* 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... | wangcy6/storm_app | frame/kafka-0.11.0/kafka-0.11.0.1-src/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala | Scala | apache-2.0 | 46,802 |
// These are meant to be typed into the REPL. You can also run
// scala -Xnojline < repl-session.scala to run them all at once.
val coll = Range(1, 10)
coll.head
coll.last
coll.headOption
List().headOption
coll.lastOption
coll.length
coll.isEmpty
coll.sum
coll.product
coll.max
coll.min
coll.count(_ % 2 == 0)
coll.f... | yeahnoob/scala-impatient-2e-code | src/ch13/sec07/repl-session.scala | Scala | gpl-3.0 | 1,171 |
// more complicated example
abstract class A {
type C[X]
def foo[B](x: C[B]): C[B] = {println("A.C"); x}
def foo[B](x: List[B]): List[B] = {println("A.List"); x}
def give[X]: C[X]
}
class B extends A {
type C[X] = List[X]
override def give[X] = Nil
override def foo[B](x: C[B]): C[B] = {println("B... | som-snytt/dotty | tests/pending/neg/i1240a.scala | Scala | apache-2.0 | 526 |
/*
* 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... | mlperf/training_results_v0.5 | v0.5.0/intel/intel_ncf_submission/code/ncf/src/test/scala/com/intel/analytics/zoo/models/recommendation/EmbeddingAdamSpec.scala | Scala | apache-2.0 | 10,501 |
/*
* 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 ... | WangTaoTheTonic/flink | flink-libraries/flink-table/src/main/scala/org/apache/flink/table/sources/StreamTableSource.scala | Scala | apache-2.0 | 1,471 |
package gitbucket.core.view
import gitbucket.core.controller.Context
import gitbucket.core.service.{RepositoryService, RequestCache}
import gitbucket.core.util.Implicits.RichString
trait LinkConverter { self: RequestCache =>
/**
* Creates a link to the issue or the pull request from the issue id.
*/
protec... | noc06140728/gitbucket | src/main/scala/gitbucket/core/view/LinkConverter.scala | Scala | apache-2.0 | 4,716 |
// Databricks notebook source exported at Sun, 8 May 2016 16:00:03 UTC
import org.apache.log4j.Logger
import org.apache.log4j.Level
import org.apache.spark.graphx._
import org.apache.spark.rdd._
import scala.io.Source
Logger.getLogger("org").setLevel(Level.ERROR)
Logger.getLogger("akka").setLevel(Level.ERROR)
// CO... | flopezlasanta/spark-notebooks | coursera/graph_analytics/GraphX.scala | Scala | mit | 9,146 |
object Test extends App {
println(Macros.foo_with_macros_enabled)
println(Macros.foo_with_macros_disabled)
}
| scala/scala | test/files/run/macro-typecheck-macrosdisabled2/Test_2.scala | Scala | apache-2.0 | 113 |
package edu.uchicago.cs.ndnn
import org.junit.Assert._
import org.junit.Test
import org.nd4j.linalg.factory.Nd4j
class IndexerTest {
@Test
def testGet: Unit = {
val a = Nd4j.create(Array(Array(3d, 4d, 5d), Array(1d, 6d, 7d)))
val b = Nd4j.create(Array(2d, 1d)).reshape(2, 1)
val fetched = Index.get(... | harperjiang/enc-selector | src/test/scala/edu/uchicago/cs/ndnn/IndexTest.scala | Scala | apache-2.0 | 817 |
package spire
package macros
import language.experimental.macros
import spire.algebra._
import spire.macros.compat.{Context, termName}
object Auto {
object scala {
def semiring[A]: Semiring[A] = macro ScalaAutoMacros.semiringImpl[A]
def rig[A](z: A, o: A): Rig[A] = macro ScalaAutoMacros.rigImpl[A]
def ... | non/spire | core/src/main/scala/spire/macros/Auto.scala | Scala | mit | 13,830 |
/* Copyright 2012 Christian Douven
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... | chridou/almhirt | almhirt-common/src/main/scala/almhirt/syntax/almfuture.scala | Scala | apache-2.0 | 671 |
/*
* 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 ... | vinodkc/spark | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala | Scala | apache-2.0 | 34,491 |
/*
* Copyright 2015 the original author or 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 applicab... | arkadius/reliable-http-client | rhttpc-client/src/test/scala/rhttpc/client/MockTransport.scala | Scala | apache-2.0 | 4,111 |
package io.github.hamsters
import org.scalatest.{FlatSpec, Matchers}
class SealedSpec extends FlatSpec with Matchers {
"Sealed.values on a valid sealed trait" should "return a set of sealed trait childs" in {
sealed trait Colors
case object Red extends Colors
case object Orange extends Colors
case ... | dgouyette/hamsters | shared/src/test/scala/io/github/hamsters/SealedSpec.scala | Scala | apache-2.0 | 723 |
/**
* Copyright 2015 Otto (GmbH & Co KG)
*
* 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... | utzwestermann/schedoscope | schedoscope-core/src/main/scala/org/schedoscope/scheduler/driver/Driver.scala | Scala | apache-2.0 | 10,887 |
/*
* 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 ... | Dax1n/spark-core | core/src/main/scala/org/apache/spark/api/java/JavaRDD.scala | Scala | apache-2.0 | 6,757 |
package ch.epfl.scala.index.data.github
import org.json4s.{DefaultFormats, native}
object Json4s {
implicit val formats = DefaultFormats
implicit val serialization = native.Serialization
}
| adamwy/scaladex | data/src/main/scala/ch.epfl.scala.index.data/github/Json4s.scala | Scala | bsd-3-clause | 195 |
/*******************************************************************************
* Copyright 2010 Maxime Lévesque
*
* 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://ww... | squeryl/squeryl | src/main/scala/org/squeryl/adapters/SQLiteAdapter.scala | Scala | apache-2.0 | 3,998 |
/*
* Copyright 2015 Webtrends (http://www.webtrends.com)
*
* 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.
* Yo... | Webtrends/wookiee-netty | src/main/scala/com/webtrends/harness/component/netty/CoreNettyWorker.scala | Scala | apache-2.0 | 2,939 |
package org.jetbrains.plugins.scala.lang.psi
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.{PsiClass, PsiElement}
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScTrait}
import org.jetbrains.plugins.scala.lang.psi.impl.... | ilinum/intellij-scala | src/org/jetbrains/plugins/scala/lang/psi/ElementScope.scala | Scala | apache-2.0 | 2,033 |
package jp.co.cyberagent.aeromock
import java.nio.file.Path
import jp.co.cyberagent.aeromock.core.bootstrap.BootstrapManager
import jp.co.cyberagent.aeromock.server.AeromockServer
import org.slf4j.LoggerFactory
import scaldi.Injectable
/**
* launcher of Aeromock
* @author stormcat24
*/
object Aeromock extends App... | CyberAgent/aeromock | aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/Aeromock.scala | Scala | mit | 955 |
package org.workcraft.plugins.fsm
import org.workcraft.scala.Expressions._
import org.workcraft.scala.effects.IO._
import org.workcraft.scala.effects.IO
import scalaz.Scalaz._
import org.workcraft.dependencymanager.advanced.user.Variable
import java.awt.geom.Point2D
import org.workcraft.dom.visual.connections.... | mechkg/workcraft | FSMPlugin/src/main/scala/org/workcraft/plugins/fsm/EditableFSM.scala | Scala | gpl-3.0 | 4,968 |
package org.jetbrains.plugins.scala
package debugger
package evaluation
import com.intellij.debugger.SourcePosition
import com.intellij.debugger.engine.evaluation.CodeFragmentFactoryContextWrapper
import com.intellij.debugger.engine.evaluation.expression._
import com.intellij.debugger.engine.{JVMName, JVMNameUtil}
imp... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/debugger/evaluation/ScalaEvaluatorBuilderUtil.scala | Scala | apache-2.0 | 81,707 |
package actors
import actors.DisplayOrderActor.{DisplayOrderCommand, OrderDisplayedEvent}
import akka.actor.{Actor, Props}
import domain.DataWithPaymentMethod
class DisplayOrderActor extends Actor {
override def receive = {
case DisplayOrderCommand(order) =>
println("Order: " + order + " processed")
... | kkrzys/eShop | eShop-core/src/main/scala/actors/DisplayOrderActor.scala | Scala | apache-2.0 | 673 |
/*
* 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 ... | jinglining/flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/Conversions.scala | Scala | apache-2.0 | 5,657 |
/*
* Copyright 2015 Otto (GmbH & Co KG)
*
* 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... | ottogroup/flink-spector | flinkspector-core/src/test/scala/io/flinkspector/core/collection/MatcherBuilderSpec.scala | Scala | apache-2.0 | 5,497 |
package org.awong.graphs
class EdgeWeightedGraph[V] {
var nEdges: Int = 0
val isDirected = false
var adjacencyList = Map[V, Seq[WeightedEdge[V]]]()
def nVertices: Int = vertices.size
def vertices: Iterable[V] = adjacencyList.keySet
def adj(v: V): Iterable[WeightedEdge[V]] = {
adjacencyList.get(v) m... | alanktwong/algorithms-scala | graphs/src/main/scala/org/awong/graphs/EdgeWeightedGraph.scala | Scala | mit | 1,801 |
package forex
import scalaz._
import Scalaz._
import scalaz.Validation.FlatMap._
import forex.{OrderTotal => OT}
import forex.{ExchangeRateLookup => ERL}
object OrderTotalConverter2 {
def convert(rawCurrency: String, rawAmount: String):
ValidationNel[String, OrderTotal] = {
OT.parse(rawCurrency, rawAmoun... | alexanderdean/Unified-Log-Processing | ch07/7.4/forex/src/main/scala/forex/OrderTotalConverter2.scala | Scala | apache-2.0 | 512 |
package composition
import com.tzavellas.sse.guice.ScalaModule
import email.{EmailData, EmailFlags, RetainEmailService}
import models.{BusinessDetailsModel, ConfirmFormModel, EligibilityModel}
import org.scalatest.mock.MockitoSugar
import org.mockito.Matchers.any
import org.mockito.Mockito.when
import uk.gov.dvla.vehi... | dvla/vrm-retention-online | test/composition/TestEmailService.scala | Scala | mit | 922 |
case class Link(url: String, occurences: String)
object Link {
def apply(arr: Array[String]): Link = {
Link(arr(0), arr(1))
}
} | softberries/ugproject | HTMLgenerator/src/main/scala/Link.scala | Scala | unlicense | 136 |
package com.sksamuel.elastic4s.requests.searches.aggs.responses.bucket
import com.sksamuel.elastic4s.requests.searches.aggs.responses.{AggBucket, AggSerde, BucketAggregation}
case class KeyedDateRangeAggResult(name: String, buckets: Map[String, DateRangeBucket]) extends BucketAggregation
object KeyedDateRangeAggResu... | sksamuel/elastic4s | elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs/responses/bucket/daterange.scala | Scala | apache-2.0 | 1,862 |
package epic.parser.kbest
import epic.trees._
import breeze.config.{Configuration, CommandLineParser, Help}
import java.io.{PrintWriter, File}
import breeze.util._
import epic.parser.Parser
import scala.collection.parallel.ForkJoinTaskSupport
import scala.concurrent.forkjoin.ForkJoinPool
import epic.trees.ProcessedTre... | maxim-rabinovich/epic | src/main/scala/epic/parser/kbest/KBestParseTreebank.scala | Scala | apache-2.0 | 2,629 |
package net.cucumbersome.rpgRoller.warhammer.combat
import java.util.UUID
import akka.actor.ActorRef
import akka.http.scaladsl.model.ContentTypes
import akka.http.scaladsl.server.Route
import net.cucumbersome.RouteSpec
import net.cucumbersome.rpgRoller.warhammer.combat.CombatController.{CombatIdGenerator, DefaultIdGe... | CucumisSativus/rpgRollerBackend | src/test/scala/net/cucumbersome/rpgRoller/warhammer/combat/CombatControllerSpec.scala | Scala | mit | 5,894 |
/*
* Copyright 2019 Spotify AB.
*
* 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 ... | spotify/scio | scio-test/src/main/scala/com/spotify/scio/testing/SCollectionMatchers.scala | Scala | apache-2.0 | 18,987 |
// code-examples/BasicOOP/scoping/private-type-nested-wont-compile.scala
// WON'T COMPILE
package scopeA {
class PrivateClass1 {
class Nested {
private[PrivateClass1] val nestedField = 1
}
private[PrivateClass1] val nested = new Nested
val nestedNested = nested.nestedField
}
class Private... | XClouded/t4f-core | scala/src/tmp/BasicOOP/scoping/private-type-nested-wont-compile.scala | Scala | apache-2.0 | 547 |
package libs
import scala.collection.mutable.Map
import scala.collection.mutable.MutableList
object CaffeWeightCollection {
def scalarDivide(weights: Map[String, MutableList[NDArray]], v: Float) = {
for (name <- weights.keys) {
for (j <- 0 to weights(name).length - 1) {
weights(name)(j).scalarDivi... | amplab/SparkNet | src/main/scala/libs/CaffeWeightCollection.scala | Scala | mit | 2,158 |
package adapter.xpay
trait PayD {
def getCustCardNo: String
def setCustCardNo(custCardNo: String)
def getCardOwnerName: String
def setCardOwnerName(cardOwnerName: String)
def getCardExpMonthDate: String
def setCardExpMonthDate(cardExpMonthDate: String)
def getCVVNo: Integer
def setCVVNo(cVVNo: I... | BBK-PiJ-2015-67/sdp-portfolio | exercises/week07/src/main/scala/adapter/xpay/PayD.scala | Scala | unlicense | 403 |
package scommons.client.ui.list
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
@JSImport("scommons/client/ui/list/ListBox.css", JSImport.Namespace)
@js.native
object ListBoxCss extends js.Object {
val listBoxItem: String = js.native
val listBoxSelectedItem: String = js.native
}
| viktor-podzigun/scommons | ui/src/main/scala/scommons/client/ui/list/ListBoxCss.scala | Scala | apache-2.0 | 310 |
package fr.marouni.spark.sql
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{DataFrame, SQLContext}
import org.apache.spark.{SparkContext, SparkConf}
/**
* Created by abbass on 12/03/16.
*
* SQL support in Spark SQL.
*/
object SqlSupport extends App {
case class order(company: String, client: ... | marouni/spark-tests | src/main/scala/fr/marouni/spark/sql/SqlSupport.scala | Scala | apache-2.0 | 7,407 |
package formats
import models._
import play.api.Play
import play.api.Play.current
import play.api.libs.json.Reads._
import play.api.libs.json._
import play.api.libs.functional.syntax._
trait APIJsonFormats extends CommonJsonFormats {
implicit def traversableWrites[A: Writes] = new Writes[Traversable[A]] {
def w... | jdauphant/play_api_example | app/formats/APIJsonFormats.scala | Scala | isc | 2,229 |
package cz.senkadam.gatlingsql.requests
import io.gatling.core.config.Protocol
/**
* Created by senk on 7.1.15.
*/
/**
* SLQ protocol
*/
case class SqlProtocol() extends Protocol
| veraicon/gatlingsql | src/main/scala/cz/senkadam/gatlingsql/requests/SqlProtocol.scala | Scala | apache-2.0 | 185 |
package inox
package parsing
import org.scalatest.funsuite.AnyFunSuite
class ArithmeticParserSuite extends AnyFunSuite {
import inox.trees._
import interpolator._
implicit val symbols = NoSymbols
test("Parsing additions.") {
assertResult(Plus(IntegerLiteral(3), IntegerLiteral(4))) {
e"3 + 4"
... | epfl-lara/inox | src/test/scala/inox/parsing/ArithmeticParserSuite.scala | Scala | apache-2.0 | 2,528 |
Subsets and Splits
Filtered Scala Code Snippets
The query filters and retrieves a sample of code snippets that meet specific criteria, providing a basic overview of the dataset's content without revealing deeper insights.