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 |
|---|---|---|---|---|---|
import org.scalatest.Spec
import org.scalatest.matchers.ShouldMatchers
import us.troutwine.phonenumber.USPhoneNumber
class PhoneNumberSpec extends Spec with ShouldMatchers {
describe("A USPhoneNumber") {
it("should extract a valid number") {
val num0 = new USPhoneNumber("(541) 719-8703")
num0 shou... | blt/PhoneNumber | src/test/scala/PhoneNumberSpec.scala | Scala | mit | 1,612 |
package com.eevolution.context.dictionary.domain.model
import ai.x.play.json.Jsonx
import com.eevolution.context.dictionary.api.{ActiveEnabled, DomainModel, Identifiable, Traceable}
import org.joda.time.DateTime
/**
* Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
* This progra... | adempiere/ADReactiveSystem | dictionary-api/src/main/scala/com/eevolution/context/dictionary/domain/model/LdapProcessor.scala | Scala | gpl-3.0 | 3,785 |
package io.udash.demos.jquery.views.functions
import io.udash.demos.jquery.views.FunctionView
import io.udash.wrappers.jquery._
/** Based on examples from: <a href="http://api.jquery.com/after/">jQuery Docs</a>. */
object AfterBeforeView extends FunctionView {
import scalatags.JsDom.all._
override protected val... | UdashFramework/scala-js-jquery | example/src/main/scala/io/udash/demos/jquery/views/functions/AfterBeforeView.scala | Scala | apache-2.0 | 660 |
/*
* 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 ... | witgo/zen | ml/src/main/scala/com/github/cloudml/zen/ml/clustering/algorithm/AliasLDA.scala | Scala | apache-2.0 | 8,364 |
package breeze.stats.distributions
/*
Copyright 2009 David Hall, Daniel Ramage
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 ... | wstcpyt/breeze | math/src/test/scala/breeze/stats/distributions/ParetoTest.scala | Scala | apache-2.0 | 1,474 |
package openreveal.service
import com.hp.hpl.jena.rdf.model.{Resource, Model}
import com.hp.hpl.jena.vocabulary.RDF
import openreveal.model._
import openreveal.rdf.RdfInMemoryModelProvider
import openreveal.schema.OpenRevealSchema
import openreveal.service.impl.JenaFactStorage
import org.joda.time.{LocalDate, DateTime... | paul-lysak/OpenReveal | src/test/scala/openreveal/service/FactStorageSpec.scala | Scala | apache-2.0 | 9,724 |
/*
* Copyright 2017-2022 John Snow Labs
*
* 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... | JohnSnowLabs/spark-nlp | src/main/scala/com/johnsnowlabs/nlp/annotators/Lemmatizer.scala | Scala | apache-2.0 | 10,103 |
object Prob50 {
val setPrime = Prime.set(1000000)
val primes = Prime.primes(1000000).toStream
// return (sum, count)
def consPrimeSum(max: Int)(start: Int): (Int, Int) = {
val result = primes.dropWhile(_ < start).takeWhile(_ < max)
.foldLeft[List[Long]](Nil) { case (before, x) => (before.headOption.... | ponkotuy/ProjectEular | src/main/scala/Prob50.scala | Scala | mit | 796 |
package com.outr.arango.api
import com.outr.arango.api.model._
import io.youi.client.HttpClient
import io.youi.http.HttpMethod
import io.youi.net._
import io.circe.Json
import scala.concurrent.{ExecutionContext, Future}
object APIReplicationBatchId {
def delete(client: HttpClient, id: String)(implicit ec: Ex... | outr/arangodb-scala | api/src/main/scala/com/outr/arango/api/APIReplicationBatchId.scala | Scala | mit | 790 |
import scala.reflect.{ClassTag, classTag}
object Test extends dotty.runtime.LegacyApp {
def test[T: ClassTag](x: T): Unit = {
println(classTag[T].runtimeClass.isAssignableFrom(x.getClass))
println(classTag[T].unapply(x))
}
class X(val x: Int) extends AnyVal { override def toString = "X" }
val x = new ... | folone/dotty | tests/pending/run/t6318_derived.scala | Scala | bsd-3-clause | 489 |
package me.flygare
import java.text.SimpleDateFormat
import java.util.Calendar
import me.flygare.handlers.ProfileHandler
import me.flygare.models.ProfileDB
import me.flygare.traits.SparkConnection
import org.scalatest._
class ProfileSpec extends FunSpec with SparkConnection {
val profileHandler = new ProfileHandle... | flygare/Minopt | ProfileService/src/test/scala/me/flygare/ProfileSpec.scala | Scala | mit | 2,525 |
package lila.round
import akka.stream.scaladsl._
import org.joda.time.DateTime
import reactivemongo.akkastream.cursorProducer
import scala.concurrent.duration._
import lila.common.Bus
import lila.common.LilaStream
import lila.db.dsl._
import lila.game.{ Game, Pov }
final private class CorresAlarm(
coll: Coll,
... | luanlv/lila | modules/round/src/main/CorresAlarm.scala | Scala | mit | 2,685 |
package org.tribbloid.spookystuff.example.social
import org.tribbloid.spookystuff.SpookyContext
import org.tribbloid.spookystuff.actions._
import org.tribbloid.spookystuff.dsl._
import org.tribbloid.spookystuff.example.QueryCore
/**
* A more complex linkedIn job that finds name and printout skills of all Sanjay Gupt... | chenUT/spookystuff | example/src/main/scala/org/tribbloid/spookystuff/example/social/LinkedIn.scala | Scala | apache-2.0 | 1,099 |
/**
* 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... | curryhuang/CBCrunch | crunch-scrunch/target/test-classes/org/apache/crunch/scrunch/JoinTest.scala | Scala | apache-2.0 | 1,767 |
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package com.google.protobuf.`type`
import _root_.scalapb.internal.compat.JavaConverters._
/** A single field of a message type.
*
* @param kind
* The field type.
* @param cardinality
* The f... | dotty-staging/ScalaPB | scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/Field.scala | Scala | apache-2.0 | 31,435 |
/*
* 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
* distribute... | xerial/larray | larray-buffer/src/test/scala/xerial/larray/DataUnit.scala | Scala | apache-2.0 | 1,790 |
package org.scalamu.idea.runner
package ui
import javax.swing.JPanel
import com.intellij.openapi.options.SettingsEditor
import com.intellij.openapi.project.Project
class ScalamuMutatorsEditor(val project: Project) extends SettingsEditor[ScalamuRunConfiguration] {
private[this] val form = new ScalamuMutatorsForm(pr... | sugakandrey/scalamu | idea-plugin/src/main/scala/org/scalamu/idea/runner/ui/ScalamuMutatorsEditor.scala | Scala | gpl-3.0 | 562 |
/*
* Copyright 2015-2016 IBM Corporation
*
* 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... | nwspeete-ibm/openwhisk | tests/src/whisk/core/controller/test/RulesApiTests.scala | Scala | apache-2.0 | 39,991 |
/*
* Copyright 2019 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/releaser | src/test/scala/uk/gov/hmrc/CredentialsFinderSpecs.scala | Scala | apache-2.0 | 1,215 |
package nl.rabobank.oss.rules.dsl.core.types
import nl.rabobank.oss.rules.finance.core.Quantity
import scala.annotation.implicitNotFound
/**
* This type class allows values of different types to be added in the DSL.
*
* @tparam A type of the left hand side of the adding multiply
* @tparam B type of the right... | scala-rules/scala-rules | engine/src/main/scala/nl/rabobank/oss/rules/dsl/core/types/SubtractableValues.scala | Scala | mit | 1,302 |
package skinny.controller.feature
import skinny.SkinnyEnv
import skinny.engine.SkinnyEngineBase
/**
* SkinnyEnv support.
*/
trait EnvFeature extends SkinnyEngineBase {
/**
* Env string value from "skinny.env" or "org.scalatra.environment".
*
* @return env string such as "production"
*/
def skinnyEn... | holycattle/skinny-framework | framework/src/main/scala/skinny/controller/feature/EnvFeature.scala | Scala | mit | 1,273 |
/*
* 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 ... | BryanCutler/spark | core/src/test/scala/org/apache/spark/ui/UISuite.scala | Scala | apache-2.0 | 17,943 |
// Copyright (C) 2014 Fehmi Can Saglam (@fehmicans) and contributors.
// See the LICENCE.txt file distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Licen... | ReactiveMongo/ReactiveMongo-Extensions | json/src/test/scala/model/Person.scala | Scala | apache-2.0 | 1,007 |
package aoc.day03
import io.IO
object Part2 extends App {
/*
--- Part Two ---
The next year, to speed up the process, Santa creates a robot version of himself,
Robo-Santa, to deliver presents with him.
Santa and Robo-Santa start at the same location (delivering two presents to the
same starting house), then tak... | GuillaumeDD/AdventOfCode2015 | src/main/scala/aoc/day03/Part2.scala | Scala | gpl-3.0 | 2,090 |
/*
* 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... | travisbrown/scalatest | src/test/scala/org/scalautils/NormalizingEqualitySpec.scala | Scala | apache-2.0 | 4,070 |
package at.chaosfield.packupdate.frontend
import at.chaosfield.packupdate.common._
import org.jline.terminal.TerminalBuilder
object CliCallbacks extends UiCallbacks {
var currentStatus = ""
var currentTotal = 0
var currentProgress = 0
var progressShown = false
var currentSubStatus: Option[String] = None
... | XDjackieXD/PackUpdate | src/main/scala/at/chaosfield/packupdate/frontend/CliCallbacks.scala | Scala | apache-2.0 | 4,312 |
package org.jetbrains.plugins.scala.lang.psi.impl.statements
import javax.swing.Icon
import com.intellij.ide.util.EditSourceUtil
import com.intellij.lang.ASTNode
import com.intellij.navigation.ItemPresentation
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.psi.tree.IElementType
import... | gtache/intellij-lsp | intellij-lsp-dotty/src/org/jetbrains/plugins/scala/lang/psi/impl/statements/ScTypeAliasDeclarationImpl.scala | Scala | apache-2.0 | 3,701 |
package scala.generator
import lib.Text._
case class ScalaEnums(
ssd: ScalaService,
enum: ScalaEnum
) {
private[this] val unions = ssd.unionsForEnum(enum)
def build(): String = {
import lib.Text._
Seq(
enum.description.map { desc => ScalaUtil.textToComment(desc) + "\n" }.getOrElse("") +
... | movio/apidoc-generator | scala-generator/src/main/scala/models/generator/ScalaEnums.scala | Scala | mit | 3,937 |
package uk.gov.gds.ier.form
import uk.gov.gds.ier.validation.{ErrorTransformForm, FormKeys, Key}
import uk.gov.gds.ier.model.PartialManualAddress
trait AddressHelpers extends FormKeys {
/**
* Concatenate manual address, using comas, as one line of text or return None.
* Wrap as Option to allow eventual furth... | alphagov/ier-frontend | app/uk/gov/gds/ier/form/AddressHelpers.scala | Scala | mit | 2,598 |
package scalala
package operators
package bundles
import scalar.Scalar
import generic.math.CanNorm
import generic.collection.{CanZipMapValues, CanCopy, CanMapValues, CanCreateZerosLike}
/**
* A VectorSpace has vectors S with vector addition and multiplication
* by scalars, along with a privileged zero vector.
* We... | scalala/Scalala | src/main/scala/scalala/operators/bundles/VectorSpace.scala | Scala | lgpl-2.1 | 13,780 |
package org.powlab.jeye.decode
import org.powlab.jeye.core._
import org.powlab.jeye.core.Types._
import org.powlab.jeye.core.Descriptors._
import org.powlab.jeye.core.parsing.DescriptorParser._
import org.powlab.jeye.decode.expra.ExpressionHelpers._
import org.powlab.jeye.decode.processor.stack.StackInformator._
impor... | powlab/jeye | src/main/scala/org/powlab/jeye/decode/LocalVariableTrace.scala | Scala | apache-2.0 | 2,413 |
/*
* 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... | travisbrown/scalatest | src/test/scala/org/scalatest/tools/scalasbt/SlowSampleSuite.scala | Scala | apache-2.0 | 760 |
package com.webtrends.harness.command
import com.webtrends.harness.logging.Logger
import scala.concurrent.Future
trait BaseCommand {
protected val log : Logger
def path: String
def execute[T:Manifest](bean: Option[CommandBean]) : Future[BaseCommandResponse[T]]
}
| malibuworkcrew/wookie | wookiee-core/src/main/scala/com/webtrends/harness/command/BaseCommand.scala | Scala | apache-2.0 | 272 |
package us.my_family.metrics.configuration
trait MetricFormat
case object StatsDFormat extends MetricFormat
case object DogStatsDFormat extends MetricFormat
case object TelegrafFormat extends MetricFormat
| thrykol/metrics-client | client/src/main/scala/us/my_family/metrics/configuration/MetricFormat.scala | Scala | gpl-3.0 | 209 |
package fpinscala.answers.testing
import scala.language.implicitConversions
import scala.language.postfixOps
import scala.language.higherKinds
import fpinscala.answers.laziness.Stream
import fpinscala.answers.state._
import fpinscala.answers.parallelism._
import fpinscala.answers.parallelism.Par.Par
import Gen._
impo... | peterbecich/fpinscala | answers/src/main/scala/fpinscala/testing/Gen.scala | Scala | mit | 9,711 |
package com.twitter.finagle.http
import com.twitter.finagle.Http
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class Netty3StreamingTest extends AbstractStreamingTest {
def impl: Http.HttpImpl = Http.Netty3Impl
}
| mkhq/finagle | finagle-http/src/test/scala/com/twitter/finagle/http/Netty3StreamingTest.scala | Scala | apache-2.0 | 273 |
package fla
package metrics
import spire.math.abs
import spire.implicits._
import scalaz._
import Scalaz._
import cilib._
import cilib.pso._
import cilib.pso.PSO._
object FitnessCloudIndex {
private[this] def createParticle(pos: Position[Double]): Step[Double,Entity[Mem[Double],Double]] = {
// 4
val ... | cirg-up/fla | metrics/src/main/scala/fla/metrics/FitnessCloudIndex.scala | Scala | apache-2.0 | 3,828 |
package sample.snippet
import scala.xml.NodeSeq
import net.liftweb.http.{DispatchSnippet,SHtml}
import net.liftweb.util.Helpers._
class FormSample extends DispatchSnippet {
def dispatch = {
case _ => render _
}
var name = ""
def render(xhtml: NodeSeq): NodeSeq = {
(".text" #> SHtml.text(name, na... | timperrett/lift-in-action | chapter-14/src/main/scala/sample/snippet/FormSample.scala | Scala | apache-2.0 | 420 |
package utils
import java.io.File
import breeze.linalg._
import scala.reflect.ClassTag
import scala.util.Random
/**
* A collection of utilities useful for matrices.
*/
object MatrixUtils extends Serializable {
/**
* Converts a matrix to an array of rows.
* @param mat Input matrix.
* @return Array of ... | kcompher/keystone | src/main/scala/utils/MatrixUtils.scala | Scala | apache-2.0 | 2,424 |
package au.com.dius.pact.provider.scalasupport
import au.com.dius.pact.core.model.{OptionalBody, Response}
import scala.collection.JavaConverters._
object AnimalServiceResponses {
def contentHeaders: Map[String, java.util.List[String]] = Map("Content-Type" -> List("application/json; charset=UTF-8").asJava)
def ... | DiUS/pact-jvm | provider/scalasupport/src/test/scala/au/com/dius/pact/provider/scalasupport/AnimalServiceResponses.scala | Scala | apache-2.0 | 1,149 |
package ua.kata
import org.scalatest.{Matchers, WordSpec}
class BinaryTreeTest extends WordSpec with Matchers {
private val emptyTree: BinaryTree = BinaryTree()
"A Tree" when {
"created" should {
"be empty" in {
emptyTree should have size 0
}
}
"added an item" should {
"inc... | Alex-Diez/Scala-TDD-Katas | binary_tree_kata/iteration_01/binary_tree_day_02/src/test/scala/ua/kata/BinaryTreeTest.scala | Scala | mit | 1,373 |
/*
* Copyright 2012 Atlassian PTY LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | simpleenergy/kadai | cmdopts/src/main/scala/kadai/cmdopts/Example.scala | Scala | apache-2.0 | 1,849 |
/**
* 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... | unix1986/universe | tool/kafka-0.8.1.1-src/core/src/main/scala/kafka/producer/async/EventHandler.scala | Scala | bsd-2-clause | 1,214 |
/*
* Copyright 2022 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/iht-frontend | test/iht/views/registration/deceased/DeceasedPermanentHomeViewTest.scala | Scala | apache-2.0 | 2,296 |
/*
* 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 ... | gioenn/xSpark | sql/catalyst/src/main/scala/org/apache/spark/sql/types/Metadata.scala | Scala | apache-2.0 | 9,133 |
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package sdatabase
// #named-database
// ###insert: package controllers
import javax.inject.Inject
import play.api.mvc.BaseController
import play.api.mvc.ControllerComponents
import play.api.db.Database
import play.api.db.NamedDatabase
// inject "ord... | benmccann/playframework | documentation/manual/working/commonGuide/database/code/sdatabase/ScalaInjectNamed.scala | Scala | apache-2.0 | 570 |
import leon.lang._
import leon.lang.synthesis._
import leon.collection._
import leon.annotation._
object Tree {
sealed abstract class Tree
case object Empty extends Tree
case class Node(left: Tree, value: BigInt, right: Tree) extends Tree
sealed abstract class Dir
case object Left extends Dir
case object ... | epfl-lara/leon | testcases/verification/case-studies/TreePaths.scala | Scala | gpl-3.0 | 5,132 |
/*
* 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/pensions-lifetime-allowance-frontend | test/testHelpers/ViewSpecHelpers/withdraw/WithdrawConfirmSpecMessages.scala | Scala | apache-2.0 | 1,918 |
package lang.lightweightjava
import org.scalatest.{FlatSpec, Matchers}
class ParserTest extends FlatSpec with Matchers {
val p1 =
"class X {\\n" +
" X field;\\n" +
" Y field2;\\n" +
" X m2(X var1, Y var2) {\\n" +
" if (var1 == var2)\\n" +
" var1 = new X();\\n" +
... | matthisk/hygienic-transformations | scala/src/test/scala/lang/lightweightjava/ParserTest.scala | Scala | lgpl-3.0 | 3,256 |
package com.twitter.finagle.naming
import com.twitter.finagle.{Addr, Dtab, Path, Name, NameTree}
import com.twitter.util.{Var, Activity}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfter, FunSuite}
@RunWith(classOf[JUnitRunner])
class LoadedNameInterpreterTest... | koshelev/finagle | finagle-core/src/test/scala/com/twitter/finagle/naming/LoadedNameInterpreterTest.scala | Scala | apache-2.0 | 1,562 |
package intellijhocon.lang
import com.intellij.openapi.fileTypes.{FileTypeConsumer, FileTypeFactory}
class HoconFileTypeFactory extends FileTypeFactory {
def createFileTypes(consumer: FileTypeConsumer) =
consumer.consume(HoconLanguageFileType, HoconLanguageFileType.DefaultExtension)
}
| consulo/consulo-scala | intellij-hocon/src/main/scala/intellijhocon/lang/HoconFileTypeFactory.scala | Scala | apache-2.0 | 294 |
/*
* Code Pulse: A real-time code coverage testing tool. For more information
* see http://code-pulse.com
*
* Copyright (C) 2014 Applied Visions - http://securedecisions.avi.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
... | secdec/codepulse | project/FetchCache.scala | Scala | apache-2.0 | 2,391 |
/*
* Copyright (c) 2012 Yahoo! Inc. All rights reserved. Licensed under the
* Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
* or a... | markusweimer/ScalOps | src/main/scala/com/yahoo/scalops/examples/BatchGradientDescent.scala | Scala | apache-2.0 | 4,071 |
package blended.updater
import java.io.File
import akka.actor.{ActorSystem, actorRef2Scala}
import akka.testkit.{ImplicitSender, TestKit}
import blended.testsupport.TestFile
import blended.testsupport.TestFile.DeleteNever
import blended.updater.config._
import com.typesafe.config.ConfigFactory
import org.scalatest.{B... | lefou/blended | blended.updater/src/test/scala/blended/updater/UpdaterTest.scala | Scala | apache-2.0 | 15,158 |
package io.youi.form
sealed trait ValidationResult {
def asOption: Option[String]
}
object ValidationResult {
case class Failure(message: String) extends ValidationResult {
override def asOption: Option[String] = Some(message)
}
case object Success extends ValidationResult {
override def asOption: Opt... | outr/youi | dom/src/main/scala/io/youi/form/ValidationResult.scala | Scala | mit | 344 |
/*
* 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 ... | witgo/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SortOrder.scala | Scala | apache-2.0 | 8,461 |
package domino.test
import java.io.File
import scala.collection.JavaConverters.mapAsJavaMapConverter
import org.osgi.framework.BundleActivator
import de.kalpatec.pojosr.framework.PojoSR
import de.kalpatec.pojosr.framework.launch.PojoServiceRegistry
object PojoSrTestHelper {
val OnlyOnePojoSrAtATime = new Object... | domino-osgi/domino | src/test/scala/domino/test/PojoSrTestHelper.scala | Scala | mit | 1,507 |
package edu.colorado.plv.cuanto.wala
import com.typesafe.scalalogging.LazyLogging
import java.net.URL
import com.ibm.wala.classLoader.{IClass, IMethod}
import com.ibm.wala.ipa.callgraph.impl.Everywhere
import com.ibm.wala.ipa.callgraph.{AnalysisCache, AnalysisCacheImpl, AnalysisScope}
import com.ibm.wala.ipa.cha.{Cl... | cuplv/cuanto | src/main/scala/edu/colorado/plv/cuanto/wala/Client.scala | Scala | apache-2.0 | 5,994 |
package $package$
import $package$.api.APIServiceContext
import $package$.model.Ticker
import android.os.Build.VERSION_CODES._
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
import org.scalatest.{RobolectricSuite, Matchers, FlatSpec}
/**
*/
@Config(sdk = Array(LOLLIPOP))
class AP... | aafa/rest-android-scala.g8 | src/main/g8/src/test/scala/$package$/APITests.scala | Scala | mit | 619 |
package maths
import org.apache.commons.math3.random.{SynchronizedRandomGenerator,Well44497b}
import scala.compat.Platform
import com.github.nscala_time.time.Imports._
trait Random {
def get: Double
def get(low: Double, high: Double): Double
def getPlusMinus: Double
def getPercent : Double
def getAngle ... | shawes/zissou | src/main/scala/maths/RandomNumberGenerator.scala | Scala | mit | 1,057 |
/*
* 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 ... | mbaijal/incubator-mxnet | scala-package/core/src/main/scala/org/apache/mxnet/io/ResizeIter.scala | Scala | apache-2.0 | 3,850 |
/*
* 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 ... | jackylk/incubator-carbondata | integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/complexType/TestComplexTypeWithBigArray.scala | Scala | apache-2.0 | 4,774 |
import scala.reflect.macros.blackbox.Context
object Macros {
def impl[T](c: Context) = { import c.universe._; c.Expr[Unit](q"()") }
def foo[T] = macro impl[T]
}
| AlexSikia/dotty | tests/pending/pos/t5692a/Macros_1.scala | Scala | bsd-3-clause | 166 |
import java.util
object EarlyDefRecursion {
class A[T](t: T) {
def foo = 1
}
class B extends {
val x = new util.ArrayList[String]()
} with A(x.get(1)) {
/*start*/super.foo/*end*/
}
}
//Int | ilinum/intellij-scala | testdata/typeInference/bugs5/EarlyDefRecursion.scala | Scala | apache-2.0 | 212 |
package chess
case class Piece(color: Color, role: Role) {
def is(c: Color) = c == color
def is(r: Role) = r == role
def isNot(r: Role) = r != role
def oneOf(rs: Set[Role]) = rs(role)
def isMinor = oneOf(Set(Knight, Bishop))
def isMajor = oneOf(Set(Queen, Rook))
def forsyth: Char = if (color == White... | psuter/scalachess | src/main/scala/Piece.scala | Scala | mit | 1,415 |
import scala.reflect.macros.blackbox.Context
trait ImplContainer {
object Impls {
def foo(c: Context)(x: c.Expr[Any]) = x
}
} | felixmulder/scala | test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala | Scala | bsd-3-clause | 134 |
package metabrowse.cli
import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import java.security.MessageDigest
object FingerprintOps {
def md5(string: String): String = {
md5(ByteBuffer.wrap(string.getBytes(StandardCharsets.UTF_8)))
}
def md5(buffer: ByteBuffer): String = {
val md = Mes... | scalameta/metadoc | metabrowse-cli/src/main/scala/metabrowse/cli/FingerprintOps.scala | Scala | apache-2.0 | 783 |
package example.typeclass
import org.scalacheck._
import Prop._
import Arbitrary.arbitrary
// From https://github.com/prurph/fsis-scala/blob/master/src/test/scala/FunctorTest.scala
abstract class FunctorInstanceTest[F[_]](name: String)(implicit
F: Functor[F],
arbitraryFInt: Arbitrary[F[Int]],
eqFInt: Equal[F[In... | stevenchen3/feed-cats | src/test/scala/typeclass/FunctorCheckLawsSpec.scala | Scala | mit | 787 |
package org.eigengo.sogx.core
import org.eigengo.sogx._
import org.springframework.integration.annotation.{Payload, Header}
/**
* Implementations implement the ``onCoinResponse`` method to handle the coin responses.
*/
trait RecogServiceActivator {
/**
* Called when a frame has been successfully processed by ... | janm399/springone2gx2013 | jvm/src/main/scala/org/eigengo/sogx/core/RecogServiceActivator.scala | Scala | apache-2.0 | 527 |
/*
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Ryan C. Brozo
*
* 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 use, cop... | ryanbrozo/spray-hawk | lib/src/main/scala/com/ryanbrozo/spray/hawk/HawkRouteDirectives.scala | Scala | mit | 6,385 |
/* Copyright 2009-2018 EPFL, Lausanne */
package inox
package ast
import utils.Lazy
import utils.Graphs._
trait CallGraph {
protected val trees: Trees
import trees._
import trees.exprOps._
protected val symbols: Symbols
protected trait Collector extends SelfTreeTraverser {
private[this] var ids: Set[I... | romac/inox | src/main/scala/inox/ast/CallGraph.scala | Scala | apache-2.0 | 4,988 |
//
// Copyright 2014-2020 Paytronix Systems, 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 ... | paytronix/utils-open | interchange/avro/src/test/scala/com/paytronix/utils/interchange/format/avro/tupleSpec.scala | Scala | apache-2.0 | 6,848 |
/**
* Copyright 2011-2013 StackMob
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | matthewfarwell/stackmob-customcode-dev | src/main/scala/com/stackmob/customcode/dev/server/sdk/push/JsonReaders.scala | Scala | apache-2.0 | 2,940 |
/*
* Copyright (c) 2014-2015 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apach... | snowplow/schema-guru | src/main/scala/com.snowplowanalytics/schemaguru/utils/FileUtils.scala | Scala | apache-2.0 | 3,965 |
package io.scalding.taps.elasticsearch.jobtestsupport
import com.twitter.scalding.{Csv, Job, Args}
import io.scalding.taps.elasticsearch.EsSource
class ReadFromES(args: Args) extends Job(args) {
val fields = ('name, 'age, 'address)
val source = EsSource("test/personFull").withHost("localhost").withPort(9200).... | lucamilanesio/scalding-taps | src/main/scala/io/scalding/taps/elasticsearch/jobtestsupport/ReadFromES.scala | Scala | apache-2.0 | 385 |
/*
* 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 ... | kimoonkim/spark | core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala | Scala | apache-2.0 | 23,490 |
package org.joda.time
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.io.Serializable
import java.util.Locale
import org.joda.convert.FromString
import org.joda.time.base.BaseDateTime
import org.joda.time.chrono.ISOChronology
import org.joda.time.field.AbstractReadableInstantFieldPropert... | mdedetrich/soda-time | shared/src/main/scala/org/joda/time/MutableDateTime.scala | Scala | bsd-2-clause | 16,591 |
package lila.puzzle
import akka.actor.{ ActorSelection, ActorSystem }
import com.typesafe.config.Config
import lila.common.PimpedConfig._
final class Env(
config: Config,
db: lila.db.Env,
renderer: ActorSelection,
system: ActorSystem) {
private val settings = new {
val CollectionPuzzle = confi... | danilovsergey/i-bur | modules/puzzle/src/main/Env.scala | Scala | mit | 1,732 |
package polytope.tests
import org.junit.runner.RunWith
import org.scalatest._
import org.scalatest.junit.JUnitRunner
import polytope._
import scala.collection.immutable.Set
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.HashMap
abstract class UnitSpec extends FlatSpec with ShouldMatche... | expz/polytope | src/test/scala/packageSuite.scala | Scala | gpl-3.0 | 5,793 |
/*
* 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 ... | ConeyLiu/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala | Scala | apache-2.0 | 76,897 |
package de.sciss.synth.ugen
import de.sciss.synth.{AudioRated, GE, HasDoneFlag, UGenInLike, UGenSpec, UndefinedRate}
import scala.collection.immutable.{IndexedSeq => Vec}
import scala.language.implicitConversions
trait EnvGenCompanion extends Product {
protected implicit def floatArg(f: Float): UGenSpec.ArgumentVa... | Sciss/MutagenTx | src/main/scala/de/sciss/synth/ugen/Envelopes.scala | Scala | gpl-3.0 | 8,358 |
package org.bitcoins.core.util
import org.bitcoins.testkitcore.util.BitcoinSUnitTest
import scodec.bits.BitVector
/** Created by chris on 4/1/16.
*/
class BitcoinSUtilTest extends BitcoinSUnitTest {
"BitcoinSUtil" must "determine if a string is a hex string" in {
BytesUtil.isHex("abcdef0123456789") must be(t... | bitcoin-s/bitcoin-s | core-test/src/test/scala/org/bitcoins/core/util/BitcoinSUtilTest.scala | Scala | mit | 2,150 |
package services
import utils.HttpWrapper
import scala.concurrent.duration._
import play.api.{Logger, Play}
import scala.language.implicitConversions
/**
* Interface of remote services used by CASA.
*/
trait CasaRemoteService {
def getUrlPropertyName: String
def getDefaultUrl: String
def getTimeoutPropert... | Department-for-Work-and-Pensions/CarersAllowanceStaffAccess | casa/app/services/CasaRemoteService.scala | Scala | mit | 1,071 |
package org.raisercostin.jedi
import java.io.File
import scala.language.implicitConversions
import scala.language.reflectiveCalls
import java.nio.file.Files
case class TempLocation(temp: File, append: Boolean = false) extends FileLocation {self=>
override def withAppend: self.type = this.copy(append = true)
def ... | raisercostin/jedi-io | src/main/scala/org/raisercostin/jedi/TempLocation.scala | Scala | apache-2.0 | 847 |
package scalax.collection.constrained
import org.scalatest.Suites
import scalax.collection.{TEdit, ConfigWrapper}
import org.scalatest.junit.JUnitRunner
import org.junit.runner.RunWith
@RunWith(classOf[JUnitRunner])
class TEditRootTest
extends Suites(
new TEdit[Graph] (new ConfigWrappe... | Calavoow/scala-graph | constrained/src/test/scala/scalax/collection/constrained/TEdit.scala | Scala | bsd-3-clause | 945 |
/*
* Copyright 2009-2017. DigitalGlobe, 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 ... | ngageoint/mrgeo | mrgeo-mapalgebra/mrgeo-mapalgebra-costdistance/src/main/scala/org/mrgeo/mapalgebra/LeastCostPathCalculator.scala | Scala | apache-2.0 | 8,148 |
package slick.codegen
import java.io.File
import java.io.BufferedWriter
import java.io.FileWriter
import slick.SlickException
/** Output-related code-generation utilities. */
trait OutputHelpers{
def code: String
/** The parent type of the generated main trait. This can be overridden in subclasses. */
def paren... | dotta/slick | slick-codegen/src/main/scala/slick/codegen/OutputHelpers.scala | Scala | bsd-2-clause | 3,086 |
package pl.combosolutions.backup.psm.programs.posix
import pl.combosolutions.backup.{ ReportException, Result }
import pl.combosolutions.backup.psm.PsmExceptionMessages.UnknownFileType
import pl.combosolutions.backup.psm.filesystem.FileType.{ Directory, File, FileType, SymbolicLink }
import pl.combosolutions.backup.ps... | MateuszKubuszok/BackupDSL | modules/psm/src/main/scala/pl/combosolutions/backup/psm/programs/posix/PosixPrograms.scala | Scala | mit | 1,964 |
/*
* Copyright 2011-2022 GatlingCorp (https://gatling.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 appli... | gatling/gatling | gatling-core/src/main/scala/io/gatling/core/stats/writer/DataWriterMessage.scala | Scala | apache-2.0 | 2,725 |
package scredis.commands
import org.scalatest._
import org.scalatest.concurrent._
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import scredis._
import scredis.exceptions._
import scredis.protocol.requests.StringRequests._
import scredis.tags._
import scredis.util.TestUtils._
import scala.concurr... | scredis/scredis | src/test/scala/scredis/commands/StringCommandsSpec.scala | Scala | apache-2.0 | 27,379 |
package io.eels.component.hive.dialect
import com.sksamuel.exts.Logging
import io.eels.component.avro.{AvroSourcePart, AvroWriter}
import io.eels.component.hive.{HiveDialect, HiveWriter}
import io.eels.schema.StructType
import io.eels.{CloseableIterator, Predicate, Row}
import org.apache.hadoop.conf.Configuration
impo... | stheppi/eel | eel-hive/src/main/scala/io/eels/component/hive/dialect/AvroHiveDialect.scala | Scala | apache-2.0 | 1,367 |
/*
* Copyright 2012 Twitter Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed t... | c3p0hz/zipkin | zipkin-query-service/config/query-redis.scala | Scala | apache-2.0 | 1,199 |
package com.overviewdocs.jobhandler.filegroup
import scala.collection.mutable
/** Generates reusable IDs for concurrent workers.
*
* Usage:
*
* pool = TaskIdPool()
* pool.acquireId() // returns 1
* pool.acquireId() // returns 2
* pool.releaseId(1)
* pool.acquireId() // returns 1
*
* This... | overview/overview-server | worker/src/main/scala/com/overviewdocs/jobhandler/filegroup/TaskIdPool.scala | Scala | agpl-3.0 | 731 |
package com.esri.dbscan
/**
* Base trait for 2D input.
*/
trait DBSCANPoint2D extends DBSCANPoint {
/**
* @return the horizontal coordinate.
*/
def x: Double
/**
* @return the vertical coordinate.
*/
def y: Double
/**
* Calculate the distance squared to other point.
*
* @param that t... | mraad/dbscan-scala | src/main/scala/com/esri/dbscan/DBSCANPoint2D.scala | Scala | apache-2.0 | 531 |
package geotrellis.rest
object ParamParser {
/**
* Turn exceptions into Option[A]. It's magic!
*/
def tryIt[A](a: => A):Option[A] = try {
Some(a)
} catch {
case _ => None
}
/**
* Non-exceptions versions of your favorite Java methods!
*/
def getInt(s:String) = tryIt(s.toInt)
def getLo... | Tjoene/thesis | Case_Programs/geotrellis-0.7.0/src/main/scala/geotrellis/rest.scala | Scala | gpl-2.0 | 2,036 |
package models.quiz
import com.artclod.slick.JodaUTC
import controllers.quiz.{QuestionJson, QuizJson}
import models.UserId
import org.joda.time.DateTime
import play.twirl.api.Html
case class QuizFrame(quiz: Quiz, questions: Vector[QuestionFrame])
object QuizFrame {
// ==== JSON to Frame ====
def apply(ownerId: ... | kristiankime/calc-tutor | app/models/quiz/QuizFrame.scala | Scala | mit | 648 |
/**
* 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... | ErikKringen/kafka | core/src/main/scala/kafka/producer/async/ProducerSendThread.scala | Scala | apache-2.0 | 4,350 |
/*
* Copyright 2017 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | pncampbell/ct-calculations | src/test/scala/uk/gov/hmrc/ct/accounts/frs102/boxes/AC70Spec.scala | Scala | apache-2.0 | 4,668 |
package mesosphere.marathon
package core.instance
import mesosphere.marathon.Protos.MarathonTask
import mesosphere.marathon.core.condition.Condition
import mesosphere.marathon.core.pod.MesosContainer
import mesosphere.marathon.core.task.bus.MesosTaskStatusTestHelper
import mesosphere.marathon.core.task.state.{ Network... | natemurthy/marathon | src/test/scala/mesosphere/marathon/core/instance/TestTaskBuilder.scala | Scala | apache-2.0 | 20,740 |
/*******************************************************************************
Copyright (c) 2013-2014, S-Core, KAIST.
All rights reserved.
Use is subject to license terms.
This distribution may include materials developed by third parties.
*********************************************************... | darkrsw/safe | src/main/scala/kr/ac/kaist/jsaf/analysis/typing/models/Tizen/TIZENDownloadRequest.scala | Scala | bsd-3-clause | 8,871 |
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.