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 ... | bravo-zhang/spark | core/src/test/scala/org/apache/spark/PartitioningSuite.scala | Scala | apache-2.0 | 13,796 |
/*
* Copyright (C) 2005, The Beangle Software.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This... | beangle/data | model/src/main/scala/org/beangle/data/model/pojo/Named.scala | Scala | lgpl-3.0 | 798 |
package org.clulab.agiga
import java.io._
import com.typesafe.config.ConfigFactory
import com.typesafe.scalalogging.LazyLogging
import scala.collection.parallel.ForkJoinTaskSupport
object AgigaReader extends App with LazyLogging {
val config = ConfigFactory.load()
val inDir = new File(config.getString("inputDir... | myedibleenso/processors-agiga | src/main/scala/org/clulab/agiga/AgigaReader.scala | Scala | apache-2.0 | 3,083 |
/**
* 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... | YMartsynkevych/camel | components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SMulticastDefinition.scala | Scala | apache-2.0 | 2,149 |
/*
* Copyright 2009-2010 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... | wsaccaco/lift | framework/lift-modules/lift-jta/src/main/scala/net/liftweb/transaction/TransactionContext.scala | Scala | apache-2.0 | 8,037 |
package com.cerner.beadledom.lifecycle.legacy
import com.google.inject.{AbstractModule, Guice}
import javax.annotation.PostConstruct
import org.scalatest.mockito.MockitoSugar
import org.scalatest.{FunSpec, MustMatchers}
/**
* Unit tests for [[BeadledomLifecycleModule]].
*
* @author John Leacox
*/
class Beadle... | bbaugher/beadledom | lifecycle/src/test/scala/com/cerner/beadledom/lifecycle/legacy/BeadledomLifecycleModuleSpec.scala | Scala | apache-2.0 | 1,666 |
package jsentric
import org.scalatest.{FunSuite, Matchers}
import argonaut._
import Argonaut._
import scalaz._
class ValidatorTests extends FunSuite with Matchers {
import Jsentric._
private def toSet(dis: \\/[NonEmptyList[(String, Path)], Json]): \\/[Set[(String, Path)], Json] =
dis.leftMap(_.list.toList.t... | HigherState/jsentric | src/test/scala/jsentric/ValidatorTests.scala | Scala | apache-2.0 | 6,159 |
/*
* 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... | pncampbell/ct-calculations | src/test/scala/uk/gov/hmrc/ct/computations/CP503Spec.scala | Scala | apache-2.0 | 3,016 |
package org.openurp.edu.eams.teach.lesson.dao.hibernate.internal
import java.io.Serializable
import scala.collection.JavaConversions._
import org.beangle.commons.collection.Collections
import org.beangle.commons.collection.page.Page
import org.beangle.commons.collection.page.PageLimit
import org.beangle.commons.lang... | openurp/edu-eams-webapp | core/src/main/scala/org/openurp/edu/eams/teach/lesson/dao/hibernate/internal/LessonDaoHibernate.scala | Scala | gpl-3.0 | 6,532 |
/*
* Copyright (c) 2012, TU Berlin
* 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, this list of conditions... | choeger/sl2 | src/main/scala/de/tuberlin/uebb/sl2/impl/SimpleDriver.scala | Scala | bsd-3-clause | 9,405 |
package com.azavea.opentransit.database
import com.azavea.gtfs._
import com.azavea.opentransit.indicators._
import com.azavea.opentransit.service._
import com.azavea.opentransit.JobStatus
import spray.json.DefaultJsonProtocol._
import com.github.nscala_time.time.Imports._
import scala.slick.driver.{JdbcDriver, JdbcP... | flibbertigibbet/open-transit-indicators | scala/opentransit/src/main/scala/com/azavea/opentransit/database/IndicatorJobsTable.scala | Scala | gpl-3.0 | 3,839 |
package smarthouse.restapi.http.routes
import java.util.Date
import akka.http.scaladsl.model.{StatusCodes}
import akka.http.scaladsl.server.Directives._
import de.heikoseeberger.akkahttpcirce.CirceSupport
import io.circe.{Decoder, Encoder}
import io.circe.generic.auto._
import io.circe.syntax._
import smarthouse.rest... | andrewobukhov/smart-house | src/main/scala/smarthouse/restapi/http/routes/DevicesServiceRoute.scala | Scala | mit | 1,250 |
/*
* Copyright 2010-2011 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 app... | krasserm/scalaz-camel | scalaz-camel-core/src/main/scala/scalaz/camel/core/Dsl.scala | Scala | apache-2.0 | 15,950 |
/*
* PlotFrame.scala
* (SysSon)
*
* Copyright (c) 2013-2017 Institute of Electronic Music and Acoustics, Graz.
* Copyright (c) 2014-2019 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU General Public License v3+
*
*
* For further information, please contact Hanns Holge... | iem-projects/sysson | src/main/scala/at/iem/sysson/gui/PlotFrame.scala | Scala | gpl-3.0 | 1,189 |
/**
* See <a href="https://www.codeeval.com/open_challenges/118/">Seat Your Team</a>
*/
object SeatYourTeam extends Challenge {
val lines = scala.io.Source.fromFile(args(0)).getLines().filter(_.length > 0)
lines.collect {
case Input(favorites, available) =>
eval(favorites, Set())
} foreach {
c... | zelca/codeeval | src/SeatYourTeam.scala | Scala | mit | 970 |
/*
* 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... | dotty-staging/scalatest | examples/src/test/scala/org/scalatest/examples/freespec/getfixture/ExampleSpec.scala | Scala | apache-2.0 | 1,306 |
/*
* Copyright 2012-2014 Broad Institute, Inc.
*
* This file is part of Pilon.
*
* Pilon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* Pilon is distributed in the hope that it will be ... | AbeelLab/pilon | src/main/scala/org/broadinstitute/pilon/NormalDistribution.scala | Scala | gpl-2.0 | 2,130 |
/*
* Copyright 2001-2013 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this thing 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... | dotty-staging/scalatest | scalatest-test/src/test/scala/org/scalatest/ShouldBeDefinedImplicitSpec.scala | Scala | apache-2.0 | 7,037 |
package formation.warp10.warp10
import formation.warp10.{Configuration, Magasin, Warp10Api}
import kneelnrise.warp10scala.model.{GTS, GTSStringValue}
class MagasinWarp10(warp10Api: Warp10Api, configuration: Configuration) {
def registerAll(magasins: Seq[Magasin]): Unit = {
warp10Api.pushAll(magasins.map(magasin... | kneelnrise/formation-warp10 | src/main/scala/formation/warp10/warp10/MagasinWarp10.scala | Scala | mit | 729 |
package com.monsanto.engineering_blog.testing_without_mocking
import com.monsanto.engineering_blog.testing_without_mocking.JsonStuff._
import scala.concurrent.Future
object RealAccessTokenService {
def reallyCheckAccessToken(jsonClient:JsonClient)(accessToken: String): Future[JsonResponse] = jsonClient.getWithout... | samus42/engineering-blog | examples/testing-without-mocking/src/main/scala/com/monsanto/engineering_blog/testing_without_mocking/RealAccessTokenService.scala | Scala | bsd-3-clause | 401 |
package com.github.cocagne.composable_paxos
class Learner[T](val networkUid: NetworkUID, val quorumSize: Int) {
private case class ProposalStatus(var acceptCount: Int, var retainCount: Int,
var acceptors: Set[NetworkUID], val value: T)
private var proposals: Map[ProposalID, ProposalStatus] = Map() // ... | cocagne/scala-composable-paxos | src/main/scala/com/github/cocagne/composable_paxos/Learner.scala | Scala | mit | 2,356 |
package com.sksamuel.scapegoat.io
import java.io.{ BufferedWriter, File, FileWriter }
import com.sksamuel.scapegoat.Feedback
/**
* @author Stephen Samuel
* @author Eugene Sypachev (Axblade)
*/
object IOUtils {
private val XmlFile = "scapegoat.xml"
private val ScalastyleXmlFile = "scapegoat-scalastyle.xml"
... | pwwpche/scalac-scapegoat-plugin | src/main/scala/com/sksamuel/scapegoat/io/IOUtils.scala | Scala | apache-2.0 | 1,304 |
// 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... | toddmowen/maestro | maestro-core/src/main/scala/au/com/cba/omnia/maestro/core/data/Field.scala | Scala | apache-2.0 | 2,009 |
// Copyright (C) 2019 MapRoulette contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
package org.maproulette.models.dal
import java.sql.Connection
import anorm.SqlParser._
import anorm._
import javax.inject.Inject
import org.joda.time.DateTime
import org.maproulette.C... | mvexel/maproulette2 | app/org/maproulette/models/dal/VirtualChallengeDAL.scala | Scala | apache-2.0 | 23,063 |
import scala.util.Try
import scalaz.Scalaz._
import scalaz.effect.IO
import scalaz.effect.IO._
object Main extends App {
import Game._
def play(): IO[Unit] = for {
_ <- greetings()
game <- setup()
_ <- gameLoop(game)
} yield ()
def greetings(): IO[Unit] = {
val greet =
""" ●▬▬▬▬ஜ۩۞۩ஜ▬... | nikdon/15puzzle | src/main/scala/Main.scala | Scala | mit | 3,363 |
package com.mesosphere.cosmos.rpc.v1.model
case class SearchResponse(packages: Seq[SearchResult])
| movicha/cosmos | cosmos-model/src/main/scala/com/mesosphere/cosmos/rpc/v1/model/SearchResponse.scala | Scala | apache-2.0 | 99 |
package org.jetbrains.plugins.scala
package lang
package surroundWith
package surrounders
package expression
/**
* @author: Dmitry Krasilschikov
*/
import com.intellij.lang.ASTNode
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
/*
* ScalaWithBracketsSurrounder is responsible... | LPTK/intellij-scala | src/org/jetbrains/plugins/scala/lang/surroundWith/surrounders/expression/ScalaWithBracesSurrounder.scala | Scala | apache-2.0 | 907 |
package org.psliwa.idea.composerJson.composer.model.repository
import org.junit.Assert._
import org.junit.Test
class RepositoryProviderWrapperTest {
val innerRepository: Repository[String] = Repository.inMemory[String](List("package1"))
val innerRepositoryProvider: RepositoryProvider[String] = new RepositoryProvi... | psliwa/idea-composer-plugin | src/test/scala/org/psliwa/idea/composerJson/composer/model/repository/RepositoryProviderWrapperTest.scala | Scala | mit | 1,172 |
package controllers
import org.json4s._
package object helpers {
private implicit val format = DefaultFormats
def Json(o: Any) = Extraction.decompose(o)
} | maximx1/roma_quantum | app/controllers/helpers/package.scala | Scala | mit | 160 |
package ml.wolfe.ui
import java.util.UUID
import ml.wolfe.term._
import org.sameersingh.htmlgen.{HTML, RawHTML}
/**
* @author riedel
*/
object D3Term {
implicit def render(term:AnyTerm):HTML = {
val id = "term" + UUID.randomUUID().toString
def nodeName(term:AnyTerm):String = {
term match {
... | wolfe-pack/wolfe | wolfe-ui/src/main/scala/ml/wolfe/ui/D3Term.scala | Scala | apache-2.0 | 3,942 |
package com.twitter.finagle.http
import com.twitter.conversions.storage._
import com.twitter.conversions.time._
import com.twitter.finagle._
import com.twitter.finagle.builder.{ClientBuilder, ServerBuilder}
import com.twitter.finagle.param.Stats
import com.twitter.finagle.service.FailureAccrualFactory
import com.twitt... | a-manumohan/finagle | finagle-http/src/test/scala/com/twitter/finagle/http/EndToEndTest.scala | Scala | apache-2.0 | 18,107 |
package com.softwaremill.codebrag.dao.finders.views
import com.softwaremill.codebrag.domain.{FileDiffStats, DiffLine, CommitFileDiff}
case class CommitDetailsView(
commit: CommitView,
diff: List[FileDiffView],
supressedFiles: List[Sup... | softwaremill/codebrag | codebrag-dao/src/main/scala/com/softwaremill/codebrag/dao/finders/views/CommitDetailsView.scala | Scala | agpl-3.0 | 2,755 |
package im.actor.server.api.rpc.service.sequence
import scala.concurrent.duration._
import scala.concurrent.{ ExecutionContext, Future }
import scala.util.Success
import akka.actor.ActorSystem
import akka.stream.Materializer
import akka.util.Timeout
import slick.driver.PostgresDriver.api._
import im.actor.api.rpc._
... | x303597316/actor-platform | actor-server/actor-rpc-api/src/main/scala/im/actor/server/api/rpc/service/sequence/SequenceServiceImpl.scala | Scala | mit | 6,083 |
import java.io.{FileOutputStream, File}
import java.nio.charset.Charset
import sbt.{Info, Pure, Task}
import scala.xml.{NodeSeq, Elem}
import scala.collection.immutable.{Map ⇒ ▶:}
object Documentation {
def generate(version: String): Task[File] =
Task[File](Info[File](), Pure[File](() ⇒ generateDoc(version), in... | stacycurl/pimpathon | project/Documentation.scala | Scala | apache-2.0 | 81,861 |
package jadecrawler.dto.website
import jadeutils.mongo._
/* ================================================================= */
/* Modles for iciba crawler */
/* ================================================================= */
/**
* iciba model
*/
case class IcibaS2Dto... | Jade-Shan/Jade-crawler | crawler-dto/src/main/scala/website/dto.scala | Scala | gpl-3.0 | 5,387 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 rainysoft
*
* 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 u... | MikaelUmaN/quantlib | src/jmh/scala/com/rainysoft/quantlib/math/optimization/BrentDekkerPTest.scala | Scala | mit | 1,954 |
package backend.flowNetwork
import akka.actor._
import backend.NextFlowUID
import backend.flowNetwork.sinks.{FlowAccumulator, FlowFrequency, FlowTrace, FlowCounter}
import backend.flowNetwork.sources.{FlowTwitterSource, FlowIpsumSource, FlowNumberSource}
import backend.flowNetwork.transformations._
import play.api.lib... | hacst/reactiveStreamPlay | app/backend/flowNetwork/FlowSupervisor.scala | Scala | bsd-3-clause | 12,448 |
package com.twitter.concurrent
import org.specs.SpecificationWithJUnit
import com.twitter.util.{Return, Throw}
class AsyncQueueSpec extends SpecificationWithJUnit {
"AsyncQueue" should {
val q = new AsyncQueue[Int]
"queue pollers" in {
val p0 = q.poll()
val p1 = q.poll()
val p2 = q.poll()... | mosesn/util | util-core/src/test/scala/com/twitter/concurrent/AsyncQueueSpec.scala | Scala | apache-2.0 | 1,698 |
package coursier.cli.install
import java.nio.file.{Path, Paths}
final case class ListParams(
installPath: Path
)
object ListParams {
def apply(options: ListOptions): ListParams = {
val dir = options.installDir.filter(_.nonEmpty) match {
case Some(d) => Paths.get(d)
case None => SharedInstallPa... | alexarchambault/coursier | modules/cli/src/main/scala/coursier/cli/install/ListParams.scala | Scala | apache-2.0 | 368 |
package com.sksamuel.elastic4s.requests.ingest
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
import com.sksamuel.elastic4s._
import com.sksamuel.elastic4s.handlers.ElasticErrorParser
trait IngestHandlers {
implicit object GetPipelineRequestHandler extends Handler[GetPipelineRequest, GetPipe... | sksamuel/elastic4s | elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/ingest/IngestHandlers.scala | Scala | apache-2.0 | 3,360 |
package com.twitter.finagle.netty4
import com.twitter.app.GlobalFlag
/**
* An experimental option that enables pooling for receive buffers.
*
* Since we always copy onto the heap (see `DirectToHeapInboundHandler`), the receive
* buffers never leave the pipeline hence can safely be pooled.
* In its current form, ... | BuoyantIO/finagle | finagle-netty4/src/main/scala/com/twitter/finagle/netty4/poolReceiveBuffers.scala | Scala | apache-2.0 | 748 |
package streaming.perf.util
import java.io.PrintStream
import scala.collection.immutable.IndexedSeq
import org.apache.spark.util.StatCounter
/**
* Util for getting some stats from a small sample of numeric values, with some handy
* summary functions. This has been copied verbatim from org.apache.spark.util.Distri... | XiaoqingWang/spark-perf | streaming-tests/src/main/scala/streaming/perf/util/Distribution.scala | Scala | apache-2.0 | 2,088 |
/**
* © 2019 Refinitiv. All Rights Reserved.
*
* 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... | dudi3001/CM-Well | server/cmwell-data-tools-app/src/main/scala/cmwell/tools/data/downloader/StreamsMain.scala | Scala | apache-2.0 | 6,497 |
import org.specs2.execute.Pending
import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api.test._
import play.api.test.Helpers._
/**
* add your integration spec here.
* An integration test will fire up a whole play application in a real (or headless) browser
*/
@RunWith(clas... | Kuchitama/MyTime | test/IntegrationSpec.scala | Scala | apache-2.0 | 1,101 |
package io.koff.hll
/**
* Simple example of using HLL from stream
*/
object SimpleStreamExample {
import com.clearspring.analytics.stream.cardinality.HyperLogLogPlus
def main(args: Array[String]) {
//define test data
val data = Seq("aaa", "bbb", "ccc")
//create HLL object in which we will add our da... | coffius/koffio-hll | src/main/scala/io/koff/hll/SimpleStreamExample.scala | Scala | mit | 745 |
package pgep.GeneticOperators.Mutators
abstract class Mutator(selection: GenotypeSelector) extends GeneticOperator(1, 1, selection){
def apply(genotypes: Array[Genotype]) {
for (sel <- selection.select(genotypes)) {
assert(sel.length == 1)
apply(sel.head)
}
}
protected[Mutators] def apply(gt: Genot... | khernyo/PGEP | src/pgep/GeneticOperators/Mutators/Mutator.scala | Scala | gpl-3.0 | 327 |
package lazybenchmarks
import leon.lazyeval._
import leon.lang._
import leon.annotation._
import leon.instrumentation._
//import leon.invariant._
object MergeSort {
// TODO: making this parametric will break many things. Fix them
sealed abstract class LList {
def size: BigInt = {
this match {
c... | regb/leon | testcases/lazy-datastructures/withconst/LazyMegeSort.scala | Scala | gpl-3.0 | 2,344 |
/*
* Copyright (c) 2014-2015 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apach... | RetentionGrid/kinesis-s3 | src/main/scala/com.snowplowanalytics.snowplow.storage.kinesis/s3/RawEventTransformer.scala | Scala | apache-2.0 | 1,607 |
/*
* scala-swing (https://www.scala-lang.org)
*
* Copyright EPFL, Lightbend, Inc., contributors
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala... | scala/scala-swing | src/main/scala/scala/swing/event/PopupMenuEvent.scala | Scala | apache-2.0 | 628 |
/*
* 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 ... | andrewor14/iolap | sql/hive/src/test/scala/org/apache/spark/sql/sources/hadoopFsRelationSuites.scala | Scala | apache-2.0 | 24,798 |
/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api
import java.io.{ InputStream, File }
/**
* The environment for the application.
*
* Captures concerns relating to the classloader and the filesystem for the application.
*
* @param rootPath The root path that the appli... | Shenker93/playframework | framework/src/play/src/main/scala/play/api/Environment.scala | Scala | apache-2.0 | 3,635 |
/*
Copyright 2018 Jo Pol
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 License, or
(at your option) any later version.
This program is distributed in the hope that it ... | d-bl/GroundForge | src/main/scala/dibl/NewPairDiagram.scala | Scala | gpl-3.0 | 6,126 |
/*
* 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 ... | pgandhi999/spark | core/src/main/scala/org/apache/spark/rdd/OrderedRDDFunctions.scala | Scala | apache-2.0 | 4,248 |
package travelling
import junit.framework.TestCase
import org.junit.Test
import org.junit.Assert._
class VecTest {
@Test
def testClamp() {
val v = Vec(100, 100)
assertVectorEquals(Vec(1, 1), Vec(100, 100).clamp(1))
assertVectorEquals(Vec(1, 0.5f), Vec(100, 50).clamp(1))
assertVectorEquals(Vec(1, ... | fdb/travelling_letters | src/test/scala/travelling/VecTest.scala | Scala | lgpl-3.0 | 1,312 |
/*
* 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... | kroepke/luna | luna-tests/src/test/scala/org/classdump/luna/test/fragments/BasicLibFragments.scala | Scala | apache-2.0 | 16,760 |
package org.wartremover
package contrib.test
import org.scalatest.FunSuite
import org.wartremover.contrib.warts.SomeApply
import org.wartremover.test.WartTestTraverser
class SomeApplyTest extends FunSuite with ResultAssertions {
test("can't use Some.apply with null") {
val result = WartTestTraverser(SomeApply)... | tim-zh/wartremover-contrib | core/src/test/scala/wartremover/contrib/warts/SomeApplyTest.scala | Scala | apache-2.0 | 1,325 |
/*
* Copyright (C) 2005, The OpenURP Software.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This... | openurp/api | qos/src/main/scala/org/openurp/qos/evaluation/clazz/model/mapping.scala | Scala | lgpl-3.0 | 2,099 |
/**
* Rectangle.
*
* @author Yujian Zhang <yujian{dot}zhang[at]gmail(dot)com>
*
* License:
* GNU General Public License v2
* http://www.gnu.org/licenses/gpl-2.0.html
* Copyright (C) 2015 Yujian Zhang
*/
package net.whily.scasci.geo
/** Rectangle with edges parallel to axes.
*/
class Rect(val x1: Doub... | whily/scasci | src/main/scala/geo/Rect.scala | Scala | gpl-2.0 | 972 |
package model.coin
import model.coin.utils.EmbeddedMariaDb
import model.coin.utils.WorkEntryTestUtil._
import models.coin.WorkEntry
import models.common.Person
import models.common.Person.PersonId
import org.specs2.matcher.Matchers
import play.api.test.{PlaySpecification, WithApplication}
import scala.language.postfi... | wirvomgut/curo | test/model/coin/PersonSpec.scala | Scala | apache-2.0 | 2,772 |
// Copyright (c) 2014 David Miguel Antunes <davidmiguel {at} antunes.net>
//
// 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 right... | david04/liftutils | src/main/scala/com/github/david04/liftutils/algo/Bitmap.scala | Scala | mit | 2,935 |
package ohnosequences.awstools.test
import ohnosequences.awstools._
import com.amazonaws.services.autoscaling.AmazonAutoScaling
class AutoScaling extends org.scalatest.FunSuite with org.scalatest.BeforeAndAfterAll {
lazy val as: AmazonAutoScaling = autoscaling.defaultClient
// override def beforeAll() = {
//... | ohnosequences/aws-scala-tools | src/test/scala/ohnosequences/awstools/autoscaling.scala | Scala | agpl-3.0 | 371 |
package backend.distributor
import akka.actor.{ActorRef, Terminated}
import akka.stream.scaladsl.Flow
import akka.stream.stage._
import akka.stream.{Attributes, FlowShape, Inlet, Outlet}
import backend._
import backend.PricerMsg._
import backend.distributor.StreamLinkApi.{Payload, Demand, DistributorStreamRef, PricerS... | intelix/activator-reactive-fx | app/backend/distributor/PricerStreamEndpointStage.scala | Scala | apache-2.0 | 5,947 |
package com.evnm.markovprocessor
import scala.io.Source
import org.scalatest.FunSuite
import com.evnm.markovprocessor.{MarkovProcessor => MP}
class MarkovProcessorSuite extends FunSuite {
/*
* Test groupWords.
*/
test("groupWords should return Nil when input list is Nil") {
assert(MP.groupWords(0, Nil) ... | evnm/scala-markov-processor | src/test/scala/MarkovProcessorSuite.scala | Scala | mit | 2,961 |
import sbt._
import Keys._
import sbtrelease.ReleasePlugin._
import sbtbuildinfo.Plugin._
import scala.xml.Group
object build extends Build {
val manifestSetting = packageOptions <+= (name, version, organization) map {
(title, version, vendor) =>
Package.ManifestAttributes(
"Created-By" -> "Simple... | casualjim/swagger-async-httpclient | project/build.scala | Scala | apache-2.0 | 5,358 |
package org.odfi.indesign.core.module.ui.www.pdf
import org.odfi.indesign.core.module.ui.www.external.ExternalBuilder
import com.idyria.osi.vui.html.HTMLNode
import org.w3c.dom.html.HTMLElement
import java.net.URI
trait PDFBuilder extends ExternalBuilder {
// Current Page
//----------------
var pdfP... | opendesignflow/indesign | indesign-wwwui/src/main/scala/org/odfi/indesign/core/module/ui/www/pdf/PDFBuilder.scala | Scala | gpl-3.0 | 2,036 |
package com.github.caiiiycuk.async4s.request
import com.ning.http.client.Response
import com.github.caiiiycuk.async4s.response.ResponseType
import java.util.HashMap
import scala.collection.mutable.ListBuffer
case class RequestParam(key: String, value: Any)
case class RequestUrl[T](url: String, rType: ResponseType[T]... | caiiiycuk/async4s-http-client | src/main/scala/com/github/caiiiycuk/async4s/request/RequestUrl.scala | Scala | mit | 714 |
import sbt._
import Keys._
import ls.Plugin.LsKeys
object Unfiltered extends Build {
import Common._
import java.lang.{ Boolean => JBoolean }
def id(name: String) = "unfiltered-%s" format name
def local(name: String) = LocalProject(id(name))
def srcPathSetting(projectId: String, rootPkg: String) =
map... | peel/unfiltered | project/build.scala | Scala | mit | 3,252 |
package chat.tox.antox.tox
import java.io._
import android.content.Context
import android.preference.PreferenceManager
import android.util.Log
import chat.tox.antox.utils.FileUtils
import im.tox.tox4j.core.options.SaveDataOptions
import im.tox.tox4j.core.options.SaveDataOptions.ToxSave
class ToxDataFile(ctx: Context... | gale320/Antox | app/src/main/scala/chat/tox/antox/tox/ToxDataFile.scala | Scala | gpl-3.0 | 2,262 |
/*
* Copyright 2016 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... | ahudspith-equalexperts/ct-calculations | src/main/scala/uk/gov/hmrc/ct/ct600j/v3/SchemeReferenceNumberBox.scala | Scala | apache-2.0 | 1,413 |
/*
* 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 ... | foryou2030/incubator-carbondata | integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/DefaultSourceTestCase.scala | Scala | apache-2.0 | 3,519 |
/*
* Copyright 2022 Typelevel
*
* 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... | typelevel/sbt-typelevel | github-actions/src/main/scala/org/typelevel/sbt/gha/GenerativePlugin.scala | Scala | apache-2.0 | 30,696 |
/**
* Copyright 2009 Jorge Ortiz
*
* 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... | jorgeortiz85/scala-time | src/main/scala/org/scala_tools/time/RichDateMidnight.scala | Scala | apache-2.0 | 1,346 |
/*
* 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 ... | dotunolafunmiloye/spark | examples/src/main/scala/org/apache/spark/examples/BroadcastTest.scala | Scala | apache-2.0 | 2,264 |
/*
* Copyright 2014 Databricks
*
* 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... | yl2695/spark-csv | src/main/scala/com/databricks/spark/csv/DefaultSource.scala | Scala | apache-2.0 | 5,178 |
/*
* Copyright 2015 Mediative
*
* 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... | jonas/sparrow | core/src/test/scala/com.mediative.sparrow/DateTimeOptionsSpec.scala | Scala | apache-2.0 | 2,542 |
package c2.w4.futures
import scala.concurrent.Future
trait Request {}
object Request {
def apply(bytes: Array[Byte]): Request = ???
}
trait Response {
def isOK: Boolean
def body: Array[Byte]
}
object Response {
def apply(bytes: Array[Byte]): Response = ???
}
object Http {
def apply(url: String, request:... | lwo/lwo.github.io | src/main/scala/c2/w4/futures/Send.scala | Scala | gpl-3.0 | 357 |
package infra.piece.html
import infra.piece.core.{Piece, PieceKind}
import play.api.Plugin
import play.api.libs.json.{Json, Format}
import play.api.templates.Html
import scala.concurrent.{Future, ExecutionContext}
import org.jsoup.Jsoup
import org.jsoup.safety.Whitelist
/**
* @author alari ([email protected])
* ... | alari/play-content | module-code/app/infra/piece/html/HtmlKind.scala | Scala | mit | 770 |
package com.feynmanliang.optala
import scala.util.{Failure, Success, Try}
import breeze.linalg._
private[optala] case class GradientBasedSolution(
override val point: DenseVector[Double],
override val f: Vector[Double] => Double,
grad: DenseVector[Double],
normGrad: Double) extends Solution(f, point)... | feynmanliang/optala | src/main/scala/com/feynmanliang/optala/GradientOptimizer.scala | Scala | mit | 7,309 |
package mesosphere.marathon.core
import mesosphere.marathon.core.auth.AuthModule
import mesosphere.marathon.core.launcher.LauncherModule
import mesosphere.marathon.core.launchqueue.LaunchQueueModule
import mesosphere.marathon.core.leadership.LeadershipModule
import mesosphere.marathon.core.plugin.PluginModule
import m... | matsluni/marathon | src/main/scala/mesosphere/marathon/core/CoreModule.scala | Scala | apache-2.0 | 902 |
package views.html.helpers
import replsampler.formatting.Formatter
import play.api.templates.Html
import replsampler.Runner.Result
import replsampler.{Runner, ReplSampler}
import utils.Hash
import play.api.cache.Cache
import play.api.Play.current
object sample {
object KodknackningFormatter extends Formatter[Html]{... | teozkr/kodknackning | app/views/helpers/sample.scala | Scala | bsd-2-clause | 762 |
/*
* Copyright 2017 Datamountaineer.
*
* 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... | CodeSmell/stream-reactor | kafka-connect-cassandra/src/test/scala/com/datamountaineer/streamreactor/connect/cassandra/sink/TestCassandraSinkConnector.scala | Scala | apache-2.0 | 1,984 |
/*
Copyright 2013 Stephen K Samuel
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... | carlosFattor/scrimage | scrimage-filters/src/main/scala/com/sksamuel/scrimage/filter/LensBlurFitler.scala | Scala | apache-2.0 | 1,079 |
package com.arcusys.valamis.lesson.scorm.model
import com.arcusys.valamis.lesson.scorm.model.manifest.Metadata
import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
class MetadataTest extends FlatSpec with ShouldMatchers {
"Metadata" can "be constructed" in {
val externalLocations = Seq("L... | ViLPy/Valamis | valamis-scorm-lesson/src/test/scala/com/arcusys/valamis/lesson/scorm/model/MetadataTest.scala | Scala | lgpl-3.0 | 1,325 |
package com.raquo
package object xstream extends StreamConversions
| raquo/XStream.scala | src/main/scala/com/raquo/xstream/package.scala | Scala | mit | 68 |
package controllers
import play.api._
import play.api.mvc._
import util.Location
object Page extends Controller {
val pageModel = new models.Pages
def page(slug: String) = Action {
val pageOption = pageModel.getPage(slug)
pageOption match {
case Some(pageEntity) => {
Location.set(pageEn... | icambridge-old/inspector | app/controllers/Pages.scala | Scala | mit | 448 |
package scalaz.stream.mongodb
import scalaz.stream.mongodb.query.{QueryEnums, QuerySyntax}
import scalaz.stream.mongodb.bson.{BSONValuesImplicits, BSONValues}
import scalaz.stream.mongodb.index.CollectionIndexSyntax
import com.mongodb.DBCollection
import scalaz.concurrent.Task
import scalaz.stream.Process
import scala... | Spinoco/scalaz-stream-mongodb | core/src/main/scala/scalaz/stream/mongodb/collection.scala | Scala | mit | 1,700 |
package scala.c.engine
import java.nio.file.Paths
import better.files.File
class TinyExprTest extends StandardTest {
// "tinyexpr test 2" should "print the correct results" in {
// val code = """
// void main() {
//
// #include "tinyexpr.h"
//
// int i;
// int err;
// const double r... | bdwashbu/cEngine | tests/scala/c/engine/TinyExprTest.scala | Scala | apache-2.0 | 868 |
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This file is part of Rudder.
*
* Rudder is free software: you can redistribute it and/or modify
* it under the... | armeniaca/rudder | rudder-web/src/main/scala/com/normation/rudder/web/components/popup/CreateCategoryOrGroupPopup.scala | Scala | gpl-3.0 | 14,737 |
import quoted.*
import scala.quoted.staging.*
object Test {
given Compiler = Compiler.make(getClass.getClassLoader)
def main(args: Array[String]): Unit = withQuotes {
val q = '{ (q: Quotes) ?=>
val t = Type.of[String]
t
}
println(q.show)
}
}
| dotty-staging/dotty | tests/run-staging/quote-nested-4.scala | Scala | apache-2.0 | 275 |
package com.gilt.sbt.artifactory
import sbt._
import sbt.Keys._
object GiltArtifactory extends AutoPlugin {
override def trigger = allRequirements
override def requires = empty
private lazy val defaultIvyPattern = Patterns(
ivyPatterns = Vector("[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVers... | myyk/gilt-sbt-artifactory | src/main/scala/com/gilt/sbt/artifactory/GiltArtifactory.scala | Scala | mit | 2,225 |
/*
* Artificial Intelligence for Humans
* Volume 2: Nature Inspired Algorithms
* Java Version
* http://www.aifh.org
* http://www.jeffheaton.com
*
* Code repository:
* https://github.com/jeffheaton/aifh
*
* Copyright 2014 by Jeff Heaton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* y... | PeterLauris/aifh | vol2/vol2-scala-examples/src/main/scala/com/heatonresearch/aifh/examples/ga/iris/ModelIris.scala | Scala | apache-2.0 | 4,655 |
/* The Computer Language Benchmarks Game
http://benchmarksgame.alioth.debian.org/
Contributed by The Anh Tran
Updated for 2.8 by Rex Kerr
Modified by Michael Peng for 2.10
*/
import scala.concurrent.duration.Duration
import java.util.regex.Pattern
import scala.concurrent._
import ExecutionContext.Implicit... | dc-uba/metrika_benchs_game | benchs/regexdna/regexdna.scala-2.scala | Scala | mit | 1,977 |
package com.shorrockin.cascal.model
import java.nio.ByteBuffer
/**
* provides the high level abstraction for the keyspace. can be thought
* of as a DB schema. also can be considered the 1st dimension of the
* cassandra map. This class can be used in the following ways to construct
* paths to various endpoints in t... | Shimi/cascal | src/main/scala/com/shorrockin/cascal/model/Keyspace.scala | Scala | apache-2.0 | 977 |
/*
* Copyright 2015 Nicolas Rinaudo
*
* 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... | nrinaudo/tabulate | laws/shared/src/main/scala/kantan/csv/laws/discipline/ReaderEngineTests.scala | Scala | mit | 2,208 |
package cn.dunn
import cn.dunn.mode.User
import cn.dunn.mongo.UserRepository
import cn.dunn.util.MD5Util
import com.alibaba.fastjson.{JSON, JSONObject}
import org.springframework.context.support.ClassPathXmlApplicationContext
/**
* Created by Administrator on 2016/9/19.
*/
object RepositoryTest extends App {
va... | weimeittx/IM | runner/src/test/scala/cn/dunn/RepositoryTest.scala | Scala | apache-2.0 | 587 |
package monocle
import scalaz.{Applicative, Category, Equal, Maybe, Monoid, Traverse, \\/}
import scalaz.std.option._
import scalaz.syntax.std.option._
/**
* A [[PPrism]] can be seen as a pair of functions:
* - `getOrModify: S => T \\/ A`
* - `reverseGet : B => T`
*
* A [[PPrism]] could also be defined as a we... | NightRa/Monocle | core/src/main/scala/monocle/Prism.scala | Scala | mit | 10,036 |
package com.phasmid.hedge_fund.rules
import scala.collection.MapLike
import scala.collection.GenMapLike
/**
* @author robinhillyard
*/
trait Candidate extends Function1[String, Option[Any]] {
def identifier: String
def ++(m: Map[String, Any]): Candidate
}
case class MapCandidate(id: String, map: Map[String, Any... | rchillyard/Scalaprof | hedge-fund/src/main/scala/com/phasmid/hedge_fund/rules/Candidate.scala | Scala | gpl-2.0 | 461 |
package scwebapp
import scutil.lang.*
object ChannelState {
final case class Initial[T]() extends ChannelState[T]
final case class HasValue[T](value:T) extends ChannelState[T]
final case class HasHandler[T](handler:Effect[T]) extends ChannelState[T]
final case class Final[T]() extends ChannelState[T... | ritschwumm/scwebapp | modules/core/src/main/scala/scwebapp/ChannelState.scala | Scala | bsd-2-clause | 354 |
package com.twitter.finagle.exp.zookeeper.integration.standalone.v3_4.command
import java.util
import com.twitter.finagle.exp.zookeeper.Zookeeper
import com.twitter.finagle.exp.zookeeper.ZookeeperDefs.CreateMode
import com.twitter.finagle.exp.zookeeper.data.Ids
import com.twitter.finagle.exp.zookeeper.integration.sta... | finagle/finagle-zookeeper | integration/src/test/scala/com/twitter/finagle/exp/zookeeper/integration/standalone/v3_4/command/ChrootTest.scala | Scala | apache-2.0 | 3,053 |
package org.openmole.buildsystem
import org.apache.commons.compress.archivers.tar.{ TarArchiveEntry, TarArchiveOutputStream }
import java.io.{ BufferedOutputStream, FileOutputStream }
import java.util.zip.GZIPOutputStream
import sbt._
import Keys._
import resource._
import scala.io.Source
object TarPlugin extends Au... | openmole/openmole | build-system/src/main/scala/org/openmole/buildsystem/TarPlugin.scala | Scala | agpl-3.0 | 2,376 |
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.