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 ... | ArvinDevel/onlineAggregationOnSparkV2 | sql/core/src/test/scala/org/apache/spark/sql/columnar/compression/RunLengthEncodingSuite.scala | Scala | apache-2.0 | 4,102 |
package com.rabbitonweb.nnspc
import org.scalatest.{Matchers, FunSuite}
class P06Test extends FunSuite with Matchers {
val p06 = new P06[Int]()
test("that empty list is a palindrome") {
p06.isPalindrome(List()) should be(true)
}
test("that one element list is a palindrome") {
p06.isPalindrome(List... | rabbitonweb/99-scala-problems | src/test/scala/com/rabbitonweb/nnspc/P06Test.scala | Scala | gpl-2.0 | 936 |
/*
* Copyright (C) 2011 Mathias Doenitz
*
* 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... | lustefaniak/spray-json | src/test/scala/spray/json/PrettyPrinterSpec.scala | Scala | apache-2.0 | 2,117 |
package application
object Settings {
val imageFormat = "jpg"
val multicastAddress = "225.4.5.6"
val multicastPort = 44446
val screenShotTimeout = 500
val serverSendTimeout = 500
}
| abtv/RemoteViewer | src/main/scala/application/Settings.scala | Scala | mit | 197 |
package one.lockstep.util.crypto.modpow
import java.math.BigInteger
import one.lockstep.util._
import scala.util.Try
/**
* GMP support
*
* Enabled on Linux & OS/X when GMP bindings are available. Disable using '-Dlockstep.gmp=false'
*/
object ModPow extends Logging {
private val gmpBindings = "com.square... | lockstep-one/vault | vault-common/src/main/scala/one/lockstep/util/crypto/modpow/ModPow.scala | Scala | agpl-3.0 | 3,115 |
package at.forsyte.apalache.tla.imp
import at.forsyte.apalache.tla.imp.src.{SourceLocation, SourceStore}
import at.forsyte.apalache.tla.lir._
import at.forsyte.apalache.tla.lir.oper._
import at.forsyte.apalache.tla.lir.values.{TlaBoolSet, TlaStrSet}
import at.forsyte.apalache.tla.lir.values.TlaBool
import tla2sany.sem... | konnov/apalache | tla-import/src/main/scala/at/forsyte/apalache/tla/imp/OpApplTranslator.scala | Scala | apache-2.0 | 22,914 |
package test
import language.experimental.genericNumberLiterals
import scala.util.FromDigits
import scala.quoted.*
object BigFloatFromDigitsImpl:
def apply(digits: Expr[String])(using Quotes): Expr[BigFloat] =
digits.value match
case Some(ds) =>
try
val BigFloat(m, e) = BigFloat(ds)
... | lampepfl/dotty | tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala | Scala | apache-2.0 | 547 |
/**
* This file is part of warg.
*
* warg 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.
*
* warg is distributed in the hope t... | starub/warg | src/main/scala/org/warg/modules/dnd2ed/races/Elf.scala | Scala | gpl-3.0 | 1,177 |
package com.arcusys.valamis.web.servlet.public
import java.io.InputStream
import java.util.Locale
import javax.servlet.http.HttpServletResponse
import com.arcusys.learn.liferay.util.PortalUtilHelper
import com.arcusys.valamis.lesson.model.{Lesson, LessonLimit, LessonType}
import com.arcusys.valamis.lesson.service.exp... | arcusys/Valamis | valamis-portlets/src/main/scala/com/arcusys/valamis/web/servlet/public/LessonServlet.scala | Scala | gpl-3.0 | 7,963 |
/*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... | arkadius/micro-burn | src/main/scala/org/github/microburn/repository/BoardStateRepository.scala | Scala | apache-2.0 | 3,419 |
package com.softwaremill.react.kafka
import akka.actor.ActorSystem
import org.scalatest.Suite
trait ReactiveStreamsTckVerificationBase extends Suite with KafkaTest {
override implicit val system: ActorSystem = ActorSystem()
val message = "foo"
}
| anand-singh/reactive-kafka | core/src/test/scala/com/softwaremill/react/kafka/ReactiveStreamsTckVerificationBase.scala | Scala | apache-2.0 | 254 |
/*
* ProbQueryAlgorithm.scala
* Algorithms that compute conditional probabilities of queries.
*
* Created By: Avi Pfeffer (apfeffer@cra.com)
* Creation Date: Jan 1, 2009
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for informatio... | jyuhuan/figaro | Figaro/src/main/scala/com/cra/figaro/algorithm/ProbQueryAlgorithm.scala | Scala | bsd-3-clause | 5,750 |
package almhirt.domain
import akka.actor.Props
import almhirt.common._
trait AggregateRootHiveFactory extends (HiveDescriptor ⇒ AlmValidation[Props]) {
final def apply(descriptor: HiveDescriptor): AlmValidation[Props] = props(descriptor)
def props(descriptor: HiveDescriptor): AlmValidation[Props]
}
| chridou/almhirt | almhirt-core/src/main/scala/almhirt/domain/AggregateRootHiveFactory.scala | Scala | apache-2.0 | 311 |
package org.scalajs.sbtplugin
import sbt._
import org.scalajs.core.tools.io._
import org.scalajs.core.tools.json._
import org.scalajs.core.tools.logging.Logger
import org.scalajs.core.tools.linker.backend.ModuleKind
import org.scalajs.jsenv._
import scala.collection.mutable
private[sbtplugin] final class Framework... | xuwei-k/scala-js | sbt-plugin/src/main/scala/org/scalajs/sbtplugin/FrameworkDetector.scala | Scala | bsd-3-clause | 2,996 |
package org.openapitools.client.api
import org.openapitools.client.model._
import com.typesafe.config.ConfigFactory
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.core.structure.PopulationBuilder
import java.io.File
import scala.collection.mutable
class BlueOceanApiSimulation ext... | cliffano/swaggy-jenkins | clients/scala-gatling/generated/src/gatling/scala/org/openapitools/client/api/BlueOceanApiSimulation.scala | Scala | mit | 39,399 |
/*
* 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 ... | HuaweiBigData/carbondata | integration/spark2/src/test/scala/org/apache/spark/carbondata/commands/SetCommandTestCase.scala | Scala | apache-2.0 | 6,238 |
package ch10
import javax.swing.JFrame
import java.awt.event.WindowAdapter
import java.awt.event.WindowEvent
import java.awt.Graphics
import java.awt.Color
object frameexample extends App {
class DrawRectPanel extends javax.swing.JPanel {
override def paintComponent(g: Graphics) {
super.paintComponent(g)
... | tuxdna/scala-for-the-impatient-exercises | src/main/scala/ch10/frameexample.scala | Scala | apache-2.0 | 1,001 |
package chapter09
import java.io.PrintWriter
object Exercise6 extends App {
val file = io.Source.fromFile("data/chapter9/exercise6.cpp")
val out = new PrintWriter("data/chapter9/exercise6-out.txt")
val source = file.getLines().mkString("\\n")
val quotedStrings = "\\"[^\\"]+\\"|'[^\\']+'".r
for {
m <-... | vsuharnikov/books-exercises | scala/scala-for-the-impatient/src/main/scala/chapter09/Exercise6.scala | Scala | mit | 444 |
package com.ebiznext.sbt.plugins
import sbt._
/**
* @author stephane.manciot@ebiznext.com
*
*/
object AndroMDADependencies {
def dependencies(androMDAVersion: String, Config:Configuration) : Seq[ModuleID] = Seq[ModuleID](
"org.andromda" % "andromda-core" % androMDAVersion % Config.name,
"org.andromda.r... | ebiznext/sbt-andromda | src/main/scala/AndroMDADependencies.scala | Scala | mit | 1,928 |
package com.seanshubin.detangler.domain
trait ConfigurationFactory {
def validate(args: Seq[String]): Either[Seq[String], (Configuration, Seq[Seq[String]])]
}
| SeanShubin/detangler | domain/src/main/scala/com/seanshubin/detangler/domain/ConfigurationFactory.scala | Scala | unlicense | 162 |
package scuff
trait Feed {
type Selector
type Consumer
/** Start subscription. */
def subscribe(include: Selector => Boolean = Function.const(true))(s: Consumer): Subscription
}
| nilskp/scuff | src/main/scala/scuff/Feed.scala | Scala | mit | 188 |
package connectionpools.impl
import java.util
import javax.sql.DataSource
import connectionpools.DataSources._
import connectionpools.{DataSourceFactorySupport, JdbcDrivers}
import org.apache.tomcat.jdbc.pool
import org.apache.tomcat.jdbc.pool.PoolProperties
/**
* TomcatCPDataSourceFactory
* @author Sunghyouk Bae ... | debop/connectionpool-benchmark | src/main/scala/connectionpools/impl/TomcatCPDataSourceFactory.scala | Scala | apache-2.0 | 2,151 |
package org.json4s
class ReaderSyntax(private val jv: JValue) extends AnyVal {
/**
* Given that an implicit reader of type `A` is in scope
* It will deserialize the org.json4s.JValue to an object of type `A`
*
* Example:
* {{{
* case class Person(name: String)
* implicit object PersonReader... | json4s/json4s | ast/shared/src/main/scala/org/json4s/ReaderSyntax.scala | Scala | apache-2.0 | 1,857 |
scala> try 1
1 warning found
-- [E000] Syntax Warning: ------------------------------------------------------
1 | try 1
| ^^^^^
| A try without catch or finally is equivalent to putting
| its body in a block; no exceptions are handled.
|
| longer explanation available when compiling with `-explain`
val res0: ... | dotty-staging/dotty | compiler/test-resources/repl/i13208.default.scala | Scala | apache-2.0 | 328 |
/*
* 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 agreed to in writ... | scalatest/scalatest | jvm/scalatest-test/src/test/scala/org/scalatest/EveryShouldContainAtLeastOneElementOfLogicalOrSpec.scala | Scala | apache-2.0 | 40,676 |
package dotty.tools.dotc
package config
import collection.mutable.{ ArrayBuffer }
import scala.util.{ Try, Success, Failure }
import scala.reflect.internal.util.StringOps
import reflect.ClassTag
import core.Contexts._
// import annotation.unchecked
// Dotty deviation: Imports take precedence over definitions in encl... | yusuke2255/dotty | src/dotty/tools/dotc/config/Settings.scala | Scala | bsd-3-clause | 9,488 |
package views.vrm_retention
import models.CacheKeyPrefix
import models.IdentifierCacheKey
import play.api.http.HeaderNames.REFERER
import play.api.mvc.Request
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.ClientSideSessionFactory
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.Coo... | dvla/vrm-retention-online | app/views/vrm_retention/RelatedCacheKeys.scala | Scala | mit | 2,487 |
package TAPLcomp.bot
import scala.util.parsing.combinator.{ImplicitConversions, PackratParsers}
import scala.util.parsing.combinator.syntactical.StandardTokenParsers
sealed trait Ty
case object TyTop extends Ty
case object TyBot extends Ty
case class TyArr(t1: Ty, t2: Ty) extends Ty
sealed trait Term
case class ... | hy-zhang/parser | Scala/Parser/src/TAPLcomp/bot/parser.scala | Scala | bsd-3-clause | 2,134 |
// 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/test/scala/au/com/cba/omnia/maestro/core/codec/DecodeSpec.scala | Scala | apache-2.0 | 4,415 |
package com.softwaremill.spray.server
import org.scalatest.{FlatSpec, ShouldMatchers}
import spray.testkit.ScalatestRouteTest
import spray.routing.Directives
class Step4CompleteTest extends FlatSpec with ShouldMatchers
with ScalatestRouteTest with Directives {
it should "work" in {
Get("/hello") ~> Step4Comp... | arka243/Twitter-Engine-Simulation | src/test/scala/com/softwaremill/spray/server/Step4CompleteTest.scala | Scala | apache-2.0 | 409 |
package uimaui
import com.entopix.maui.util.DataLoader
import com.entopix.maui.filters.MauiFilter
import com.entopix.maui.main.MauiModelBuilder
import com.entopix.maui.stemmers.FrenchStemmer
import com.entopix.maui.stopwords.StopwordsFrench
import org.apache.uima.fit.descriptor.ConfigurationParameter
import org.apach... | Cowa/uimaui-mais-non-merci | src/main/scala/uimaui/MauiModelResource.scala | Scala | mit | 2,343 |
/*
*************************************************************************************
* Copyright 2015 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-core/src/main/scala/com/normation/rudder/repository/CachedRepository.scala | Scala | gpl-3.0 | 1,884 |
package io.udash
package rest.openapi
import com.avsystem.commons.meta.{MacroInstances, infer}
import com.avsystem.commons.serialization.GenCodec
import io.udash.rest.openapi.adjusters.description
import io.udash.rest.raw.{RawRest, RestMetadata}
import io.udash.rest.{DefaultRestImplicits, FullInstances}
import scala.... | UdashFramework/udash-core | rest/src/test/scala/io/udash/rest/openapi/openapiDependencies.scala | Scala | apache-2.0 | 2,245 |
// 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... | shyam334/ebenezer.build.test | tools/src/main/scala/au/com/cba/omnia/ebenezer/cli/Cat.scala | Scala | apache-2.0 | 1,252 |
package geotrellis.raster.op.local
import geotrellis._
import geotrellis._
object Divide {
def apply(x:Op[Int], y:Op[Int]) = logic.Do2(x, y)((x, y) => x + y)
def apply(r:Op[Raster], c:Op[Int]) = DivideConstant(r, c)
def apply(c:Op[Int], r:Op[Raster]) = DivideConstantBy(c, r)
def apply(r1:Op[Raster], r2:Op[Ras... | Tjoene/thesis | Case_Programs/geotrellis-0.7.0/src/main/scala/geotrellis/raster/op/local/Divide.scala | Scala | gpl-2.0 | 1,378 |
/*
* Copyright 2007-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... | jeppenejsum/liftweb | framework/lift-persistence/lift-record/src/main/scala/net/liftweb/record/field/EmailField.scala | Scala | apache-2.0 | 2,435 |
package scala.collection
import org.scalacheck.{Arbitrary, Gen, Properties, Prop}
import org.scalacheck.Prop.{forAll, all, propBoolean}
object IteratorProperties extends Properties("Iterator") {
val smallInteger = Gen.choose(0,50)
class SimpleIterable[A](underlying: Iterable[A]) extends Iterable[A] {
def it... | scala/scala | test/scalacheck/scala/collection/IteratorProperties.scala | Scala | apache-2.0 | 2,343 |
// Solution-1.scala
// Solution to Exercise 1 in "Values"
val v1 = 17
println(v1)
/* OUTPUT_SHOULD_BE
17
*/
| P7h/ScalaPlayground | Atomic Scala/atomic-scala-solutions/01_Values/Solution-1.scala | Scala | apache-2.0 | 110 |
enum Option[+T] extends Serializable {
case Some[T](x: T) extends Option[T]
case None
def isDefined: Boolean = this match {
case None => false
case some => true
}
}
object Option {
def apply[T >: Null](x: T): Option[T] = if (x == null) None else Some(x)
}
object Test {
import Option.*
def main(a... | lampepfl/dotty | tests/run/enum-Option.scala | Scala | apache-2.0 | 482 |
package io.eels.component.parquet
import java.io.File
import com.sksamuel.exts.metrics.Timed
import io.eels.component.parquet.avro.{AvroParquetSink, AvroParquetSource}
import io.eels.component.parquet.util.ParquetLogMute
import io.eels.schema.StructType
import io.eels.{Frame, Row}
import org.apache.hadoop.conf.Config... | stheppi/eel | eel-components/src/test/scala/io/eels/component/parquet/ParquetSpeedTest.scala | Scala | apache-2.0 | 2,513 |
package com.docurated.clustermc.util
import akka.actor.Actor
import scala.concurrent.duration._
trait RetryMessageWithDelay extends Actor {
implicit val ec = context.dispatcher
override def preRestart(reason: Throwable, message: Option[Any]): Unit = {
super.preRestart(reason, message)
message.foreach(msg... | Docurated/clustermc | src/main/scala/com/docurated/clustermc/util/RetryMessageWithDelay.scala | Scala | apache-2.0 | 406 |
package com.circusoc.simplesite.services
import com.circusoc.simplesite.Core
import com.circusoc.simplesite.hire._
import spray.httpx.SprayJsonSupport
import spray.json._
import spray.routing.HttpService
trait HireService extends HttpService with SprayJsonSupport {
this: Core =>
val hireRoutes = {
path("hire"... | ririw/circusoc-backend | src/main/scala/com/circusoc/simplesite/services/HireService.scala | Scala | agpl-3.0 | 659 |
package scalax.collection.io.json
package serializer
import scala.reflect.classTag
import net.liftweb.json._
import scalax.collection.GraphPredef._
import scalax.collection.Graph
import scalax.collection.config.CoreConfig
/** This custom serializer is to be registered whenever a class to be (de)serialized
* cont... | scala-graph/scala-graph | json/src/main/scala/scalax/collection/io/json/serializer/GraphSerializer.scala | Scala | apache-2.0 | 1,154 |
package org.rebeam.boxes.swing.icons
import javax.swing.{ImageIcon, Icon}
import javax.imageio.ImageIO
import java.awt.image.BufferedImage
import java.awt.{Graphics2D, Color, Image}
import java.net.URL
sealed trait IconSize
object IconSize {
case object Small
case object Medium
case object Large
}
import IconS... | trepidacious/boxes-swing | src/main/scala/org/rebeam/boxes/swing/icons/Icons.scala | Scala | gpl-2.0 | 2,813 |
package uk.org.nbn.nbnv.importer
import testing.BaseFunSuite
class OptionsSuite extends BaseFunSuite {
val archivePath = "c:\\\\some\\\\archive.zip"
val logDir = "c:\\\\logs"
val tempDir = "c:\\\\temp"
test("valid command line options should parse") {
val valid = List(archivePath, "-target"... | JNCC-dev-team/nbn-importer | importer/src/test/scala/uk/org/nbn/nbnv/importer/OptionsSuite.scala | Scala | apache-2.0 | 1,295 |
/*
* 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 ... | rmetzger/flink | flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/runtime/stream/TimeAttributesITCase.scala | Scala | apache-2.0 | 24,489 |
package com.sohu.mrd.sonlp.common
/**
* Created by huangyu on 15/12/20.
*/
class Article(val title: String, val summary: String, val content: String, val media: String)
| huangfish/sonlp | common/src/main/scala/com/sohu/mrd/sonlp/common/Article.scala | Scala | apache-2.0 | 173 |
/*
* 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 n... | TiVo/kafka | streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/StreamsBuilder.scala | Scala | apache-2.0 | 9,479 |
package dao
import org.specs2.mutable.Specification
import models.Request
/**
* Created by Engin Yoeyen on 30/09/14.
*/
class QueryBuilderSpec extends Specification {
"QueryBuilder" should {
"build select statement" in {
QueryBuilder.build(Request("tableName")) mustEqual "SELECT * FROM tableName ;"
... | stylight/postgresql-rest-api | test/dao/QueryBuilderSpec.scala | Scala | mit | 3,050 |
package de.m7w3.signal.store
import org.scalatest.{FlatSpec, Matchers}
import org.whispersystems.libsignal.InvalidKeyIdException
import org.whispersystems.libsignal.state.SignedPreKeyRecord
class SignalDesktopSignedPreKeyStoreSpec extends FlatSpec with Matchers with TestStore {
behavior of SignalDesktopSignedPreKe... | ayoub-benali/signal-desktop-client | src/test/scala/de/m7w3/signal/store/SignalDesktopSignedPreKeyStoreSpec.scala | Scala | apache-2.0 | 2,693 |
/* __ *\
** ________ ___ / / ___ __ ____ Scala.js Test Suite **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2013-2015, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ **
** /____/\___/_/ |_/... | jmnarloch/scala-js | test-suite/src/test/scala/org/scalajs/testsuite/niobuffer/DoubleBufferTest.scala | Scala | bsd-3-clause | 3,037 |
package org.atnos.example
import org.specs2.Specification
import org.atnos.eff._
import cats.syntax.all._
import cats.data._
import cats.Eval
import ReaderEffect._
import WriterEffect._
import EvalEffect._
import Eff._
class ReadmeSpec extends Specification { def is = s2"""
run the first example $firstExample
"""
... | etorreborre/eff | jvm/src/test/scala/org/atnos/example/ReadmeSpec.scala | Scala | mit | 1,229 |
package springrtsru.pages
abstract class BaseContentPage extends BasePage {
}
| Eltario/springrts-ru-website | src/main/scala/springrtsru/pages/BaseContentPage.scala | Scala | unlicense | 80 |
/*
* Copyright (c) 2014 Robert Conrad - All Rights Reserved.
* Unauthorized copying of this file, via any medium is strictly prohibited.
* This file is proprietary and confidential.
* Last modified by rconrad, 12/24/14 4:37 PM
*/
package base.entity.db.impl
import base.common.service.ServiceImpl
import base.enti... | robconrad/base-api | project-entity/src/main/scala/base/entity/db/impl/DbConfigServiceImpl.scala | Scala | mit | 1,515 |
package org.skycastle.core.platform.time
import _root_.java.io.Serializable
/**
* Wraps an instant in time, adding some utility functions.
*/
case class Time(ms: Long) extends Serializable {
def s: Double = ms * 0.001
}
| zzorn/skycastle | src/main/scala/org/skycastle/core/platform/time/Time.scala | Scala | gpl-2.0 | 232 |
package com.mesosphere.universe.v2.model
import io.circe.Decoder
import io.circe.Encoder
import io.circe.generic.semiauto.deriveDecoder
import io.circe.generic.semiauto.deriveEncoder
/**
* Conforms to: https://github.com/mesosphere/universe/blob/version-2.x/repo/meta/schema/command-schema.json
*/
case class Comma... | dcos/cosmos | cosmos-common/src/main/scala/com/mesosphere/universe/v2/model/Command.scala | Scala | apache-2.0 | 510 |
package org.akka.essentials.unittest.example
import akka.actor.Actor
class BoomActor extends Actor {
def receive: Receive = {
case message: String => throw new IllegalArgumentException("boom!")
case message: Integer => throw new NullPointerException("caput")
}
} | rokumar7/trial | AkkaUnitTest/src/main/scala/org/akka/essentials/unittest/example/BoomActor.scala | Scala | unlicense | 275 |
package org.precompiler.spark101.db
import java.io.File
import java.sql.{Connection, DriverManager}
import org.precompiler.spark101.env.EnvSetup
import org.precompiler.spark101.utils.H2DatabaseEnv
import org.scalatest.{BeforeAndAfterAll, FunSuite}
/**
*
* @author Richard Li
*/
class H2Test extends FunSuite wi... | precompiler/spark-101 | learning-spark/src/test/scala/org/precompiler/spark101/db/H2Test.scala | Scala | apache-2.0 | 687 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | akopich/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala | Scala | apache-2.0 | 4,467 |
package se.gigurra.leavu3.util
import scala.language.implicitConversions
/**
* Created by kjolh on 4/11/2016.
*/
case class DerivativeAverager(overSeconds: Double = 1.0,
minTimeStep: Double = 0.1,
initValue: Double = 0.0) {
private var tLastUpdate = 0... | GiGurra/leavu3 | src/main/scala/se/gigurra/leavu3/util/DerivativeAverager.scala | Scala | mit | 1,093 |
package io.coral.actors.transform
import akka.actor.ActorSystem
import akka.testkit.{ImplicitSender, TestActorRef, TestKit}
import akka.util.Timeout
import io.coral.actors.CoralActorFactory
import io.coral.api.DefaultModule
import org.json4s.JsonAST.JValue
import org.json4s.JsonDSL._
import org.json4s._
import org.jso... | daishichao/coral | runtime-api/src/test/scala/io/coral/actors/transform/StatsActorSpec.scala | Scala | apache-2.0 | 2,655 |
package reflection
import java.io._
import scala.util.control.NonFatal
object Reflection {
def roundTrip[A](a: A): A = {
val baos = new ByteArrayOutputStream()
val oos = new ObjectOutputStream(baos)
oos.writeObject(a)
oos.close()
val bais = new ByteArrayInputStream(baos.toByteArray())
val oi... | xuwei-k/xsbt | sbt-app/src/sbt-test/classloader-cache/java-serialization/dependency/src/main/scala/reflection/Reflection.scala | Scala | apache-2.0 | 423 |
/*
* Copyright (C) 2010 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.domain.distribution/src/main/scala/org/openmole/plugin/domain/distribution/UniformDistribution.scala | Scala | agpl-3.0 | 1,843 |
package com.twitter.util
/**
* ==Resource Management==
*
* [[com.twitter.util.Disposable]] represents a live resource that must be disposed after use.
* [[com.twitter.util.Managed]] is a factory for creating and composing such resources.
* Managed resources are composed together so their lifetimes are synchronize... | twitter/util | util-core/src/main/scala/com/twitter/util/Disposable.scala | Scala | apache-2.0 | 4,501 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | prccaraujo/openwhisk | core/controller/src/main/scala/whisk/core/controller/WebActions.scala | Scala | apache-2.0 | 32,008 |
/*
* 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... | yiheng/BigDL | spark/dl/src/test/scala/com/intel/analytics/bigdl/nn/tf/ConcatOffsetSpec.scala | Scala | apache-2.0 | 1,158 |
package com.twitter.finagle.http
import com.twitter.finagle.{Http => FinagleHttp}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class Netty3EndToEndTest extends AbstractHttp1EndToEndTest {
def implName: String = "netty3"
def clientImpl(): FinagleHttp.Client ... | mkhq/finagle | finagle-http/src/test/scala/com/twitter/finagle/http/Netty3EndToEndTest.scala | Scala | apache-2.0 | 746 |
/*
* The MIT License
Copyright (c) 2012 Alexander Kuprin
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 limitatio... | akup/neo4j-record | src/main/scala/net/indoorlabs/neo4j/record/field/Neo4jLocaledLink.scala | Scala | mit | 9,563 |
package org.bitcoins.script.splice
import org.bitcoins.script.{ScriptProgram}
import org.bitcoins.script.bitwise.OP_EQUAL
import org.bitcoins.script.constant._
import org.bitcoins.util.TestUtil
import org.scalatest.{MustMatchers, FlatSpec}
/**
* Created by chris on 2/4/16.
*/
class SpliceInterpreterTest extends Fla... | Christewart/scalacoin | src/test/scala/org/bitcoins/script/splice/SpliceInterpreterTest.scala | Scala | mit | 2,182 |
/**
* 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... | mihbor/kafka | core/src/main/scala/kafka/server/KafkaConfig.scala | Scala | apache-2.0 | 109,634 |
/*
* 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 ... | goldmedal/spark | sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala | Scala | apache-2.0 | 11,345 |
package io.findify.sqsmock
import com.amazonaws.auth.AnonymousAWSCredentials
import com.amazonaws.services.sqs.AmazonSQSClient
import org.scalatest.{BeforeAndAfterAll, FlatSpec}
/**
* Created by shutty on 3/31/16.
*/
trait SQSStartStop extends FlatSpec with BeforeAndAfterAll {
var sqs:SQSService = _
var clien... | findify/sqsmock | src/test/scala/io/findify/sqsmock/SQSStartStop.scala | Scala | mit | 592 |
/*
* Copyright (C) 2015 Stratio (http://stratio.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | diegohurtado/sparta | plugins/src/main/scala/com/stratio/sparta/plugin/input/websocket/WebSocketInput.scala | Scala | apache-2.0 | 1,283 |
package org.scalaprops
/**
* Notifies listener when properties have been added or removed to/from a bean.
*/
trait BeanListener {
def onPropertyAdded(bean: Bean, property: Property[_])
def onPropertyRemoved(bean: Bean, property: Property[_])
def onPropertyChanged(bean: Bean, property: Property[_])
} | zzorn/scalaprops | src/main/scala/org/scalaprops/BeanListener.scala | Scala | bsd-3-clause | 309 |
/*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.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... | alexandru/monifu | monix-reactive/jvm/src/main/scala/monix/reactive/observers/buffers/ConcurrentQueue.scala | Scala | apache-2.0 | 3,746 |
/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api.http.websocket
import akka.util.ByteString
/**
* A WebSocket message.
*
* This is a high level API intended for common simple use cases. It allows handling and sending of full
* WebSocket messages, as well as close and... | Shenker93/playframework | framework/src/play/src/main/scala/play/api/http/websocket/Message.scala | Scala | apache-2.0 | 1,816 |
/*
* PollImpl.scala
* (FScape)
*
* Copyright (c) 2001-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.fscape
package str... | Sciss/FScape-next | core/shared/src/main/scala/de/sciss/fscape/stream/impl/PollImpl.scala | Scala | agpl-3.0 | 1,598 |
package com.blinkbox.books.elasticsearch.client
import com.blinkbox.books.elasticsearch.client.ElasticClientApi._
import com.sksamuel.elastic4s.ElasticDsl._
import org.elasticsearch.index.VersionType
import org.scalatest.{FlatSpec, Matchers}
import spray.http.StatusCodes
class DocumentSpecs extends FlatSpec with Matc... | blinkboxbooks/elastic-http | src/test/scala/com/blinkbox/books/elasticsearch/client/DocumentSpecs.scala | Scala | mit | 7,345 |
/****************************************************************************
* Copyright (C) 2015 Łukasz Szpakowski. *
* *
* This software is licensed under the GNU General Public License *
* v3 ... | luckboy/IssueNotifier | src/main/scala/pl/luckboy/issuenotifier/LogStringUtils.scala | Scala | gpl-3.0 | 970 |
/*
* 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-hazelcast/src/main/scala/com/datamountaineer/streamreactor/connect/hazelcast/sink/HazelCastSinkConnector.scala | Scala | apache-2.0 | 2,645 |
/*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.scalajs.js
import scala.languag... | scala-js/scala-js | library/src/main/scala-new-collections/scala/scalajs/js/JSConverters.scala | Scala | apache-2.0 | 5,264 |
/** *
* Copyright 2015 Rackspace US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... | rackerlabs/api-checker | core/src/test/scala/com/rackspace/com/papi/components/checker/handler/ApiCoverageHandlerTest.scala | Scala | apache-2.0 | 7,582 |
import java.lang.reflect.Constructor
import com.google.inject.{Guice, AbstractModule}
import controllers.{AngularMailTemplates, JsonViewTemplates}
import models.users.BasicUser
import play.api.GlobalSettings
import securesocial.controllers.{MailTemplates, ViewTemplates}
import securesocial.core.RuntimeEnvironment
impo... | vega113/emotracker | app/Global.scala | Scala | apache-2.0 | 2,405 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | maropu/spark | core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala | Scala | apache-2.0 | 4,879 |
/*
* Copyright (C) 2016 DANS - Data Archiving and Networked Services (info@dans.knaw.nl)
*
* 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
... | DANS-KNAW/easy-process-sip | src/main/scala/nl.knaw.dans.easy.multideposit/Command.scala | Scala | apache-2.0 | 2,403 |
object foo {
val html =
<?xml version="1.0"?>
<!DOCTYPE html>
<html>
</html>
}
| scala/scala | test/files/neg/xml-doctype.scala | Scala | apache-2.0 | 97 |
package filodb.coordinator.queryplanner
import scala.concurrent.duration._
import scala.math.min
import akka.actor.ActorSystem
import akka.testkit.TestProbe
import com.typesafe.config.ConfigFactory
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.shoul... | filodb/FiloDB | coordinator/src/test/scala/filodb.coordinator/queryplanner/SingleClusterPlannerSplitSpec.scala | Scala | apache-2.0 | 42,326 |
/*
* Copyright 2021 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/amls-frontend | test/connectors/GovernmentGatewayConnectorSpec.scala | Scala | apache-2.0 | 3,118 |
/* Copyright 2009-2016 EPFL, Lausanne */
package leon
package codegen
case class CompilationException(msg : String) extends Exception {
override def getMessage = msg
}
| epfl-lara/leon | src/main/scala/leon/codegen/CompilationException.scala | Scala | gpl-3.0 | 172 |
/*
* Copyright 2014 Frugal Mechanic (http://frugalmechanic.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required... | frugalmechanic/fm-common | jvm/src/test/scala/fm/common/rich/TestRichURI.scala | Scala | apache-2.0 | 3,417 |
package counter
/**
* Counter class for Week 5 - exercise 1
* @author lmignot
*/
case class Counter (count: Int = 0) {
/**
* Return a new Counter with the value of this Counter incremented by the
* provided value which defaults to 1
* @param x: Int The optional value to increment the Counter by
... | BBK-PiJ-2015-67/sdp-portfolio | exercises/week05/src/main/scala/counter/Counter.scala | Scala | unlicense | 1,265 |
package org.allenai.common.json
import spray.json._
/** Provides a Partial function that only deserializes if the packedField is present in the JSON
* Because it is a PartialFunction, it can be easily combined with others in a series
* of `orElse` calls. This makes the `unpack` especially useful for handling abst... | ryanai3/common | core/src/main/scala/org/allenai/common/json/PackedJsonFormat.scala | Scala | apache-2.0 | 1,012 |
package org.jetbrains.sbt.project.template.activator
import java.io.File
import javax.swing.Icon
import com.intellij.ide.util.projectWizard.{ModuleBuilder, ModuleWizardStep, SdkSettingsStep, SettingsStep}
import com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalModuleBuilder
import com.intell... | double-y/translation-idea-plugin | src/org/jetbrains/sbt/project/template/activator/ActivatorProjectBuilder.scala | Scala | apache-2.0 | 5,734 |
package utils
import play.api.libs.json.{ JsBoolean, JsNumber, JsString, JsValue }
object JsonUnbox {
def unbox(value: JsValue): Object = {
value match {
case string: JsString => string.value.asInstanceOf[Object]
case bool: JsBoolean => bool.value.asInstanceOf[Object]
case number: JsNumber =>... | vetafi/vetafi-web | app/utils/JsonUnbox.scala | Scala | apache-2.0 | 436 |
package pl.edu.osp.api
import net.liftweb._
import common._
import http._
import com.mongodb.gridfs._
import net.liftweb.mongodb._
import java.io.{ByteArrayInputStream, ByteArrayOutputStream, File}
import _root_.net.liftweb.mongodb.DefaultMongoIdentifier
object ImageLoader {
def image(id: String): Box[LiftResponse... | mikolajs/osp-view | src/main/scala/pl/edu/osp/api/ImageLoader.scala | Scala | agpl-3.0 | 1,130 |
/*
* 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... | qiuxin2012/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/nn/ops/DecodeImage.scala | Scala | apache-2.0 | 14,588 |
package org.jobimtext.coref.berkeley.bansalklein.provider
import org.jobimtext.api.db.DatabaseConnection
class SimpleDatabaseFeatureProvider(dbPath: String, tableName: String) extends FeatureProvider {
val con = new DatabaseConnection
con.openConnection("jdbc:sqlite:" + dbPath, null, null, "org.sqlite.JDBC")
o... | timfeu/berkeleycoref-thesaurus | src/main/java/org/jobimtext/coref/berkeley/bansalklein/provider/SimpleDatabaseFeatureProvider.scala | Scala | gpl-3.0 | 848 |
import rx.lang.scala.Observable
import shared.JsRota
import scala.collection.immutable.IndexedSeq
import scala.collection.mutable
import scala.concurrent.Future
import scala.language.postfixOps
/**
* Created by gurghet on 05.04.16.
*/
class Rota(nDays: Int, team: Set[String]) {
private val shiftsPerDay = 3
pr... | gurghet/rota-scalajs | example-server/app/Rota.scala | Scala | mit | 8,757 |
package encapsulation.unit
import DistanceUnit._
object DistanceMiles {
def createMile(mile: Double): Distance = new Distance(mile * 1609.344)
def asMile(distance: Distance): Double = distance.meter * 0.00062137119224
}
| enpassant/miniatures | src/main/scala/encapsulation/unit/DistanceMiles.scala | Scala | apache-2.0 | 227 |
package com.github.mrmechko.strips.model
import monocle.macros.{GenLens, Lenses}
@Lenses("_") case class SFrame(role : String, optional : Boolean, fltype : String, features : List[(SFeatureType, SFeatureVal)])
object SFrame extends IdentifiableCompanion {
override def prefix: String = ""
}
| mrmechko/STrips | src/main/scala/com/github/mrmechko/strips/model/SFrame.scala | Scala | gpl-2.0 | 295 |
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.