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 |
|---|---|---|---|---|---|
// Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs/contributors
// License: http://www.gnu.org/licenses/lgpl-3.0.en.html
package org.ensime.io
import java.io.File
import java.nio.file._
import scala.util.Properties.jdkHome
import scalaz.std.list._
import scalaz.ioeffect.RTS
import org.scalate... | ensime/ensime-server | api/src/test/scala/org/ensime/io/CanonSpec.scala | Scala | gpl-3.0 | 2,143 |
package com.gu.notificationschedule.dynamo
import java.time.Instant
import com.amazonaws.handlers.AsyncHandler
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsync
import com.amazonaws.services.dynamodbv2.model._
import scala.jdk.CollectionConverters._
import scala.concurrent.Promise
case class ScheduleTab... | guardian/mobile-n10n | commonscheduledynamodb/src/main/scala/com/gu/notificationschedule/dynamo/NotificationSchedulePersistenceImpl.scala | Scala | apache-2.0 | 3,532 |
/*
* 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 ... | bwsw/sj-platform | core/sj-output-streaming-engine/src/test/scala/com/bwsw/sj/engine/output/benchmark/OutputBenchmarkConfigNames.scala | Scala | apache-2.0 | 1,145 |
/*
* 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... | cheeseng/scalatest | scalatest-test/src/test/scala/org/scalatest/ConfigMapSpec.scala | Scala | apache-2.0 | 18,874 |
/*
* Copyright 2014 – 2015 Paul Horn
*
* 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... | knutwalker/transducers-scala | guide/src/it/scala/install.scala | Scala | apache-2.0 | 3,819 |
/*
* 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 ... | yew1eb/flink | flink-libraries/flink-table/src/main/scala/org/apache/flink/table/sources/tsextractors/ExistingField.scala | Scala | apache-2.0 | 2,835 |
package com.blockcypher.api.protocol
import org.scalacoin.currency.CurrencyUnit
import org.scalacoin.protocol.BitcoinAddress
/**
* Created by chris on 12/19/15.
*/
trait BlockCypherOutput {
def value : CurrencyUnit
def script : String
def addresses : Seq[BitcoinAddress]
def scriptType : String
}
case clas... | Christewart/blockcypher-api | src/main/scala/com/blockcypher/api/protocol/BlockCypherOutput.scala | Scala | mit | 517 |
// Copyright (C) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in project root for information.
package com.microsoft.ml.spark
class ValidateConfiguration extends TestBase {
test("Basic BrainScript config E2E") {
val relativeOutRoot = "out"
val remappedInPath = ... | rastala/mmlspark | src/cntk-train/src/test/scala/ValidateConfiguration.scala | Scala | mit | 796 |
/*
* Copyright 2014–2018 SlamData 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 agr... | jedesah/Quasar | blueeyes/src/main/scala/quasar/blueeyes/util/Clock.scala | Scala | apache-2.0 | 1,613 |
package io.buoyant.linkerd.protocol
import com.fasterxml.jackson.annotation.JsonIgnore
import com.twitter.finagle.{Filter, Service, ServiceFactory, Stack, Stackable}
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finagle.stack.nilStack
import com.twitter.util.Future
import io.buoyant.config.Pol... | linkerd/linkerd | linkerd/protocol/http/src/main/scala/io/buoyant/linkerd/protocol/HttpRequestAuthorizerConfig.scala | Scala | apache-2.0 | 2,041 |
/**
* Copyright (C) 2012-2013 Vadim Bartko ([email protected]).
*
* 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 2 of the License, or
* (at your option) any later ve... | hudvin/nomad | src/main/scala/com/nevilon/nomad/filter/UrlsCleaner.scala | Scala | gpl-2.0 | 2,078 |
package info.glennengstrand.io
import org.apache.http.message.BasicHttpEntityEnclosingRequest
import org.apache.http.impl.DefaultBHttpClientConnection
import org.apache.http.entity.{StringEntity,ContentType}
import org.apache.http.protocol.{HttpRequestExecutor,HttpCoreContext,HttpProcessor,HttpProcessorBuilder,Request... | gengstrand/clojure-news-feed | server/feed2/src/main/scala/info/glennengstrand/io/ElasticSearch.scala | Scala | epl-1.0 | 5,080 |
package pl.touk.nussknacker.ui.security.ssl
import java.net.URI
case class KeyStoreConfig(uri: URI, password: Array[Char]) | TouK/nussknacker | security/src/main/scala/pl/touk/nussknacker/ui/security/ssl/KeyStoreConfig.scala | Scala | apache-2.0 | 124 |
package demo
import sqltyped._
object TestData {
def drop = sql("DELETE FROM person").apply
def create = {
val newPerson = sqlk("INSERT INTO person (name, secret, interview) VALUES (?, ?, ?)")
val admin = newPerson("Admin", None, None)
val other = newPerson("Some other guy", None, None)
val inter... | jonifreeman/sqltyped | demo/src/main/scala/testdata.scala | Scala | apache-2.0 | 596 |
package com.github.aalbul.irc.client.protocol
/**
* Created by nuru on 08.01.14.
*
* Control statement case classes
*/
trait ControlStatements {
case class SendPrivateMessage(user: String, message: String)
case class SendChannelMessage(channel: String, message: String, recipient: Option[String] = None)
case ... | aalbul/reactive-irc | src/main/scala/com/github/aalbul/irc/client/protocol/ControlStatements.scala | Scala | gpl-3.0 | 3,257 |
package org.vlinderlang.vlinderc.ssa
import org.vlinderlang.vlinderc.ModuleName
import org.vlinderlang.vlinderc.`type`.Type
import scala.collection.immutable.ListMap
sealed abstract class ID(prefix: String) {
private val id = ID.nextID()
override def toString = s"$prefix$id"
}
object ID {
private v... | vlinder-lang/vlinderc | src/main/scala/org/vlinderlang/vlinderc/ssa/ssa.scala | Scala | bsd-3-clause | 1,905 |
package nlpdata.util
import resource.managed
import resource.ManagedResource
import scala.util.Try
import java.nio.file.{Files, Path, Paths}
trait PackagePlatformExtensions {
protected[nlpdata] def loadFile(path: Path): ManagedResource[Iterator[String]] = {
import scala.collection.JavaConverters._
managed... | julianmichael/nlpdata | nlpdata/src-jvm/nlpdata/util/PackagePlatformExtensions.scala | Scala | mit | 494 |
package scalacsv
import scala.util.parsing.combinator._
object Csv extends RegexParsers {
def apply(input: String): List[List[String]] = parseAll(table, input) match {
case Success(result, _) => result
case failure : NoSuccess => scala.sys.error(failure.msg)
}
override def skipWhitespace = false
def... | kei10in/scalacsv | src/main/scala/Csv.scala | Scala | mit | 880 |
import org.junit.Test
import org.junit.Assert.assertEquals
class TestA {
@Test def testThree = {
assertEquals(A.three, 3)
}
}
| lampepfl/dotty | sbt-test/discovery/test-discovery/src/test/scala/TestA.scala | Scala | apache-2.0 | 135 |
import stainless.lang._
object Ackermann {
def ackermann(m: BigInt, n: BigInt): BigInt = {
require(m >= 0 && n >= 0)
if (m == 0) n + 1
else if (n == 0) ackermann(m - 1, 1)
else ackermann(m - 1, ackermann(m, n - 1))
} ensuring (_ >= 0)
}
| epfl-lara/stainless | frontends/benchmarks/termination/valid/Ackermann.scala | Scala | apache-2.0 | 258 |
package vulkan.wrapper.registry.command
import vulkan.wrapper.registry.vtype.VulkanType
import vulkan.wrapper.registry.{Registry, RegistryComponent, _}
import scala.xml.Node
class VulkanCommandParam(registry: Registry, val vulkanCommand: VulkanCommand, node: Node) extends VulkanNamedComponent(registry,node){
val l... | MrInformatic/VulkanWrapper | src/vulkan/wrapper/registry/command/VulkanCommandParam.scala | Scala | mit | 1,284 |
/*
* Copyright 2017-2020 47 Degrees Open Source <https://www.47deg.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 ... | frees-io/freestyle-rpc | modules/monix/src/main/scala/higherkindness/mu/rpc/internal/server/monix/handlers.scala | Scala | apache-2.0 | 4,516 |
/*
* This file is part of the regex project.
*
* 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 ... | gnieh/tekstlib | src/test/scala/gnieh/regex/MatchingTest.scala | Scala | apache-2.0 | 4,158 |
package recommender
import breeze.linalg.Vector
import org.apache.spark.SparkContext._
import org.apache.spark.mllib.recommendation.Rating
import org.apache.spark.rdd.RDD
/**
* Created by Ondra Fiedler on 24.7.14.
*/
/**
* Recommender which uses the k-nearest neighbors algorithm
* @param vectorsRDD Vectors repr... | OndraFiedler/spark-recommender | src/main/scala/recommender/KnnRecommender.scala | Scala | mit | 3,352 |
import sbt._
import sbt.Keys._
import sbt.complete._
import sbt.complete.DefaultParsers._
import sbtrelease.ReleasePlugin.autoImport._
import sbtrelease.{ReleasePlugin, Vcs}
import scala.sys.process._
/**
* == ReadmeRelease Plugin ==
*
* Changes the version in the README.md during a release.
*
*/
object R... | fsat/sbt-native-packager | project/ReadmeReleasePlugin.scala | Scala | bsd-2-clause | 2,761 |
package com.scalaAsm.x86
package Instructions
package General
// Description: Bit Population Count
// Category: general/bit
trait POPCNT extends InstructionDefinition {
val mnemonic = "POPCNT"
}
object POPCNT extends TwoOperands[POPCNT] with POPCNTImpl
trait POPCNTImpl extends POPCNT {
implicit object _0 extend... | bdwashbu/scala-x86-inst | src/main/scala/com/scalaAsm/x86/Instructions/General/POPCNT.scala | Scala | apache-2.0 | 713 |
package mesosphere.marathon
package core.task.update.impl.steps
//scalastyle:off
import javax.inject.Named
import akka.Done
import akka.actor.ActorRef
import com.google.inject.{ Inject, Provider }
import mesosphere.marathon.MarathonSchedulerActor.ScaleRunSpec
import mesosphere.marathon.core.condition.Condition
import ... | guenter/marathon | src/main/scala/mesosphere/marathon/core/task/update/impl/steps/ScaleAppUpdateStepImpl.scala | Scala | apache-2.0 | 1,883 |
package de.leanovate.swaggercheck.schema
import de.leanovate.swaggercheck.schema.model.{ValidationSuccess, ValidationFailure, ValidationResult}
import org.scalacheck.Prop
import org.scalacheck.Prop.Result
import scala.language.implicitConversions
object ValidationResultToProp {
/**
* Convert to a scala-check `... | leanovate/swagger-check | json-schema-gen/src/main/scala/de/leanovate/swaggercheck/schema/ValidationResultToProp.scala | Scala | mit | 568 |
/***********************************************************************
* Copyright (c) 2013-2018 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... | jahhulbert-ccri/geomesa | geomesa-features/geomesa-feature-kryo/src/main/scala/org/locationtech/geomesa/features/kryo/serialization/KryoGeometrySerialization.scala | Scala | apache-2.0 | 737 |
package scalapb
import java.io.File
import protocbridge.{ProtocBridge, ProtocCodeGenerator}
import coursier.parse.DependencyParser
import coursier.core.Configuration
import com.github.ghik.silencer.silent
import coursier.core.Dependency
import java.net.URLClassLoader
import java.util.jar.JarInputStream
import java.io... | scalapb/ScalaPB | scalapbc/src/main/scala/scalapb/ScalaPBC.scala | Scala | apache-2.0 | 7,010 |
package com.sksamuel.elastic4s
import scala.concurrent.{ExecutionContext, Future}
import scala.language.higherKinds
trait Functor[F[_]] {
def map[A, B](fa: F[A])(f: A => B): F[B]
}
object Functor {
def apply[F[_]: Functor](): Functor[F] = implicitly[Functor[F]]
implicit def FutureFunctor(implicit ec: Executi... | stringbean/elastic4s | elastic4s-core/src/main/scala/com/sksamuel/elastic4s/Functor.scala | Scala | apache-2.0 | 498 |
package persistence.dal
import com.typesafe.scalalogging.LazyLogging
import persistence.entities.{ Project, Projects }
import slick.driver.JdbcProfile
import utils.DbModule
import scala.concurrent.Future
trait ProjectsDal {
def save(proj: Project): Future[Int]
def getProjects(): Future[Seq[Project]]
def getPro... | ShiftForward/ridgeback | src/main/scala/persistence/dal/ProjectsDal.scala | Scala | mit | 1,186 |
package com.nulabinc.backlog.migration.common.convert.writes
import javax.inject.Inject
import com.nulabinc.backlog.migration.common.convert.Writes
import com.nulabinc.backlog.migration.common.domain.BacklogAttributeInfo
import com.nulabinc.backlog.migration.common.utils.Logging
import com.nulabinc.backlog4j.Attribut... | nulab/backlog-migration-common | core/src/main/scala/com/nulabinc/backlog/migration/common/convert/writes/AttributeInfoWrites.scala | Scala | mit | 695 |
package br.edu.ifrn.potigol.editor
import java.awt.{ Color, Dimension, Font }
import java.awt.event.{ ActionEvent, KeyEvent }
import java.io.PrintWriter
import scala.collection.mutable.Stack
import scala.swing.{ Action, BorderPanel }
import scala.swing.{ FileChooser, MainFrame, Menu, MenuBar, MenuItem, Separato... | potigol/EditorPotigol | src/main/scala/br/edu/ifrn/potigol/editor/Editor.scala | Scala | gpl-2.0 | 23,686 |
package com.pragmasoft.reactive.akka.components.circuitbreaker
import akka.actor.{ActorRef, ActorSystem}
import akka.testkit.{TestProbe, TestKit}
import com.pragmasoft.reactive.akka.components.circuitbreaker.CircuitBreakerActor._
import org.scalatest.{FlatSpecLike, FlatSpec}
import scala.concurrent.duration._
import s... | galarragas/akka-components | src/test/scala/com/pragmasoft/reactive/akka/components/circuitbreaker/CircuitBreakerActorSpec.scala | Scala | apache-2.0 | 10,043 |
package sbt.complete
object JLineTest
{
import DefaultParsers._
val one = "blue" | "green" | "black"
val two = token("color" ~> Space) ~> token(one)
val three = token("color" ~> Space) ~> token(ID.examples("blue", "green", "black"))
val four = token("color" ~> Space) ~> token(ID, "<color name>")
val num = toke... | kuochaoyi/xsbt | util/complete/src/test/scala/ParserTest.scala | Scala | bsd-3-clause | 4,362 |
package safe.io
import safe.SafeVector
trait Writeable[A, O] {
def apply(a: A): O
}
object Writeable {
def of[A, B](f: A => B) = new Writeable[A, B] {
def apply(a: A) = f(a)
}
def identity[A] = new Writeable[A, A] {
def apply(a: A) = a
}
} | devonbryant/safe | safe-core/src/main/scala/safe/io/Writeable.scala | Scala | epl-1.0 | 263 |
package com.sksamuel.elastic4s.search.aggs
import com.sksamuel.elastic4s.ElasticsearchClientUri
import com.sksamuel.elastic4s.http.search.Bucket
import com.sksamuel.elastic4s.http.{ElasticDsl, HttpClient}
import com.sksamuel.elastic4s.testkit.SharedElasticSugar
import org.elasticsearch.action.support.WriteRequest.Refr... | aroundus-inc/elastic4s | elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/aggs/TermsAggregationHttpTest.scala | Scala | apache-2.0 | 5,780 |
package models
case class LineIndex(indentation: Int, title: String)
| raychenon/play-table-of-contents | app/models/LineIndex.scala | Scala | mit | 70 |
package io.findify.sqsmock
import com.amazonaws.services.sqs.AmazonSQSClient
import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers}
import scala.collection.JavaConversions._
/**
* Created by shutty on 3/30/16.
*/
class SendReceiveTest extends FlatSpec with Matchers with SQSStartStop {
val queue = "http://... | findify/sqsmock | src/test/scala/io/findify/sqsmock/SendReceiveTest.scala | Scala | mit | 945 |
/*
* Copyright 2001-2009 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... | lordkret/profit | profit/src/test/scala/samples/scalatest.scala | Scala | mit | 3,176 |
/*
* 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... | liquidarmour/ct-calculations | src/main/scala/uk/gov/hmrc/ct/computations/CP290a.scala | Scala | apache-2.0 | 963 |
package org.liquidizer.view
import scala.xml._
import scala.io._
import net.liftweb._
import net.liftweb.util._
import net.liftweb.http._
import net.liftweb.common._
import net.liftweb.util.Helpers.TheStrBindParam
import org.liquidizer.model._
import org.liquidizer.lib._
/** Display code for the display of emoticon... | liquidizer/liquidizer | src/main/scala/org/liquidizer/view/EmotionView.scala | Scala | mit | 2,906 |
/*
* 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 | sql/catalyst/src/main/scala/org/apache/spark/sql/util/SchemaUtils.scala | Scala | apache-2.0 | 3,513 |
/* Title: Pure/Isar/outer_syntax.scala
Author: Makarius
Isabelle/Isar outer syntax.
*/
package isabelle
import scala.collection.mutable
object Outer_Syntax
{
/* syntax */
val empty: Outer_Syntax = new Outer_Syntax()
def init(): Outer_Syntax = new Outer_Syntax(completion = Completion.init())
... | larsrh/libisabelle | modules/pide/2017/src/main/scala/Isar/outer_syntax.scala | Scala | apache-2.0 | 5,463 |
/*
* 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/ct600/v3/B165.scala | Scala | apache-2.0 | 949 |
/*
* 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 ... | hortonworks/spark-native-yarn | src/main/scala/org/apache/spark/tez/VertexResultTask.scala | Scala | apache-2.0 | 4,014 |
package lila.tournament
import org.joda.time.DateTime
private[tournament] case class WaitingUsers(
hash: Map[String, DateTime],
clock: Option[chess.Clock],
date: DateTime) {
// 1+0 -> 8 -> 10
// 3+0 -> 16 -> 16
// 5+0 -> 24 -> 24
// 10+0 -> 44 -> 35
private val waitSeconds = {
(clock.fo... | r0k3/lila | modules/tournament/src/main/WaitingUsers.scala | Scala | mit | 1,400 |
package mesosphere.mesos
import com.google.common.collect.Lists
import mesosphere.marathon.MarathonSpec
import mesosphere.marathon.Protos.{ Constraint, MarathonTask }
import mesosphere.marathon.state.PathId._
import mesosphere.marathon.state.{ AppDefinition, Container, PathId, Timestamp }
import mesosphere.marathon.st... | 14Zen/marathon | src/test/scala/mesosphere/mesos/TaskBuilderTest.scala | Scala | apache-2.0 | 18,827 |
package mesosphere.marathon
package core.launcher.impl
import akka.Done
import mesosphere.UnitTest
import mesosphere.marathon.test.SettableClock
import mesosphere.marathon.core.instance.TestInstanceBuilder._
import mesosphere.marathon.core.instance.update.{InstanceUpdateEffect, InstanceUpdateOperation}
import mesosphe... | gsantovena/marathon | src/test/scala/mesosphere/marathon/core/launcher/impl/OfferProcessorImplTest.scala | Scala | apache-2.0 | 10,044 |
/* sbt -- Simple Build Tool
* Copyright 2008, 2009, 2010 Mark Harrah
*/
package sbt
package classpath
import java.lang.ref.{ Reference, SoftReference, WeakReference }
import java.io.File
import java.net.{ URI, URL, URLClassLoader }
import java.util.Collections
import scala.collection.{ mutable, JavaConversions, Set ... | twitter-forks/sbt | util/classpath/src/main/scala/sbt/classpath/ClasspathUtilities.scala | Scala | bsd-3-clause | 5,305 |
package com.eevolution.context.dictionary.domain.api.service
import com.eevolution.context.dictionary.api
import com.eevolution.context.dictionary.domain.model.PrintTableFormat
/**
* Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
* This program is free software: you can redistr... | adempiere/ADReactiveSystem | dictionary-api/src/main/scala/com/eevolution/context/dictionary/domain/api/service/PrintTableFormatService.scala | Scala | gpl-3.0 | 1,246 |
/*
* 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 ... | bowenli86/flink | flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/plan/stream/sql/join/WindowJoinTest.scala | Scala | apache-2.0 | 14,947 |
package algorithms.greedy
import org.scalatest.FunSuite
import GreedyFlorist._
/**
* Created by yujieshui on 2017/5/12.
*/
class GreedyFloristTest extends FunSuite {
test("0") {
println(solution(Seq(2, 5, 6), 3))
}
test("1"){
println(solution(Seq(2, 5, 6), 2))
}
}
| 1178615156/hackerrank | src/test/scala/algorithms/greedy/GreedyFloristTest.scala | Scala | apache-2.0 | 287 |
package fr.univ_lille.cristal.emeraude.chasqui.core.synchronization
import akka.actor.{Actor, ActorRef, ActorSystem, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider, Props}
import akka.util.Timeout
import fr.univ_lille.cristal.emeraude.chasqui.core.Node.ReceiveMessage
import fr.univ_lille.cristal.emer... | guillep/chasqui | src/main/scala/fr/univ_lille/cristal/emeraude/chasqui/core/synchronization/GlobalSynchronizerWithGlobalQueueStrategy.scala | Scala | mit | 4,739 |
package beam.sim.vehiclesharing
import beam.agentsim.agents.vehicles.{BeamVehicle, BeamVehicleType}
import beam.agentsim.events.SpaceTime
import beam.agentsim.infrastructure.taz.{TAZ, TAZTreeMap}
import beam.router.BeamSkimmer
import beam.router.Modes.BeamMode
import beam.sim.BeamServices
import org.matsim.api.core.v01... | colinsheppard/beam | src/main/scala/beam/sim/vehiclesharing/AvailabilityBasedRepositioning.scala | Scala | gpl-3.0 | 5,897 |
package tethys.readers
import org.scalatest.matchers.should.Matchers
import org.scalatest.flatspec.AnyFlatSpec
import tethys.JsonReader
import tethys.commons.{Token, TokenNode}
import tethys.commons.TokenNode._
import tethys.readers.JsonReaderBuilderTest._
import tethys.readers.tokens.QueueIterator
class JsonReaderBu... | tethys-json/tethys | modules/core/src/test/scala/tethys/readers/JsonReaderBuilderTest.scala | Scala | apache-2.0 | 4,412 |
package fpinScala.fpErrors.Option
sealed trait Option[+A]
case class Some[+A] (get: A) extends Option[+A]
case object None extends Option[Nothing]
def mean(xs: Seq[Double]): Option[Double] = {
if (xs.isEmpty) None
else Some(xs.sum / xs.length)
}
def map[B](f: A => B): Option[B] = this match{
case None =>... | Tomcruseal/FunctionalLearn | fpinscala/src/main/scala/fpinScala/fpErrors/Option.scala | Scala | mit | 2,921 |
package com.github.agourlay.cornichon.steps.wrapped
import cats.data.{ NonEmptyList, StateT }
import cats.effect.IO
import com.github.agourlay.cornichon.core._
import com.github.agourlay.cornichon.core.Done._
case class RepeatStep(nested: List[Step], occurrence: Int, indexName: Option[String]) extends WrapperStep {
... | agourlay/cornichon | cornichon-core/src/main/scala/com/github/agourlay/cornichon/steps/wrapped/RepeatStep.scala | Scala | apache-2.0 | 3,032 |
package db.generators
import db.Authorization
import io.apibuilder.api.v0.models.{GeneratorForm, GeneratorService, GeneratorServiceForm, GeneratorWithService}
import io.apibuilder.generator.v0.models.Generator
import java.util.UUID
trait Helpers extends db.Helpers {
def createGeneratorService(
form: GeneratorS... | apicollective/apibuilder | api/test/db/generators/Helpers.scala | Scala | mit | 1,495 |
/**
* Copyright (c) 2002-2012 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j 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 Foundati... | dksaputra/community | cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/TraversalMatcherBuilder.scala | Scala | gpl-3.0 | 4,197 |
import android.support.test.runner.AndroidJUnit4
import com.github.aafa.model.User
import io.realm.RealmResults
import org.junit.Test
import org.junit.runner.RunWith
/**
* Created by Alexey Afanasev on 25.02.16.
*/
@RunWith(classOf[AndroidJUnit4])
class RealmTestCase extends AbstractRealmTestCase{
@Test
def c... | aafa/realm-sbt-plugin | realm-android/src/androidTest/scala/RealmTestCase.scala | Scala | mit | 1,136 |
/*
* 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 ... | ueshin/apache-spark | core/src/test/scala/org/apache/spark/BarrierStageOnSubmittedSuite.scala | Scala | apache-2.0 | 11,447 |
package eu.ace_design.island.game
import eu.ace_design.island.map.IslandMap
import eu.ace_design.island.stdlib.Biomes.{MANGROVE, BEACH, OCEAN}
import eu.ace_design.island.stdlib.PointOfInterests.{Hideout, Creek}
import eu.ace_design.island.stdlib.Resources._
import org.specs2.mock.Mockito
import org.specs2.mutable._
i... | ace-design/island | engine/src/test/scala/eu/ace_design/island/game/GameTest.scala | Scala | lgpl-3.0 | 9,492 |
/* Copyright 2009-2016 EPFL, Lausanne */
package leon
package genc
package ir
import PrimitiveTypes.{ PrimitiveType => PT, _ } // For desambiguation
import Literals._
import Operators._
import collection.mutable.{ Map => MutableMap }
trait NoEnv {
type Env = Unit
final val Ø = ()
}
/*
* Transform an IR into a... | regb/leon | src/main/scala/leon/genc/ir/Transformer.scala | Scala | gpl-3.0 | 6,509 |
/*
* 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/ResizeBilinearSpec.scala | Scala | apache-2.0 | 4,655 |
package pt1.week5
import breeze.linalg.DenseMatrix
import common.Propagation
object ShortRateLattice {
def generate(r0: Double, u: Double, d: Double, terms: Int): DenseMatrix[Double] = {
Propagation.propagateValueForward(r0, u, d, terms + 1)
}
}
| ligasgr/fe-and-rm | src/main/scala/pt1/week5/ShortRateLattice.scala | Scala | apache-2.0 | 256 |
package com.whitepages.kafka.concurrent.consumer
import com.whitepages.kafka.concurrent.Ack.{AckedMessage, Acknowledgement, AckableMessage}
import com.whitepages.kafka.concurrent._
import scala.concurrent.duration.FiniteDuration
import scala.concurrent._
class AsyncKafkaConsumer[T](
val ... | whitepages/concurrent-kafka-consumer | src/main/scala/com/whitepages/kafka/concurrent/consumer/AsyncKafkaConsumer.scala | Scala | apache-2.0 | 1,931 |
package io.github.mandar2812.PlasmaML.dynamics.diffusion
import breeze.linalg.{DenseMatrix, DenseVector, norm}
import io.github.mandar2812.dynaml.kernels.{LocalScalarKernel, SVMKernel}
import io.github.mandar2812.dynaml.models.gp.AbstractGPRegressionModel
import io.github.mandar2812.dynaml.optimization.GloballyOptimiz... | mandar2812/PlasmaML | mag-core/src/main/scala/io/github/mandar2812/PlasmaML/dynamics/diffusion/KernelRadialDiffusionModel.scala | Scala | lgpl-2.1 | 9,593 |
package com.radkrish.euler.problem19
import java.util.{Calendar, Date}
/**
* Topic - Counting Sundays
*
* Description -
*
* You are given the following information, but you may prefer to do some research for yourself.
*
* 1 Jan 1900 was a Monday.
* Thirty days has September,
* April, June and Novemb... | radkrish/scala-euler | src/main/scala-2.12/com/radkrish/euler/problem19/Problem19.scala | Scala | unlicense | 1,197 |
/**
* Angles
* Copyright (C) 2014 Sebastian Schelter
*
* 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.
*
* Thi... | sscdotopen/angles | src/main/scala/io/ssc/angles/pipeline/IndexArticles.scala | Scala | gpl-3.0 | 5,462 |
package com.github.pcejrowski.grasca
import java.time.Instant
import com.github.pcejrowski.grasca.model.render.RenderedValues
import com.github.pcejrowski.wiremock.WiremockServer
import com.github.tomakehurst.wiremock.client.WireMock.{aResponse, get, stubFor, urlMatching}
import org.scalatest.{FlatSpec, Matchers}
im... | pcejrowski/grasca | src/test/scala/com/github/pcejrowski/grasca/RenderAPITest.scala | Scala | mit | 1,821 |
package spark.storage
import java.io.{InputStream, OutputStream}
import java.nio.{ByteBuffer, MappedByteBuffer}
import java.util.concurrent.{ConcurrentHashMap, LinkedBlockingQueue}
import scala.collection.mutable.{ArrayBuffer, HashMap, HashSet, Queue}
import scala.collection.JavaConversions._
import akka.actor.{Acto... | hobinyoon/spark-0.7.0 | core/src/main/scala/spark/storage/BlockManager.scala | Scala | bsd-3-clause | 36,996 |
package io.finch.internal
import com.twitter.util.Try
import org.scalacheck.Gen
import org.scalacheck.Prop.forAll
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import org.scalatestplus.scalacheck.Checkers
class TooFastStringSpec extends AnyFlatSpec with Matchers with Checkers... | rpless/finch | core/src/test/scala/io/finch/internal/TooFastStringSpec.scala | Scala | apache-2.0 | 1,276 |
package gapt.examples.tip.prod
import gapt.expr._
import gapt.expr.ty.TBase
import gapt.proofs.context.update.InductiveType
import gapt.proofs.Sequent
import gapt.proofs.gaptic.{ Lemma, TacticsProof, _ }
object prop_15 extends TacticsProof {
// Sorts
ctx += TBase( "sk" )
// Inductive types
ctx += InductiveT... | gapt/gapt | examples/tip/prod/prop_15.scala | Scala | gpl-3.0 | 1,443 |
/*
* Copyright © 2014 TU Berlin ([email protected])
*
* 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... | emmalanguage/emma | emma-language/src/main/scala/org/emmalanguage/compiler/lang/core/Trampoline.scala | Scala | apache-2.0 | 4,237 |
package de.m7w3.signal
import java.security.SecureRandom
import org.whispersystems.signalservice.internal.util.Base64
package object Util {
def getSecret(size: Int): String = {
val secret = new Array[Byte](size)
SecureRandom.getInstance("SHA1PRNG").nextBytes(secret)
Base64.encodeBytes(secret)
}
} | ayoub-benali/signal-desktop-client | src/main/scala/de/m7w3/signal/Util.scala | Scala | apache-2.0 | 315 |
package com.krux.hyperion.examples
import com.krux.hyperion.Implicits._
import com.krux.hyperion.activity.{GoogleStorageDownloadActivity, ShellCommandActivity}
import com.krux.hyperion.datanode.S3DataNode
import com.krux.hyperion.expression.Parameter
import com.krux.hyperion.resource.Ec2Resource
import com.krux.hyperi... | sethyates/hyperion | examples/src/main/scala/com/krux/hyperion/examples/ExampleWorkflow.scala | Scala | apache-2.0 | 1,812 |
package org.openurp.edu.eams.teach.schedule.service.impl
import org.beangle.commons.dao.impl.BaseServiceImpl
import org.beangle.data.jpa.dao.OqlBuilder
import org.openurp.base.Department
import org.openurp.base.Semester
import org.openurp.edu.base.Project
import org.openurp.edu.base.code.StdType
import org.openurp.e... | openurp/edu-eams-webapp | schedule/src/main/scala/org/openurp/edu/eams/teach/schedule/service/impl/CourseTableCheckServiceImpl.scala | Scala | gpl-3.0 | 2,552 |
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.mllib.classification.NaiveBayes
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.util.MLUtils
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.SparkContext
import org.apache.spark.mllib.tree.... | SubhasisDutta/JRC-Name-Parser | jrc-classification/src/Classification/classification.scala | Scala | apache-2.0 | 1,727 |
package com.twitter.algebird
import org.scalatestplus.scalacheck.ScalaCheckPropertyChecks
import org.scalacheck.{Arbitrary, Gen}
import Arbitrary.arbitrary
import org.scalatest.matchers.should.Matchers
import org.scalatest.propspec.AnyPropSpec
object Helpers {
implicit def arbitraryBatched[A: Arbitrary]: Arbitrary[... | twitter/algebird | algebird-test/src/test/scala/com/twitter/algebird/BatchedTest.scala | Scala | apache-2.0 | 2,243 |
// Code adapted from github.com/dscleaver/sbt-quickfix. Those portions
// Copyright (c) 2013 David Cleaver; All rights reserved.
package zmre.sbt
import sbt._
import Keys._
// scalastyle:off
object SbtVimAsyncIntegrationPlugin extends AutoPlugin {
object autoImport {
val vimIntegrationLogDirectory = SettingKey... | zmre/sbt-vim-async-integration | src/main/scala/zmre/sbt/SbtVimAsyncIntegration.scala | Scala | apache-2.0 | 2,614 |
/*
* Copyright 2013 Stephane Godbillon (@sgodbillon)
*
* 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... | qubell/ReactiveMongo | bson/src/main/scala/types.scala | Scala | apache-2.0 | 22,163 |
package org.scalafmt.config
import metaconfig._
/** Configuration for scalafmt optimizations.
*
* @param dequeueOnNewStatements
* Clear the search queue on new statements.
* @param escapeInPathologicalCases
* Use heuristics to escape when the search state grows out of bounds.
*
* An optimization tha... | scalameta/scalafmt | scalafmt-core/shared/src/main/scala/org/scalafmt/config/ScalafmtOptimizer.scala | Scala | apache-2.0 | 3,388 |
package provingground.learning
import provingground._, HoTT._
import GeneratorVariables._, Expression._, TermRandomVars._, GeneratorNode._,
TermGeneratorNodes._
import provingground.learning.Sort.All
import provingground.learning.Sort.Filter
import provingground.learning.Sort.Restrict
import scala.collection.parallel.... | siddhartha-gadgil/ProvingGround | jvmcore/src/main/scala/provingground/learning/DerivedEquations.scala | Scala | mit | 36,773 |
package views.html
import play.twirl.api._
import play.twirl.api.TemplateMagic._
import play.api.templates.PlayMagic._
import models._
import controllers._
import java.lang._
import java.util._
import scala.collection.JavaConversions._
import scala.collection.JavaConverters._
import play.api.i18n._
import play.core.... | cwrobertson/WebApp | target/scala-2.10/twirl/main/views/html/RubyPage.template.scala | Scala | mit | 4,194 |
/**
* Copyright 2015, deepsense.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... | deepsense-io/seahorse-workflow-executor | deeplang/src/main/scala/io/deepsense/deeplang/utils/aggregators/AggregatorBatch.scala | Scala | apache-2.0 | 2,068 |
package com.ilroberts
object Messages {
sealed trait MessageComponents
case class MessageHeader(messageType: String) extends MessageComponents
case class MessageBody(body: String) extends MessageComponents
sealed trait Message
case class BasicMessage(header: MessageHeader, body: MessageBody) extends Messa... | ilroberts/KafkaConsumerService | src/main/scala/com/ilroberts/Messages.scala | Scala | mit | 361 |
package com.twitter.finatra.multiserver.Add2HttpServer
import com.twitter.finagle.http.{Request, Status}
import com.twitter.finatra.http.Controller
import com.twitter.finatra.http.response.ResponseBuilder
import com.twitter.finatra.httpclient.{HttpClient, RequestBuilder}
import com.twitter.util.Future
import javax.inj... | twitter/finatra | inject-thrift-client-http-mapper/src/test/scala/com/twitter/finatra/multiserver/Add2HttpServer/Add2Controller.scala | Scala | apache-2.0 | 943 |
// 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
// distributed unde... | cloudant-labs/clouseau | src/main/scala/com/cloudant/clouseau/Main.scala | Scala | apache-2.0 | 2,215 |
package com.taig.tmpltr.engine
import play.api.mvc.Content
import com.taig.tmpltr.markup
package object html
{
implicit def bodyFromContent( content: Content ): markup.body = body( content )
implicit def headFromContent( content: Content ): markup.head = head( content )
} | Taig/Play-Tmpltr | app/com/taig/tmpltr/engine/html/package.scala | Scala | mit | 277 |
/*
* 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 ... | pronix/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala | Scala | apache-2.0 | 8,568 |
package breeze.linalg
/**
* A Euclidean distance metric implementation between two points
*/
object euclideanDistance extends NormBasedDistance {
override protected def normConstant: Double = 2.0
}
| scalanlp/breeze | math/src/main/scala/breeze/linalg/functions/euclideanDistance.scala | Scala | apache-2.0 | 203 |
package memnets.models.neuro.swta.fsm
import memnets.model.Activation._
import memnets.model._
class Transition private[fsm] (val src: State, val tgt: State, val input: Y)(implicit sys: DynamicSystem) {
val gate = Y(
name = s"${src.y.id} > ${tgt.y.id}",
// name = s"${src.name}>${tgt.name}",
decay = 0... | MemoryNetworks/memnets | models/src/main/scala/memnets/models/neuro/swta/fsm/Transition.scala | Scala | apache-2.0 | 438 |
/** Copyright 2015 TappingStone, 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 ... | nvoron23/PredictionIO | core/src/main/scala/controller/java/JavaUtils.scala | Scala | apache-2.0 | 1,279 |
/*
* Copyright 1998-2016 Linux.org.ru
* 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... | fat0troll/lorsource | src/main/scala/ru/org/linux/user/RemarkDao.scala | Scala | apache-2.0 | 4,409 |
/*
* Copyright 2014 DataGenerator Contributors
*
* 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... | FINRAOS/DataGenerator | dg-common/src/main/scala/org/finra/datagenerator/common/NodeData/NodeDataType.scala | Scala | apache-2.0 | 12,031 |
package scala.pickling.pickler
import scala.pickling._
import PicklingErrors.NothingIsNotUnpicklable
trait NothingPicklers {
implicit object NothingPicklerUnpickler extends AbstractPicklerUnpickler[Nothing] {
override def tag: FastTypeTag[Nothing] = FastTypeTag.Nothing
/** Impossible to call in Scala, no va... | scala/pickling | core/src/main/scala/scala/pickling/pickler/Nothing.scala | Scala | bsd-3-clause | 600 |
/*
* Copyright (c) 2014 Mario Pastorelli ([email protected])
*
* 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 re... | lambdista/shapeless | examples/src/main/scala/shapeless/examples/csv.scala | Scala | apache-2.0 | 4,631 |
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package docs.home.scaladsl.immutable
//#immutable
final case class ImmutableUser(name: String, email: String)
//#immutable
| lagom/lagom | docs/manual/scala/concepts/code/docs/home/scaladsl/immutable/ImmutableUser.scala | Scala | apache-2.0 | 192 |
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.