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 |
|---|---|---|---|---|---|
package gitbucket.core.util
import com.typesafe.config.ConfigFactory
import java.io.File
import Directory._
import liquibase.database.AbstractJdbcDatabase
import liquibase.database.core.{PostgresDatabase, MySQLDatabase, H2Database}
import org.apache.commons.io.FileUtils
object DatabaseConfig {
private lazy val con... | zhoffice/gitbucket | src/main/scala/gitbucket/core/util/DatabaseConfig.scala | Scala | apache-2.0 | 3,347 |
/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api.libs.typedmap
/**
* A TypedKey is a key that can be used to get and set values in a
* [[TypedMap]] or any object with typed keys. This class uses reference
* equality for comparisons, so each new instance is different key... | Shenker93/playframework | framework/src/play/src/main/scala/play/api/libs/typedmap/TypedKey.scala | Scala | apache-2.0 | 1,928 |
package im.actor.server.presences
import akka.actor.PoisonPill
import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import akka.testkit.TestProbe
import akka.util.Timeout
import org.scalatest.time.{ Seconds, Span }
import im.actor.server.ActorSuite
import im.actor.server.db.DbExtension
class... | darioajr/actor-platform | actor-server/actor-tests/src/test/scala/im/actor/server/presences/GroupPresenceManagerSpec.scala | Scala | mit | 3,259 |
package chapter.twelve
object ExerciseNine {
def corresponds2[A, B](as: Array[A], bs: Array[B], fun: (A, B) => Boolean): Boolean = {
(as zip bs).map(tuple => fun(tuple._1, tuple._2)).reduce(_ & _)
}
}
| deekim/impatient-scala | src/main/scala/chapter/twelve/ExerciseNine.scala | Scala | apache-2.0 | 212 |
package com.boldradius.astrolabe.client.services
import com.boldradius.astrolabe.http.ClusterProtocol
import org.scalajs.dom
import org.scalajs.dom.raw._
import upickle.default._
import com.boldradius.astrolabe.http.Json._
object WebSocketClient {
var open: Boolean = false
lazy val websocket = new WebSocket(get... | boldradius/cluster-console | js/src/main/scala/com/boldradius/astrolabe/client/services/WebSocketClient.scala | Scala | bsd-3-clause | 1,045 |
/*******************************************************************************
* Copyright (c) 2016 Logimethods
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* http://open... | Logimethods/docker-nats-connector-spark | inject/user-files/simulations/nats/NatsStreamingInjection.scala | Scala | mit | 1,418 |
/*
* Copyright 2014 Commonwealth Computer Research, 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 applicabl... | kevinwheeler/geomesa | geomesa-core/src/main/scala/org/locationtech/geomesa/core/security/FilteringAuthorizationsProvider.scala | Scala | apache-2.0 | 1,762 |
/*
* @author Philip Stutz
* @author Mihaela Verman
*
* Copyright 2013 University of Zurich
*
* 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/li... | hicolour/triplerush | src/main/scala/com/signalcollect/triplerush/QueryParticle.scala | Scala | apache-2.0 | 12,608 |
//
// Copyright 2016 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 ... | CommBank/coppersmith | scalding/src/main/scala/commbank/coppersmith/scalding/lift/ScaldingScalazInstances.scala | Scala | apache-2.0 | 1,048 |
/*
* 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 ... | style95/openwhisk | common/scala/src/main/scala/org/apache/openwhisk/core/database/s3/S3AttachmentStore.scala | Scala | apache-2.0 | 10,100 |
package io.getquill.monad
import scala.language.higherKinds
import scala.collection.compat._
import language.experimental.macros
import io.getquill.context.Context
import scala.annotation.tailrec
import scala.util.Try
import io.getquill.{ Action, ActionReturning, BatchAction, Query, Quoted }
trait SyncIOMonad extend... | getquill/quill | quill-core/src/main/scala/io/getquill/monad/SyncIOMonad.scala | Scala | apache-2.0 | 2,256 |
/*
* 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/ems | web/src/main/scala/org/beangle/ems/portal/admin/action/bulletin/NewsAction.scala | Scala | lgpl-3.0 | 929 |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2015-2021 Andre White.
*
* 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
*
* https://www.apache.org/licenses/LICENSE... | adarro/ddo-calc | subprojects/common/ddo-core/src/test/scala/io/truthencode/ddo/IntegrationIT.scala | Scala | apache-2.0 | 1,010 |
/*
* 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 ... | Panos-Bletsos/spark-cost-model-optimizer | sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamMetadata.scala | Scala | apache-2.0 | 3,118 |
/*
* 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 ... | mike0sv/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala | Scala | apache-2.0 | 54,172 |
package com.boldradius.cqrs
import akka.actor.ActorRef
import akka.pattern.ask
import akka.util.Timeout
import com.boldradius.cqrs.AuctionCommandQueryProtocol._
import com.boldradius.util.LLogging
import org.joda.time.format.DateTimeFormat
import spray.routing._
import scala.concurrent.ExecutionContext
import scala.c... | ceecer1/akka-dddd-template | src/main/scala/com/boldradius/cqrs/HttpAuctionServiceRoute.scala | Scala | apache-2.0 | 5,332 |
package asobu.distributed.service
import asobu.distributed.protocol.DRequest
import asobu.dsl.Extractor
package object extractors {
type DRequestExtractor[T] = Extractor[DRequest, T]
}
| iheartradio/asobu | distributed/src/main/scala/asobu/distributed/service/extractors/package.scala | Scala | apache-2.0 | 189 |
/*
* 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... | wangyixiaohuihui/spark2-annotation | mllib/src/test/scala/org/apache/spark/mllib/classification/NaiveBayesSuite.scala | Scala | apache-2.0 | 14,225 |
/**
* Swaggy Jenkins
* Jenkins API clients generated from Swagger / Open API specification
*
* The version of the OpenAPI document: 1.1.2-pre.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not ed... | cliffano/swaggy-jenkins | clients/scala-lagom-server/generated/src/main/scala/io/swagger/client/model/ExtensionClassContainerImpl1.scala | Scala | mit | 741 |
package org.jetbrains.plugins.scala
package lang
package psi
package impl
package base
package patterns
import com.intellij.lang.ASTNode
import com.intellij.psi._
import com.intellij.psi.scope.PsiScopeProcessor
import org.jetbrains.plugins.scala.extensions.{PsiTypeExt, ifReadAllowed}
import org.jetbrains.plugins.scala... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/lang/psi/impl/base/patterns/ScTypedPatternImpl.scala | Scala | apache-2.0 | 4,884 |
package com.eevolution.context.dictionary.infrastructure.repository
import java.util.UUID
import com.eevolution.context.dictionary.domain._
import com.eevolution.context.dictionary.domain.model.WorkflowNodeNext
import com.eevolution.context.dictionary.infrastructure.db.DbContext._
import com.eevolution.utils.Paginate... | adempiere/ADReactiveSystem | dictionary-impl/src/main/scala/com/eevolution/context/dictionary/infrastructure/repository/WorkflowNodeNextRepository.scala | Scala | gpl-3.0 | 2,871 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); yo... | yahoo/kafka-manager | app/kafka/manager/utils/two40/MemberMetadata.scala | Scala | apache-2.0 | 3,610 |
package com.github.log0ymxm.mapper
import java.io.{ BufferedWriter, File, FileWriter }
import breeze.linalg.DenseMatrix
import breeze.linalg
import org.apache.spark.mllib.linalg.distributed.{ CoordinateMatrix, IndexedRow, IndexedRowMatrix }
import org.apache.spark.rdd.RDD
import org.apache.spark.SparkContext
import o... | log0ymxm/spark-mapper | src/main/scala/com/github/log0ymxm/mapper/Mapper.scala | Scala | apache-2.0 | 7,485 |
package com.meteorcode.pathway.graphics
/**
* ==Pathway Graphics Context==
*
* This object provides the Pathway Graphics API to JavaScript.
*
* Created by hawk on 9/21/15.
*/
class GraphicsContext {
// TODO: Implement me
}
| MeteorCode/Pathway | src/main/scala/com/meteorcode/pathway/graphics/GraphicsContext.scala | Scala | mit | 234 |
package com.atomist.tree.pathexpression
import com.atomist.rug.BadRugSyntaxException
import org.scalatest.{FlatSpec, Matchers}
class PathExpressionParserTest extends FlatSpec with Matchers {
val pep = PathExpressionParser
it should "parse a bare root node" in {
val pe = "/"
val parsed = pep.parsePathExp... | atomist/rug | src/test/scala/com/atomist/tree/pathexpression/PathExpressionParserTest.scala | Scala | gpl-3.0 | 9,891 |
/**
* 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... | lindong28/kafka | core/src/main/scala/kafka/controller/KafkaController.scala | Scala | apache-2.0 | 142,541 |
package dk.bayes.math.linear
import breeze.linalg.DenseMatrix
import breeze.linalg.inv
object invchol {
/**
* @param R, where R'*R= A, cholesky decomposition
*/
def apply(R:DenseMatrix[Double]):DenseMatrix[Double] = {
val Rinv = inv(R)
Rinv*Rinv.t
}
} | danielkorzekwa/bayes-scala | src/main/scala/dk/bayes/math/linear/invchol.scala | Scala | bsd-2-clause | 284 |
import sbt._
object Dependencies {
val akkaVersion = "2.3.9"
val sprayVersion = "1.3.2"
val osgiVersion = "5.0.0"
val typesafeConfig = "com.typesafe" % "config" % "1.2.1"
val osgiCore = "org.osgi" % "org.osgi.core" % osgiVersion
val o... | rkrzewski/spray-osgi | project/Dependencies.scala | Scala | apache-2.0 | 1,046 |
package org.workcraft.plugins.fsm
import java.awt.geom.Point2D
import org.workcraft.dom.visual.connections.StaticVisualConnectionData
import scalaz.NonEmptyList
sealed trait Node
class State extends Node
class Arc(val from: State, val to: State) extends Node
case class FSM(states: NonEmptyList[State], ar... | mechkg/workcraft | FSMPlugin/src/main/scala/org/workcraft/plugins/fsm/FSM.scala | Scala | gpl-3.0 | 1,348 |
package com.cloudray.scalapress.util.mvc.interceptor
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import org.springframework.web.servlet.ModelAndView
import com.cloudray.scalapress.framework.{ScalapressRequest, ScalapressCo... | vidyacraghav/scalapress | src/main/scala/com/cloudray/scalapress/util/mvc/interceptor/SiteInterceptor.scala | Scala | apache-2.0 | 892 |
package pl.touk.nussknacker.engine.component
import pl.touk.nussknacker.engine.api.component.ComponentType
import pl.touk.nussknacker.engine.api.component.NodeComponentInfo
import pl.touk.nussknacker.engine.compiledgraph.node._
import pl.touk.nussknacker.engine.graph.node.{NodeData, WithComponent}
// TODO this logic ... | TouK/nussknacker | interpreter/src/main/scala/pl/touk/nussknacker/engine/component/NodeComponentInfoExtractor.scala | Scala | apache-2.0 | 2,475 |
package net.codejitsu.tasks.dsl
import org.scalatest.{FlatSpec, Matchers}
class PipeToTest extends FlatSpec with Matchers {
import net.codejitsu.tasks._
import net.codejitsu.tasks.dsl.Tasks._
import scala.concurrent.duration._
implicit val timeout = 30 seconds
implicit val stage = new Dev
"pipeTo" sho... | codejitsu/tasks | tasks-dsl/src/test/scala/PipeToTest.scala | Scala | apache-2.0 | 728 |
package com.zenaptix.dsl
case class Cqsf602w (cqnf602wStlnCommonDtls:Cqnf602wStlnCommonDtls, cqnf602StudentLoanDtl:Cqnf602StudentLoanDtl)
case class Cqnf602wStlnCommonDtls (cqnf602wKey:Cqnf602wKey, cqnf602wCifk:Cqnf602wCifk)
case class Cqnf602wKey (cqnf602wAcctNo:Long)
case class Cqnf602wCifk (cqnf602wCifkey:String)
ca... | zenaptix-lab/copybookStreams | src/main/scala/com/zenaptix/dsl/Cqsf602w.scala | Scala | apache-2.0 | 577 |
package com.wavesplatform.utils.doc
import com.wavesplatform.lang.v1.compiler.Types._
import scala.jdk.CollectionConverters._
abstract class TypeDoc {
val name: String
val isUnion: Boolean = false
val isObj: Boolean = false
val isNative: Boolean = false
val haveParam: Boolean = false
val isComplex... | wavesplatform/Waves | lang/doc/src/main/scala/com/wavesplatform/utils/doc/MustacheDoc.scala | Scala | mit | 4,025 |
package com.github.sorhus.hmmongo.scalatra
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.DefaultServlet
import org.eclipse.jetty.webapp.WebAppContext
import org.scalatra.servlet.ScalatraListener
/**
* args == {pi, A, B, T}
*/
object Main extends App {
val port = 8080
val server = new S... | sorhus/hmmongo | scalatra/src/main/scala/com/github/sorhus/hmmongo/scalatra/Main.scala | Scala | gpl-2.0 | 752 |
val grid = List(
List(8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8),
List(49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0),
List(81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65),
List(52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, ... | brandonhorst/project-euler-scala | 011.scala | Scala | mit | 2,452 |
package com.socrata.datacoordinator.truth.metadata
import com.socrata.datacoordinator.id._
import com.socrata.soql.environment.{ColumnName, ResourceName}
import scala.concurrent.duration.Duration
trait DatasetMapBase[CT] extends `-impl`.BaseDatasetMapReader[CT] {
}
trait DatasetMapReader[CT] extends DatasetMapBase[C... | socrata-platform/data-coordinator | coordinatorlib/src/main/scala/com/socrata/datacoordinator/truth/metadata/DatasetMap.scala | Scala | apache-2.0 | 7,531 |
package org.scalamu.core.coverage
import org.scalamu.common.position.Position
import scoverage.Location
/**
* A single source level statement instrumented by scoverage plugin.
*
* @param id scoverage statement id
* @param pos statement's offset in source
*/
final case class Statement(id: StatementId, location: L... | sugakandrey/scalamu | core/src/main/scala/org/scalamu/core/coverage/Statement.scala | Scala | gpl-3.0 | 344 |
package com.crobox.clickhouse.dsl.language
import com.crobox.clickhouse.DslTestSpec
import com.crobox.clickhouse.dsl._
class TypeCaseFunctionTokenizerTest extends DslTestSpec {
it should "succeed for UUID functions" in {
toSQL(select(toUUID(const("00000000-0000-0000-0000-000000000000")))) shouldBe "SELECT toUU... | crobox/clickhouse-scala-client | dsl/src/test/scala/com/crobox/clickhouse/dsl/language/TypeCaseFunctionTokenizerTest.scala | Scala | lgpl-3.0 | 538 |
package org.jetbrains.plugins.scala
package lang
package psi
package impl
package statements
import com.intellij.lang.ASTNode
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.util.Key
import com.intellij.psi._
import com.intellij.psi.tree.IElementType
import org.jetbrains.plugins.scala.... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/lang/psi/impl/statements/ScFunctionDefinitionImpl.scala | Scala | apache-2.0 | 4,861 |
package net.totietje.evaluator
/** An `Evaluator` is a string parser and evaluator.
*
* This class is flexible, allowing a user to define their own syntax. An example use might be to parse maths
* expressions, such as `(1 + 2) ^ 3`.
*
* @see [[net.totietje.complex.ComplexEvaluator ComplexEvaluator]]
* @tpa... | totietje/Evaluator | src/main/scala/net/totietje/evaluator/Evaluator.scala | Scala | apache-2.0 | 788 |
package almanac.spark
import almanac.model.Metric.Key
import almanac.model.TimeSpan.EVER
import almanac.model._
import almanac.spark.MetricsAggregator._
import org.apache.spark.rdd.RDD
import org.apache.spark.streaming._
import org.apache.spark.streaming.dstream.DStream
object SparkMetricsAggregator {
implicit cla... | adcade/almanac-oss | src/main/scala/almanac/spark/SparkAggregator.scala | Scala | mit | 3,512 |
package com.github.timgilbert.hexmap
import org.scalatra.test.specs2._
class HelloWorldMutableServletSpec extends MutableScalatraSpec {
addServlet(classOf[HexMapServlet], "/*")
"GET / on HexMapServlet" should {
"return status 200" in {
get("/") {
status must_== 200
}
}
}
}
| timgilbert/scala-hexmap | src/test/scala/ServletTests.scala | Scala | mit | 313 |
package springboard
import java.net.URL
import java.util.concurrent.ExecutorService
import akka.actor.{Actor, ActorSystem, Props}
import akka.http.scaladsl.model.HttpHeader.ParsingResult.Ok
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Keep, RunnableGraph, Sink, Source, SourceQueue}
import akka.ut... | defpearlpilot/webcrawler | app/springboard/Application2.scala | Scala | gpl-3.0 | 1,880 |
package pl.touk.nussknacker.engine.requestresponse
import io.circe.Json
import pl.touk.nussknacker.engine.requestresponse.api.ResponseEncoder
import pl.touk.nussknacker.engine.util.json.BestEffortJsonEncoder
object DefaultResponseEncoder extends ResponseEncoder[Any] {
private val bestEffortEncoder = BestEffortJson... | TouK/nussknacker | engine/lite/request-response/runtime/src/main/scala/pl/touk/nussknacker/engine/requestresponse/DefaultResponseEncoder.scala | Scala | apache-2.0 | 480 |
package com.yetu.oauth2provider.utils
import com.yetu.oauth2provider.base.BaseSpec
class StringUtilsSpec extends BaseSpec {
"When isEmpty method receives a value " must {
"return false when string contains no value" in {
StringUtils.isFull(Some("")) mustBe false
}
"return false when string conta... | yetu/oauth2-provider | test/com/yetu/oauth2provider/utils/StringUtilsSpec.scala | Scala | mit | 2,734 |
def main (args: Array[String]) {
lazy val a = "Hello, World!"
val s = a _
/*start*/s/*end*/
}
//() => String | LPTK/intellij-scala | testdata/typeInference/expected/param/LazyValUnderscore.scala | Scala | apache-2.0 | 114 |
import java.util.concurrent.atomic.AtomicInteger
import sbt._
import sbt.Keys._
import sbtjooq.codegen.JooqCodegenKeys._
import sbtjooq.codegen.JooqCodegenPlugin
object CheckCalled extends AutoPlugin {
override def requires: Plugins = JooqCodegenPlugin
override def trigger: PluginTrigger = allRequirements
obj... | kxbmap/sbt-jooq | codegen/src/sbt-test/jooq-codegen/features/src/sbt-test/codegen/skip/project/CheckCalled.scala | Scala | apache-2.0 | 837 |
package dk.gp.hgpr
import breeze.linalg.DenseMatrix
import breeze.linalg.DenseVector
import breeze.numerics.exp
import dk.bayes.math.gaussian.canonical.DenseCanonicalGaussian
import dk.gp.hgpr.util.HgprFactorGraph
import dk.gp.gp.GPPredictSingle
import dk.bayes.math.gaussian.Gaussian
import dk.bayes.math.gaussian.Mult... | danielkorzekwa/bayes-scala-gp | src/main/scala/dk/gp/hgpr/hgprPredict.scala | Scala | bsd-2-clause | 3,871 |
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
*
* 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 progr... | wireapp/wire-android-sync-engine | zmessaging/src/main/scala/com/waz/model/FCMNotification.scala | Scala | gpl-3.0 | 1,600 |
/*
* Licensed to Intel Corporation under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* Intel Corporation licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use t... | SeaOfOcean/BigDL | dl/src/main/scala/com/intel/analytics/bigdl/dataset/image/HFlip.scala | Scala | apache-2.0 | 1,524 |
/*
* Copyright Β© 2015 Reactific Software LLC. All Rights Reserved.
*
* 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 us... | reactific/RxMongo | client/src/test/scala/rxmongo/client/CollStatsSpec.scala | Scala | mit | 3,182 |
/***********************************************************************
* Copyright (c) 2013-2022 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... | locationtech/geomesa | geomesa-index-api/src/test/scala/org/locationtech/geomesa/index/filters/Z3FilterTest.scala | Scala | apache-2.0 | 2,449 |
package au.id.cxd.math.function.moments
/*
the empirical mean of a sequence assuming normality
*/
class Mean {
/**
* compute the empirical mean of a sequence
*
* @param series
* @return
*/
def op(series: Seq[Double]): Double = {
val n = series.length
val total = series.reduce(_ + _)
... | cxd/scala-au.id.cxd.math | math/src/main/scala/au/id/cxd/math/function/moments/Mean.scala | Scala | mit | 419 |
package army
sealed trait Soldier
case class Robot(battery: Int) extends Soldier
case class Human(life: Int,
maybeRobot: Option[Robot] = None) extends Soldier
object Army extends App {
import implicits._
val army = 3.soldiers.recruit
printArmy(army)
// only robots
// 5.robots.recruit
... | rabbitonweb/scala_implicits_exercise | src/main/scala/army/Army.scala | Scala | gpl-3.0 | 467 |
/**
* For copyright information see the LICENSE document.
*/
import entice.server._
import entice.server.scripting._
import entice.server.utils._
import entice.server.world._
import entice.protocol._
import akka.actor._
import shapeless._
import scala.util._
class Buddy extends Command {
var buddies: List[Act... | entice/old-server | scripts/commands/Buddy.scala | Scala | bsd-3-clause | 2,693 |
package blended.launcher.jvmrunner
import java.io.{IOException, InputStream, OutputStream}
private[jvmrunner]
class RunningProcess(process: Process, errorsIntoOutput: Boolean, interactive: Boolean) {
private[this] val errThread = asyncCopy(process.getErrorStream, if (errorsIntoOutput) Console.out else Console.err)... | lefou/blended | blended.launcher/src/main/scala/blended/launcher/jvmrunner/RunningProcess.scala | Scala | apache-2.0 | 2,665 |
package fly.play.aws.auth
import org.specs2.mutable.Before
import org.specs2.mutable.Specification
import play.api.Play.current
import play.api.test.FakeApplication
import testUtils.RunningFakePlayApplication
object AwsCredentialsSpec extends Specification with RunningFakePlayApplication {
"AwsCredentials" should ... | fooblahblah/play-aws-utils | src/test/scala/fly/play/aws/auth/AwsCredentialsSpec.scala | Scala | mit | 1,004 |
// Copyright (C) 2009 The Android Open Source 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 ... | gkossakowski/gimd | src/main/scala/com/google/gimd/MessageBuffer.scala | Scala | apache-2.0 | 3,204 |
/* Copyright 2015 Matt Silbernagel
*
* 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... | silbermm/proximal | app/models/QuestionUpload.scala | Scala | apache-2.0 | 2,269 |
package scalariform.formatter
import scalariform.lexer.Tokens._
import scalariform.lexer._
import scalariform.parser._
import scalariform.utils._
import scalariform.formatter.preferences._
import PartialFunction._
import scalariform.ScalaVersions
trait HasHiddenTokenInfo {
def isInferredNewline(token: Token): Bool... | jkinkead/scalariform | scalariform/src/main/scala/scalariform/formatter/ScalaFormatter.scala | Scala | mit | 21,504 |
class foo(a: String) extends annotation.StaticAnnotation
object o {
implicit def i2s(i: Int) = ""
@foo(1: String) def blerg { }
}
| loskutov/intellij-scala | testdata/scalacTests/pos/t5892.scala | Scala | apache-2.0 | 134 |
/***********************************************************************
* Copyright (c) 2013-2019 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... | elahrvivaz/geomesa | geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/iterators/InfiniteIterator.scala | Scala | apache-2.0 | 1,343 |
object Test {
def main(args: Array[String]): Unit = {
println(rewrite("foo"))
println(rewrite("foo" + "foo"))
rewrite {
println("apply")
}
rewrite {
println("block")
println("block")
}
val b: Boolean = true
rewrite {
if b then println("then")
else prin... | som-snytt/dotty | tests/run-macros/expr-map-1/Test_2.scala | Scala | apache-2.0 | 2,000 |
package com.github.pedrovgs.kuronometer.free.interpreter.formatter
import com.github.pedrovgs.kuronometer.generators.BuildExecutionGenerators._
import org.scalatest.prop.PropertyChecks
import org.scalatest.{FlatSpec, Matchers}
import scala.concurrent.duration._
class DurationFormatterSpec
extends FlatSpec
wi... | pedrovgs/Kuronometer | kuronometer-core/src/test/scala/com/github/pedrovgs/kuronometer/free/interpreter/formatter/DurationFormatterSpec.scala | Scala | apache-2.0 | 2,074 |
package com.twitter.finatra.http
import com.fasterxml.jackson.databind.JsonNode
import com.google.common.net.{HttpHeaders => CommonHttpHeaders, MediaType}
import com.google.inject.Stage
import com.twitter.finagle.http.{Method, Status, _}
import com.twitter.finatra.json.{FinatraObjectMapper, JsonDiff}
import com.twitte... | syamantm/finatra | http/src/test/scala/com/twitter/finatra/http/EmbeddedHttpServer.scala | Scala | apache-2.0 | 40,401 |
package worker
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import akka.actor.ActorSystem
import akka.actor.PoisonPill
import akka.actor.Props
import akka.actor.RootActorPath
import akka.cluster.client.{ClusterClientReceptionist, ClusterClientSettings, ClusterClient}
import akka.cluster.... | typesafehub/activator-akka-distributed-workers | src/main/scala/worker/Main.scala | Scala | cc0-1.0 | 3,847 |
import scala.quoted._
def test(using QuoteContext) = {
given QuoteContext = ???
implicit def IntIsLiftable: Liftable[Int] = new {
def toExpr(n: Int) = n match {
case Int.MinValue => '{Int.MinValue}
case _ if n < 0 => '{- ${toExpr(n)}}
case 0 => '{0}
case _ if n %... | som-snytt/dotty | tests/pos/quote-liftable.scala | Scala | apache-2.0 | 950 |
package com.bowlingx.websocket.hazelcast
import com.hazelcast.core._
import org.atmosphere.util.AbstractBroadcasterProxy
import org.atmosphere.cpr._
import java.net.URI
import com.hazelcast.core.Hazelcast
import com.hazelcast.core.ITopic
import com.hazelcast.core.IMap
import com.hazelcast.core.MessageListener
import ... | BowlingX/scalatra-websockets | src/main/scala/com/bowlingx/websocket/hazelcast/HazelcastBroadcaster.scala | Scala | mit | 4,677 |
package be.cmpg.walk.fungus
import be.cmpg.graph.interaction.NetworkManager
import be.cmpg.graph.interaction.NodeCostNetworkManager
import be.cmpg.graph.Network
import be.cmpg.graph.Interaction
import be.cmpg.graph.Gene
import java.util.concurrent.Callable
import scala.collection.Set
import be.cmpg.expression.Expressi... | spulido99/SSA | src/test/scala/be/cmpg/walk/fungus/FungusTestFixme.scala | Scala | gpl-2.0 | 4,271 |
package controllers.s_care_you_provide
import controllers.mappings.AddressMappings._
import controllers.mappings.{AddressMappings, Mappings}
import controllers.s_your_partner.GYourPartnerPersonalDetails._
import models.yesNo.YesNoMandWithAddress
import play.api.Play._
import play.api.data.validation.{Valid, Validation... | Department-for-Work-and-Pensions/ClaimCapture | c3/app/controllers/s_care_you_provide/GTheirPersonalDetails.scala | Scala | mit | 6,423 |
package org.sstudio.bulldozer.dsl
object Assert {
private[this] var _code: Int = _
private[this] var _body: String = _
def code: Int = {
_code = Result.code
Result.code
}
def body: String = {
_body = Result.body
Result.body
}
def apply(expr: Long): Long = {
expr
}
} | avril23/bulldozer | bulldozer/src/main/scala/org/sstudio/bulldozer/dsl/Assert.scala | Scala | bsd-3-clause | 307 |
package dao
import java.sql.{Date, Time, Timestamp}
import javax.inject.Inject
import com.google.inject.Singleton
import models.Training.Training
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import play.db.NamedDatabase
import slick.driver.JdbcProfile
import slick.driver.PostgresDriver... | magura42/KickAppServer | app/dao/TrainingDAO.scala | Scala | mit | 1,863 |
/*
* Copyright (C) 2014 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This progra... | openmole/openmole | openmole/plugins/org.openmole.plugin.task.scala/src/main/scala/org/openmole/plugin/task/scala/package.scala | Scala | agpl-3.0 | 836 |
/* NSC -- new Scala compiler
* Copyright 2006-2013 LAMP/EPFL
* @author Martin Odersky
*/
package scala.tools.nsc
package util
import io.{ AbstractFile, Directory, File, Jar }
import java.net.MalformedURLException
import java.net.URL
import java.util.regex.PatternSyntaxException
import scala.collection.{ mutable,... | twitter/finatra-misc | scalap-compiler-deps/2.12.1/src/main/scala/scala/tools/nsc/util/ClassPath.scala | Scala | apache-2.0 | 13,961 |
package boardGame
import scala.collection.mutable.ArrayBuffer
class SimpleDeck[T] {
private val cards = new ArrayBuffer[T];
def pushTop(card : T) = { card +=: cards}
def pushBottom(card : T) = { cards += card }
def rest = cards.length;
def draw : T = {
val c = cards.head;
... | ksk9687/Aquire | src/main/scala/boardGame/Deck.scala | Scala | mit | 686 |
package cromwell.util.docker
import cromwell.CromwellSpec.IntegrationTest
import cromwell.util.DockerConfiguration
import cromwell.util.google.{GoogleCredentialFactory, GoogleCredentialFactorySpec}
import org.scalatest.prop.TableDrivenPropertyChecks._
import org.scalatest.prop.Tables.Table
import org.scalatest.{FlatSp... | dgtester/cromwell | src/test/scala/cromwell/util/docker/DockerIdentifierParserSpec.scala | Scala | bsd-3-clause | 3,102 |
import scala.language.{ implicitConversions }
import runtime.ScalaRunTime
object Test {
val p = new Pattern { }
import p._
implicit object IntOps extends NumericOps[Int] {
def zero = 0
def one = 1
def add(a: Int, b: Int): Int = a + b
def sub(a: Int, b: Int): Int = a - b
def mul(a: Int, b: I... | shimib/scala | test/files/run/patmat-exprs.scala | Scala | bsd-3-clause | 22,570 |
/**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... | erictu/adam | adam-apis/src/main/scala/org/bdgenomics/adam/apis/java/JavaADAMContext.scala | Scala | apache-2.0 | 2,558 |
package org.jetbrains.jps.incremental.scala
import java.io.File
import org.jetbrains.jps.incremental.messages.BuildMessage.Kind
import org.jetbrains.jps.incremental.scala.remote.{CompileServerMeteringInfo, CompileServerMetrics}
class DummyClient extends Client {
override def message(msg: Client.ClientMsg): Unit = ... | JetBrains/intellij-scala | scala/compiler-shared/src/org/jetbrains/jps/incremental/scala/DummyClient.scala | Scala | apache-2.0 | 1,356 |
package solution1
object Factorial extends App {
assert(args.size == 1, "Usage: Factorial <n>")
val n = args(0).toInt
assert(n >= 0, "<n> needs to be >= 0")
println(fac(n))
private def fac(n: Int): Int = {
var f = 1
for(i <- 1 to n) {
f = f * i
}
f
}
}
| keshwans/scala-1-day | 220.immutability/src/main/scala/solution1/Factorial.scala | Scala | mit | 290 |
/*
* Copyright 2016 Lightcopy
*
* 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... | lightcopy/parquet-index | src/main/scala/org/apache/spark/sql/DataFrameIndexManager.scala | Scala | apache-2.0 | 10,580 |
package streams
/**
* This component implements a parser to define terrains from a
* graphical ASCII representation.
*
* When mixing in that component, a level can be defined by
* defining the field `level` in the following form:
*
* val level =
* """------
* |--ST--
* |--oo--
* |--o... | kevllino/scala-specialization | 01-ProgFun2/streams/src/main/scala/streams/StringParserTerrain.scala | Scala | mit | 2,657 |
/*
* Copyright 2017 PayPal
*
* 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 ... | az-qbradley/squbs | squbs-unicomplex/src/main/scala/org/squbs/unicomplex/JMX.scala | Scala | apache-2.0 | 10,814 |
/*
* 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 ... | lvdongr/spark | mllib/src/test/scala/org/apache/spark/mllib/linalg/MatricesSuite.scala | Scala | apache-2.0 | 22,827 |
/* Copyright 2009-2016 EPFL, Lausanne */
package leon
package evaluators
import purescala.Common._
import purescala.Definitions._
import purescala.Expressions._
import codegen.CompilationUnit
import codegen.CompiledExpression
import codegen.CodeGenParams
import leon.codegen.runtime.LeonCodeGenRuntimeException
impor... | regb/leon | src/main/scala/leon/evaluators/CodeGenEvaluator.scala | Scala | gpl-3.0 | 2,872 |
// Databricks notebook source exported at Sun, 19 Jun 2016 11:29:39 UTC
// MAGIC %md
// MAGIC
// MAGIC # [Scalable Data Science](http://www.math.canterbury.ac.nz/~r.sainudiin/courses/ScalableDataScience/)
// MAGIC
// MAGIC
// MAGIC ### prepared by [Raazesh Sainudiin](https://nz.linkedin.com/in/raazesh-sainudiin-4595... | lamastex/scalable-data-science | db/xtraResources/ProgGuides1_6/MLlibProgrammingGuide/dataTypes/000_dataTypesProgGuide.scala | Scala | unlicense | 4,336 |
package com.gravity.gdk.placement
import com.fasterxml.jackson.core.JsonParseException
import com.gravity.gdk.config.DefaultSettings
import com.gravity.gdk.reco.{RecoContext, RecoResult}
import scala.collection.mutable
import scala.concurrent._
import scalaj.http.{BaseHttp, Http}
/*
___...---''
___..... | GravityLabs/gdk-scala | src/main/scala/com/gravity/gdk/placement/Placement.scala | Scala | apache-2.0 | 2,721 |
/***********************************************************************
* 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... | ddseapy/geomesa | geomesa-process/geomesa-process-vector/src/main/scala/org/locationtech/geomesa/process/knn/KNearestNeighborSearchProcess.scala | Scala | apache-2.0 | 5,396 |
package scalan.util
import java.io.{InputStreamReader, BufferedReader, File}
import scala.collection.mutable
object ProcessUtil {
def launch(workingDir: File, command: String*): Array[String] = {
val absoluteWorkingDir = workingDir.getAbsoluteFile
val builder = new ProcessBuilder(command: _*).
direct... | PCMNN/scalan-ce | common/src/main/scala/scalan/util/ProcessUtil.scala | Scala | apache-2.0 | 1,024 |
package org.apache.mesos.chronos.scheduler.api
import java.util.logging.{Level, Logger}
import javax.ws.rs._
import javax.ws.rs.core.Response.Status
import javax.ws.rs.core.{MediaType, Response}
import org.apache.mesos.chronos.scheduler.config.{CassandraConfiguration, SchedulerConfiguration}
import org.apache.mesos.c... | mikkokupsu/chronos | src/main/scala/org/apache/mesos/chronos/scheduler/api/JobManagementResource.scala | Scala | apache-2.0 | 11,510 |
/*
* 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 ... | javalovelinux/SparkGroovyScript | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala | Scala | apache-2.0 | 17,044 |
package vultura.factor
import org.specs2._
class NormalDTest extends Specification {
override def is =
"log expectation with zeros" ! (NormalD.logExpectation(Array(0d,1), Array(0d,1)) === 0d)
}
| ziggystar/vultura-factor | src/test/scala/vultura/factor/NormalDTest.scala | Scala | mit | 202 |
package io.flow.event.v2
import java.util.concurrent.ConcurrentLinkedQueue
import io.flow.event.Record
import io.flow.log.RollbarLogger
import io.flow.play.util.Config
import io.flow.util.{FlowEnvironment, StreamNames}
import javax.inject.{Inject, Singleton}
import scala.concurrent.duration._
import scala.reflect.ru... | flowcommerce/lib-event | app/io/flow/event/v2/DynamoStreamQueue.scala | Scala | mit | 2,482 |
package wtf.shekels.alice.als.command
import sx.blah.discord.handle.obj.IMessage
import wtf.shekels.alice.als.listeners.CommandListener
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.util.{Failure, Success}
/**
* @author alice
* @since 10/2/17.
*/
abstract... | antflga/AL-S | src/main/scala/wtf.shekels.alice.als/command/Command.scala | Scala | gpl-3.0 | 1,634 |
package com.sparcedge.turbine.query.pipeline
import com.sparcedge.turbine.query._
import com.sparcedge.turbine.data.SegmentValueHolder
object MatchPipelineElement {
def apply(mtch: Match): MatchPipelineElement = new MatchPipelineElement(mtch)
}
class MatchPipelineElement(mtch: Match) extends QueryPipelineElement... | sparcedge/turbinedb | src/main/scala/com/sparcedge/turbine/query/pipeline/MatchPipelineElement.scala | Scala | gpl-3.0 | 744 |
package io.finch
import com.twitter.finagle.http.Status
trait Outputs {
// See https://gist.github.com/vkostyukov/32c84c0c01789425c29a to understand how this list is assembled.
// 2xx
def Ok[A](a: A): Output.Payload[A] = Output.Payload(a, Status.Ok) // 200
def C... | BenWhitehead/finch | core/src/main/scala/io/finch/Outputs.scala | Scala | apache-2.0 | 4,304 |
/*
* Copyright 2020 Precog Data
*
* 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 ... | djspiewak/quasar | foundation/src/main/scala/quasar/RenderTree.scala | Scala | apache-2.0 | 9,460 |
package com.github.truerss.rollbar
import entities.{Trace, Frame, RollBarException}
trait ToTrace {
def convert(thr: Throwable): Trace
}
object DefaultImplicits {
implicit val ToTraceDefault: ToTrace = new ToTrace {
override def convert(thr: Throwable): Trace = {
val fs = thr.getStackTrace.map { x =>
... | truerss/rollbar-scala | src/main/scala/com/github/truerss/rollbar/ToTrace.scala | Scala | mit | 776 |
/*
There are a number of variations on `Option` and `Either`. If we want to accumulate multiple errors, a simple approach is a new data type that lets us keep a list of errors in the data constructor that represents failures:
trait Partial[+A,+B]
case class Errors[+A](get: Seq[A]) extends Partial[A,Nothing]
case class... | lhohan/fpscala | answerkey/errorhandling/08.answer.scala | Scala | mit | 963 |
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.