code stringlengths 5 1M | repo_name stringlengths 5 109 | path stringlengths 6 208 | language stringclasses 1
value | license stringclasses 15
values | size int64 5 1M |
|---|---|---|---|---|---|
/**
* Copyright (C) 2014 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 applicable... | mt0803/streaming-cep-engine | api/src/main/scala/com/stratio/streaming/api/kafka/KafkaProducer.scala | Scala | apache-2.0 | 2,104 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Algolia
* http://www.algolia.com/
*
* 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... | algolia/algoliasearch-client-scala | src/test/scala/algolia/integration/ABTestIntegrationTest.scala | Scala | mit | 5,939 |
package hulk.http.response
import java.io.{StringWriter, StringReader}
import akka.http.scaladsl.model.ContentTypes
import akka.util.ByteString
import com.github.mustachejava.DefaultMustacheFactory
import play.api.libs.json.{Json => PJson, JsValue}
import scala.collection.JavaConverters._
import scala.io.Codec
impor... | reneweb/hulk | framework/src/main/scala/hulk/http/response/HttpResponseBodyWriter.scala | Scala | apache-2.0 | 2,944 |
package com.seanshubin.iteration.tracker.server
import com.seanshubin.http.values.domain.{Receiver, RequestValue, Route}
class DatabaseRoute(name: String, receiver: Receiver) extends Route(name, receiver) {
override def accept(request: RequestValue): Boolean = {
val shouldAccept = request.uri.path.startsWith("/... | SeanShubin/iteration-tracker | server/src/main/scala/com/seanshubin/iteration/tracker/server/DatabaseRoute.scala | Scala | unlicense | 355 |
package cassandra.cql
import org.joda.time.DateTime
trait CqlValue {
def values: String
}
case class CqlType(name: String, fields: (String, CqlValue)*) extends CqlValue {
override lazy val values = s"{${
fields
.map { case (k, v) => s"$k:${v.values}"}
.mkString(",")
}}"
}
case class CqlTuple(f... | fabianmurariu/cassandra-scala-nuveau-driver | cql/lib/src/main/scala/cassandra/cql/CqlValue.scala | Scala | apache-2.0 | 1,566 |
package cromwell.core.logging
import java.util.regex.Pattern
object LoggingTest {
def escapePattern(pattern: String) = Pattern.quote(pattern)
}
| ohsu-comp-bio/cromwell | core/src/test/scala/cromwell/core/logging/LoggingTest.scala | Scala | bsd-3-clause | 148 |
/*
* 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 ... | aokolnychyi/spark | examples/src/main/scala/org/apache/spark/examples/mllib/IsotonicRegressionExample.scala | Scala | apache-2.0 | 2,674 |
/*
* Copyright (c) 2013 Christos KK Loverdos
*
* 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... | loverdos/scalapipes | src/main/scala/com/ckkloverdos/pipes/collection/mutable/PSeq.scala | Scala | apache-2.0 | 3,200 |
/*
* 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 ... | sachintyagi22/spark | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala | Scala | apache-2.0 | 20,964 |
// Copyright (C) 2015 ENSIME Authors
// License: GPL 3.0
package org.ensime.util
import Predef.{ any2stringadd => _ }
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.IOException
import org.scalatest._
class IoSpec extends FlatSpec with Matchers {
import io._
val bytes = A... | eddsteel/ensime | util/src/test/scala/org/ensime/util/IoSpec.scala | Scala | gpl-3.0 | 779 |
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author Matthew Saltz, John Miller
* @version 1.3
* @date Fri Jul 10 12:39:33 EDT 2015
* @see LICENSE (MIT style license file).
*/
package scalation.graphalytics
package mutable
import java.io.PrintWriter
import scala.... | NBKlepp/fda | scalation_1.3/scalation_modeling/src/main/scala/scalation/graphalytics/mutable/MGraphIO.scala | Scala | mit | 11,333 |
/*
* Copyright (C) 2020 MapRoulette contributors (see CONTRIBUTORS.md).
* Licensed under the Apache License, Version 2.0 (see LICENSE).
*/
package org.maproulette.framework.service
import javax.inject.{Inject, Singleton}
import org.maproulette.data.{UserType}
import org.maproulette.exception.{NotFoundException, In... | mgcuthbert/maproulette2 | app/org/maproulette/framework/service/FollowService.scala | Scala | apache-2.0 | 7,828 |
/*
* 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 ... | practice-vishnoi/dev-spark-1 | mllib/src/test/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifierSuite.scala | Scala | apache-2.0 | 3,877 |
object ORSet {
def empty[A]: ORSet[A] = ???
}
final class ORSet[A] {
def add(node: Long, element: A): ORSet[A] = ???
def add(node: Int, element: A): ORSet[A] = ???
}
class Test {
ORSet.empty.add(42, "A")
}
| scala/scala | test/files/pos/t11511.scala | Scala | apache-2.0 | 216 |
package org.decaf.distributed.server
import akka.http.scaladsl.Http
import akka.http.scaladsl.server.Route
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.model.StatusCodes
import akka.stream.ActorMaterializer
trait HttpServer {
def routes: Route
def startHttpServer(): Unit = {
implici... | adamdecaf/distributed | server/src/main/scala/HttpServer.scala | Scala | apache-2.0 | 828 |
package org.jetbrains.plugins.scala
package lang
package psi
package stubs
package index
import _root_.org.jetbrains.plugins.scala.lang.psi.impl.search.ScSourceFilterScope
import com.intellij.psi.stubs.StringStubIndexExtension
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope... | consulo/consulo-scala | src/org/jetbrains/plugins/scala/lang/psi/stubs/index/ScDirectInheritorsIndex.scala | Scala | apache-2.0 | 1,276 |
//: ----------------------------------------------------------------------------
//: Copyright (C) 2015 Verizon. 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 Licen... | Verizon/journal | core/src/main/scala/journal/Logger.scala | Scala | apache-2.0 | 4,554 |
package org.ucombinator.jaam.interpreter.snowflakes
import scala.collection.JavaConversions._
import scala.collection.mutable
import soot.{Main => SootMain, Unit => SootUnit, Value => SootValue, _}
import soot.jimple.{Stmt => SootStmt, _}
import org.ucombinator.jaam.util.Log
import org.ucombinator.jaam.interpreter._
... | Ucombinator/jaam | src/main/scala/org/ucombinator/jaam/interpreter/snowflakes/DefaultSnowflakes.scala | Scala | bsd-2-clause | 11,939 |
package libref.proof
import libref.collection._
import libref.proof.MinOps._
import libref.proof.SortedListOps._
import leon.lang._
import scala.language.postfixOps
import scala.language.implicitConversions
object SetLemmas {
// implicit def setAsList[A] (set: Set[A]): List[A] = choose {
// (x: List[A]) => ... | fmlab-iis/LibRef | proof/set.scala | Scala | gpl-3.0 | 1,177 |
object ListC {
class T1[A]
class T2[A]
implicit def getT[A]: T1[A] with T2[A] = null
}
class Test {
import ListC._
def foo[T[_], A](implicit a: T[A]): T[A] = a
val bar: T1[Int] = /*start*/foo/*end*/
}
//ListC.T1[Int] | ilinum/intellij-scala | testdata/typeInference/higherKinds/SCL10857_1.scala | Scala | apache-2.0 | 229 |
/**
* Copyright (c) 2015, Cloudera, Inc. All Rights Reserved.
*
* Cloudera, Inc. licenses this file to you 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/LIC... | cloudera/spark-timeseries | src/main/scala/com/cloudera/sparkts/Frequency.scala | Scala | apache-2.0 | 5,904 |
/*
* 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... | rahulkavale/scalatest | scalatest-test/src/test/scala/org/scalatest/ShorthandShouldNotBeThrownBySpec.scala | Scala | apache-2.0 | 2,731 |
package example
import scala.annotation.tailrec
object Lists {
/**
* This method computes the sum of all elements in the list xs. There are
* multiple techniques that can be used for implementing this method, and
* you will learn during the class.
*
* For this example assignment you can use the fol... | masipauskas/coursera-scala | progfun2/example/src/main/scala/example/Lists.scala | Scala | unlicense | 1,882 |
package no.uio.musit.functional
import no.uio.musit.MusitResults.{
MusitError,
MusitResult,
MusitSuccess,
MusitValidationError
}
import scala.concurrent.{ExecutionContext, Future}
/* Some common functional signatures:
Assume M is a typical structure having the given operation, the "elevated" world.
(... | MUSIT-Norway/musit | musit-models/src/main/scala/no/uio/musit/functional/FutureMusitResult.scala | Scala | gpl-2.0 | 6,030 |
package com.blogspot.ramannanda.scala.algorithms.cp3.adhoc.anagrams
import scala.collection.mutable.ListBuffer
import scala.io.StdIn
//uva 00195
object Permutations {
def permute(word: String): Seq[String] = {
def permuteRec(prefix: String, word: String): Seq[String] = {
if (word.length == 1) {
S... | ramannanda9/algorithms-in-scala | src/main/scala/com/blogspot/ramannanda/scala/algorithms/cp3/adhoc/anagrams/Permutations.scala | Scala | gpl-3.0 | 841 |
package views.html
package auth
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import controllers.routes
object signup {
def apply(form: lila.security.HcaptchaForm[_])(implicit ctx: Context) =
views.html.base.layout(
title = trans.signUp.txt(),
... | luanlv/lila | app/views/auth/signup.scala | Scala | mit | 2,312 |
/**
* scala-relaxng
* For all details and documentation:
* http://github.com/inkling/scala-relaxng
*
* Copyright 2011 Inkling 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 Licen... | inkling/scala-relaxng | src/test/scala/ArbitraryInstancesSpec.scala | Scala | apache-2.0 | 2,000 |
/*
* 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 ... | tzulitai/flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/runtime/aggregate/DataSetTumbleCountWindowAggReduceGroupFunction.scala | Scala | apache-2.0 | 3,021 |
package pl.touk.nussknacker.engine.avro.schemaregistry.confluent.client
import com.typesafe.scalalogging.LazyLogging
import io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException
import io.confluent.kafka.schemaregistry.client.{SchemaMetadata, MockSchemaRegistryClient => CMockSchemaRegistryClient... | TouK/nussknacker | utils/avro-components-utils/src/main/scala/pl/touk/nussknacker/engine/avro/schemaregistry/confluent/client/MockSchemaRegistryClient.scala | Scala | apache-2.0 | 1,529 |
package chandu0101.scalajs.rn.apis
import scala.scalajs.js
trait NetInfo extends js.Object{
val isConnected : NetInfoIsConnected = js.native
val reachabilityIOS : NetInfoReachabilityIOS = js.native
}
trait NetInfoIsConnected extends js.Object{
def addEventListener(eventName : String,handler : (Boolean) =>... | beni55/scalajs-react-native | core/src/main/scala/chandu0101/scalajs/rn/apis/NetInfo.scala | Scala | apache-2.0 | 739 |
package ammonite.session
import ammonite.TestUtils._
import ammonite.TestRepl
import ammonite.util.{Res, Util}
import utest._
object AdvancedTests extends TestSuite{
val tests = TestSuite{
println("AdvancedTests")
val check = new TestRepl()
'pprint{
check.session(s"""
@ Seq.fill(10)(Seq.f... | alexarchambault/ammonium | amm/src/test/scala/ammonite/session/AdvancedTests.scala | Scala | mit | 9,241 |
package gitbucket.core.plugin
import gitbucket.core.controller.Context
import gitbucket.core.service.RepositoryService.RepositoryInfo
/**
* The base trait of suggestion providers which supplies completion proposals in some text areas.
*/
trait SuggestionProvider {
/**
* The identifier of this suggestion provi... | gencer/gitbucket | src/main/scala/gitbucket/core/plugin/SuggestionProvider.scala | Scala | apache-2.0 | 3,213 |
/*
* Copyright 2014 Treode, 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... | Treode/store | store/src/com/treode/store/catalog/Chronicle.scala | Scala | apache-2.0 | 2,829 |
/*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api.db
import java.sql.Connection
import javax.sql.DataSource
/**
* Database API.
*/
trait Database {
/**
* The configuration name for this database.
*/
def name: String
/**
* The underlying JDBC data source f... | wsargent/playframework | framework/src/play-jdbc-api/src/main/scala/play/api/db/Database.scala | Scala | apache-2.0 | 2,204 |
package objsets
import TweetReader._
/**
* A class to represent tweets.
*/
class Tweet(val user: String, val text: String, val retweets: Int) {
override def toString: String =
"User: " + user + "\n" +
"Text: " + text + " [" + retweets + "]"
}
/**
* This represents a set of objects of type `Tweet` in t... | jan-kelemen/oc-coursera-progfun1 | w3/objsets/src/main/scala/objsets/TweetSet.scala | Scala | mit | 6,964 |
package dotty.tools.dotc
package transform
import core._
import Contexts._, Symbols._, Types._, Flags._, Decorators._, StdNames._, Constants._
import MegaPhase._
import SymUtils._
import ast.Trees._
import dotty.tools.dotc.reporting.messages.TypeMismatch
import dotty.tools.dotc.util.Spans.Span
/** Expand SAM closures... | som-snytt/dotty | compiler/src/dotty/tools/dotc/transform/ExpandSAMs.scala | Scala | apache-2.0 | 7,261 |
package is.hail.types.physical
import is.hail.annotations.Region
import is.hail.asm4s._
import is.hail.types.virtual.TLocus
import is.hail.variant._
abstract class PLocus extends PType {
def rgBc: BroadcastRG
lazy val virtualType: TLocus = TLocus(rgBc)
def rg: ReferenceGenome
def contig(value: Long): Strin... | hail-is/hail | hail/src/main/scala/is/hail/types/physical/PLocus.scala | Scala | mit | 549 |
package edu.berkeley.nlp.summ.data
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.HashMap
import scala.collection.mutable.HashSet
import edu.berkeley.nlp.futile.tokenizer.PTBLineLexer
case class DiscourseTree(val name: String,
val rootNode: DiscourseNode) extend... | gregdurrett/berkeley-doc-summarizer | src/main/scala/edu/berkeley/nlp/summ/data/DiscourseTree.scala | Scala | gpl-3.0 | 14,624 |
/******************************************************************************
Copyright (c) 2012-2013, KAIST, S-Core.
All rights reserved.
Use is subject to license terms.
This distribution may include materials developed by third parties.
**********************************************************... | daejunpark/jsaf | src/kr/ac/kaist/jsaf/bug_detector/BugHelper.scala | Scala | bsd-3-clause | 6,484 |
package mesosphere.marathon
import com.github.fge.jackson.JsonLoader
import com.github.fge.jsonschema.core.report.ProcessingReport
import com.github.fge.jsonschema.main.JsonSchemaFactory
import mesosphere.marathon.Protos.MarathonTask
import mesosphere.marathon.api.JsonTestHelper
import mesosphere.marathon.api.v2.json.... | sledigabel/marathon | src/test/scala/mesosphere/marathon/MarathonTestHelper.scala | Scala | apache-2.0 | 5,539 |
// // Fitness: 12
// // ---
// // (0,0) 1,0 2,0 3,0
// // 0,1 3,1
// // 0,2 3,2
// // 0,3 1,3 2,3 3,3
//
// package com.routably.beessolver.vrp.data
//
// import com.routably.beessolver.vrp.Location
// import com.routably.beessolver.vrp.Job
//
// object Simple extends Proble... | aishfenton/bees_solver | src/main/scala/com/routably/beessolver/vrp/data/Simple.scala | Scala | mit | 903 |
package com.github.sstone.amqp.samples
import akka.actor.{Props, Actor, ActorSystem}
import com.github.sstone.amqp.{ChannelOwner, ConnectionOwner, Amqp}
import com.github.sstone.amqp.Amqp._
import com.rabbitmq.client.ConnectionFactory
import scala.concurrent.duration._
object PublisherConfirms extends App {
implic... | gawkermedia/amqp-client | src/main/scala/com/github.sstone/amqp/samples/PublisherConfirms.scala | Scala | mit | 1,594 |
import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf,SparkContext}
object CollectMap{
def main(args:Array[String]){
val conf = new SparkConf().setAppName("RDD Aggregate").setMaster("local")
val sc = new SparkContext(conf)
val citi = sc.textFile("./citi")
val citiPairRDD = citi.map(row => (row.spl... | malli3131/SparkApps | RDD_API_Calls/CollectMap.scala | Scala | apache-2.0 | 423 |
/*
* Copyright 2014 http4s.org
*
* 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... | http4s/blaze | http/src/main/scala/org/http4s/blaze/http/logsensitiveinfo.scala | Scala | apache-2.0 | 827 |
/*
* Copyright 2018 Analytics Zoo 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... | intel-analytics/analytics-zoo | zoo/src/main/scala/com/intel/analytics/zoo/pipeline/api/net/TorchOptim.scala | Scala | apache-2.0 | 8,829 |
package com.nn.math.activations
import scala.collection.mutable.ArrayBuffer
/**
* Parent Abstract class to represent our activation functions
* Created by george on 12/8/14.
*/
abstract class ActivationFunction {
def activation(inputs : Vector[Double], weights: Vector[Double]): Double
}
| GeorgeDittmar/Scala-NeuralNet | src/main/scala/com/nn/math/activations/ActivationFunction.scala | Scala | apache-2.0 | 295 |
/*
* Copyright 2016 Dennis Vriend
*
* 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... | prettynatty/akka-persistence-jdbc | src/main/scala/akka/persistence/jdbc/journal/EventsByPersistenceIdTagSubscriberRegistry.scala | Scala | apache-2.0 | 3,955 |
package it.codingjam.lagioconda
import java.awt.geom.Ellipse2D
import java.awt.image.BufferedImage
import java.awt.{Graphics2D, RenderingHints}
import it.codingjam.lagioconda.ga.{Gene, _}
package object conversions {
implicit class CircleToGene(circle: Circle) {
private def to5bits(i: Int) = {
require(... | coding-jam/lagioconda | common/src/main/scala/it/codingjam/lagioconda/conversions.scala | Scala | apache-2.0 | 4,404 |
package blended.updater.config
import java.io._
import com.typesafe.config.{ Config, ConfigFactory, ConfigRenderOptions }
import blended.util.logging.Logger
/**
* Helper to write [[Config]] to files or streams.
*/
trait ConfigWriter {
private[this] val log = Logger[ConfigWriter]
def write(config: Config, fil... | lefou/blended | blended.updater.config/jvm/src/main/scala/blended/updater/config/ConfigWriter.scala | Scala | apache-2.0 | 1,142 |
package com.alexitc.coinalerts.data
import com.alexitc.coinalerts.models.{Exchange, NewCurrencyAlert, UserId}
import com.alexitc.playsonify.core.ApplicationResult
import scala.language.higherKinds
trait NewCurrencyAlertDataHandler[F[_]] {
def create(userId: UserId, exchange: Exchange): F[NewCurrencyAlert]
def ... | AlexITC/crypto-coin-alerts | alerts-server/app/com/alexitc/coinalerts/data/NewCurrencyAlertDataHandler.scala | Scala | gpl-3.0 | 642 |
package com.monochromeroad.play.xwiki.rendering.plugin
import org.specs2.mutable._
import play.api.test._
import play.api.test.Helpers._
import java.io.StringReader
import java.util.Date
/**
* Plugin for the default XWiki rendering system
*
* @author Masatoshi Hayashi
*/
class DefaultXWikiRenderingPluginSpec ex... | literalice/play-xwiki-rendering | src/test/scala/com/monochromeroad/play/xwiki/rendering/plugin/DefaultXWikiRenderingPluginSpec.scala | Scala | lgpl-2.1 | 1,279 |
/*
* 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 ... | Dax1n/spark-core | core/src/main/scala/org/apache/spark/scheduler/ApplicationEventListener.scala | Scala | apache-2.0 | 2,134 |
/*
* 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/main/scala/org/apache/spark/sql/execution/ui/SQLListener.scala | Scala | apache-2.0 | 13,686 |
package chap4
object Exe6 extends App {
val e = new Exception("Exe6")
def left[A]: Either[Exception, A] = Left(e)
assert(Right(1).map(_ + 1) == Right(2))
assert(left[Int].map(_ + 1) == Left(e))
// 面倒くさくなったのでテスト略
}
| ponkotuy/FPScala | src/main/scala/chap4/Exe6.scala | Scala | unlicense | 253 |
package spark.metrics
import java.util.Properties
import java.io.{File, FileOutputStream}
import org.scalatest.{BeforeAndAfter, FunSuite}
import spark.metrics._
class MetricsConfigSuite extends FunSuite with BeforeAndAfter {
var filePath: String = _
before {
filePath = getClass.getClassLoader.getResource("... | rjpower/spark | core/src/test/scala/spark/metrics/MetricsConfigSuite.scala | Scala | apache-2.0 | 2,144 |
package vggames.shared
import br.com.caelum.vraptor.{ Get, Resource, Result }
import vggames.shared.vraptor.VraptorExtensions._
import vggames.shared.view.Robots
import vggames.shared.view.Sitemap
@Resource
class SearchEngineConfiguration(cfg : GamesConfiguration, result : Result) {
@Get(Array("/robots.txt"))
de... | rustaeja/rustaeja-project-8273 | web/src/main/scala/vggames/shared/SearchEngineConfiguration.scala | Scala | gpl-3.0 | 516 |
package eu.henkelmann.sbt
import _root_.sbt._
import java.io.{StringWriter, PrintWriter, File}
import java.net.InetAddress
import scala.collection.mutable.ListBuffer
import scala.xml.{Elem, Node, XML}
import sbt.testing.{Event => TEvent, Status => TStatus, Logger => TLogger, NestedTestSelector, TestSelector, Annotated... | chenkelmann/junit_xml_listener | src/main/scala/eu/henkelmann/sbt/JUnitXmlTestsListener.scala | Scala | mit | 7,729 |
package org.opencoin.core.util.crypto
import org.opencoin.core.token.PublicRSAKey
import org.opencoin.issuer.PrivateRSAKey
import java.math.BigInteger
import java.security.interfaces.RSAPrivateKey
import java.security.interfaces.RSAPublicKey
import java.security.KeyFactory
import java.security.MessageDigest
import jav... | OpenCoin/opencoin-issuer-scala | src/main/scala/org/opencoin/core/util/crypto.scala | Scala | gpl-3.0 | 5,703 |
/*
* 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 ... | wangmiao1981/spark | sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/PlanAdaptiveSubqueries.scala | Scala | apache-2.0 | 2,274 |
package slick.jdbc
import java.io.Closeable
import java.util.Properties
import java.util.concurrent.TimeUnit
import java.sql.{SQLException, DriverManager, Driver, Connection}
import javax.sql.DataSource
import com.typesafe.config.Config
import slick.util.{Logging, ClassLoaderUtil, BeanConfigurator}
import slick.util.C... | jkutner/slick | slick/src/main/scala/slick/jdbc/JdbcDataSource.scala | Scala | bsd-2-clause | 8,346 |
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt
package internal
import sbt.Def.ScopedKey
import sbt.Keys._
import sbt.Scope.Global
import sbt.SlashSyntax0._
import sbt.internal.util.MainAppender._
import sbt.... | sbt/sbt | main/src/main/scala/sbt/internal/LogManager.scala | Scala | apache-2.0 | 11,079 |
package com.atanana.json
import javax.inject.Inject
import com.atanana.FsHandler
import spray.json.DefaultJsonProtocol._
import spray.json._
import scala.util.Try
class JsonConfig @Inject()(fsHandler: FsHandler) {
import JsonConfig.FILE_NAME
private implicit val configFormat: RootJsonFormat[Config] = jsonForm... | atanana/rating-bot | src/main/scala/com/atanana/json/JsonConfig.scala | Scala | mit | 934 |
/***
* Copyright 2014 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 applica... | tylerroyal/api-checker | core/src/main/scala/com/rackspace/com/papi/components/checker/step/startend/MethodFailMatch.scala | Scala | apache-2.0 | 2,228 |
package com.sageaxcess.sampletask.plainscala
import java.io.{File, PrintWriter}
import com.sageaxcess.sampletask.tokenizer.Tokenizer
/**
* CSV files processing app,
* example input file: <pre>
* HeaderA,HeaderB,HeaderC
* valueA1,valueB1,valueC1
* valueA1,valueB2,value with spaces
* </pre>
* example out... | utgarda/SageAxcessSampleTask | plainscala/src/main/scala/com/sageaxcess/sampletask/plainscala/TokensCount.scala | Scala | mit | 2,467 |
/**
* Copyright (C) 2017 Pants project contributors (see CONTRIBUTORS.md).
* Licensed under the Apache License, Version 2.0 (see LICENSE).
*/
package org.pantsbuild.zinc.analysis
import java.nio.file.Path
import java.io.{File, IOException}
import java.util.Optional
import scala.compat.java8.OptionConverters._
im... | tdyas/pants | src/scala/org/pantsbuild/zinc/analysis/AnalysisMap.scala | Scala | apache-2.0 | 6,152 |
package it.seralf.googlegroups
import java.net.URL
case class GGTopic(topic_id: String, url: URL, messages: Stream[GGMessage] = Stream.empty) {
override def toString() = s"""TOPIC [$url] ${messages.toList.size} messages"""
} | seralf/ggroups_exporter | src/main/scala/it/seralf/googlegroups/GGTopic.scala | Scala | apache-2.0 | 228 |
package controllers
import java.util.UUID
import actors.execution.ExecutionActorFactory
import actors.{ActorsMap, PLMActor}
import akka.actor.ActorRef
import com.google.inject.Inject
import com.google.inject.name.Named
import com.mohiva.play.silhouette.api.{Environment, LogoutEvent, Silhouette}
import com.mohiva.play... | MatthieuNICOLAS/webPLM | app/controllers/ApplicationController.scala | Scala | agpl-3.0 | 3,890 |
/*
* =========================================================================================
* Copyright © 2017 Workday, Inc.
* Copyright © 2013-2017 the kamon project <http://kamon.io/>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the... | Workday/prometheus-akka | src/test/scala/com/workday/prometheus/akka/RouterMetricsTestActor.scala | Scala | apache-2.0 | 1,978 |
package athena.client
import athena.Requests.BoundStatement
import athena.data.{PreparedStatementDef, CvResult, CValue, Writes}
import scala.annotation.implicitNotFound
import play.api.libs.iteratee.{Iteratee, Enumeratee, Enumerator}
import scala.concurrent.{ExecutionContext, Future}
object QueryInterpolation {
@i... | vast-engineering/athena | src/main/scala/athena/client/QueryInterpolation.scala | Scala | apache-2.0 | 2,540 |
package unof.cv.tools.paramsmenu
import unof.cv.tools.CallbackCenter
import unof.cv.tools.CvSetting
import unof.cv.base.charLib.CMImage
import unof.cv.base.charLib.CMShape
import unof.cv.base.charLib.CMPart
import unof.cv.base.charLib.CMCategory
import unof.cv.base.charLib.CMLayer
trait LayerTypeInsensitvePannel {
... | Hgjj/CharViewer | js/src/main/scala/unof/cv/tools/paramsmenu/LayerTypeInsensitvePannel.scala | Scala | bsd-3-clause | 861 |
package es.upm.fi.oeg.siq.tools
import org.slf4j.LoggerFactory
object URLTools {
val logger = LoggerFactory.getLogger(URLTools.getClass())
def stripSpecial(input: String) = {
val resultStr = new StringBuilder
input.toCharArray.foreach { ch =>
if (!isSpecial(ch))
resultStr.append(ch)
}
... | jpcik/morph | morph-core/src/main/scala/es/upm/fi/oeg/siq/tools/URLTools.scala | Scala | apache-2.0 | 1,568 |
/*
* 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 ... | hvanhovell/spark | sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/ColumnStatsSuite.scala | Scala | apache-2.0 | 5,820 |
/*
* Copyright 2011-2014 Chris de Vreeze
*
* 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... | EBPI/yaidom | src/test/scala/nl/ebpi/yaidom/core/QNameTest.scala | Scala | apache-2.0 | 5,297 |
package reactivemongo.api
import scala.concurrent.{ ExecutionContext, Future }
/**
* Cursor wrapper, to help to define custom cursor classes.
* @see CursorProducer
*/
trait WrappedCursor[T] extends Cursor[T] with WrappedCursorCompat[T] {
/** The underlying cursor */
protected def wrappee: Cursor[T]
final de... | ReactiveMongo/ReactiveMongo | driver/src/main/scala/api/WrappedCursor.scala | Scala | apache-2.0 | 1,317 |
/**
* Copyright 2011 Mogoterra, 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 agree... | mogotest/localtunnel-jvm-client | src/main/scala/com/mogotest/localtunnel/ServerResponse.scala | Scala | apache-2.0 | 1,216 |
/*
* 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 ... | mtunique/flink | flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/AggregationCodeGenerator.scala | Scala | apache-2.0 | 14,664 |
import org.elkdanger.testing.MongoMocks
import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers
import org.scalatest.mock.MockitoSugar
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
abstract class SpecBase extends FunSpec with MongoMocks with ShouldMatchers with MockitoSu... | elkdanger/mongo-mocks | test/SpecBase.scala | Scala | mit | 485 |
package epic.features
import epic.framework.Feature
class HackyLexicalSplitFeaturizer[W]() extends SplitSpanFeaturizer[W] {
val label = s"RelativeDifference"
private val emptyArray = Array.empty[Feature]
private val theSplitNeedingAnchoring = new SplitSpanFeatureAnchoring[W] with Serializable {
def featu... | langkilde/epic | src/main/scala/epic/features/HackyLexicalSplitFeaturizer.scala | Scala | apache-2.0 | 681 |
/*
* Copyright 2014 – 2015 Paul Horn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | knutwalker/rx-redis | modules/core/src/main/scala/rx/redis/util/pool/PooledObject.scala | Scala | apache-2.0 | 1,200 |
/**
* (c) Copyright 2012 WibiData, Inc.
*
* See the NOTICE 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 License.
* You may obtain a copy of... | alexandre-normand/kiji-schema-shell | src/main/scala/org/kiji/schema/shell/ddl/GroupFamilyInfo.scala | Scala | apache-2.0 | 1,851 |
package org.scaladebugger.api.profiles.java.info
import com.sun.jdi._
import org.scaladebugger.api.profiles.traits.info.{InfoProducer, LocationInfo, MethodInfo, ReferenceTypeInfo}
import org.scaladebugger.api.virtualmachines.ScalaVirtualMachine
import org.scaladebugger.test.helpers.ParallelMockFunSpec
import org.scala... | ensime/scala-debugger | scala-debugger-api/src/test/scala/org/scaladebugger/api/profiles/java/info/JavaLocationInfoSpec.scala | Scala | apache-2.0 | 4,730 |
package org.mybatis.scala
import org.mybatis.scala.config.Configuration
import org.mybatis.scala.session.{Session, SessionManager}
import org.mybatis.scala.infrastructure.{BlogRepository, UserRepository}
/**
* This trait provides the feature of using databases in test cases.
*/
trait DatabaseSupport {
/**
* Ex... | tempbottle/scala-1 | mybatis-scala-core/src/test/scala/org/mybatis/scala/DatabaseSupport.scala | Scala | apache-2.0 | 693 |
package com.sksamuel.elastic4s.get
import com.sksamuel.elastic4s.testkit.ElasticSugar
import org.scalatest.{FlatSpec, Matchers}
class GetDslTest extends FlatSpec with Matchers with ElasticSugar {
"a get by id request" should "accept tuple for from" in {
val req = get id 123 from "places" -> "cities"
assert... | ulric260/elastic4s | elastic4s-core-tests/src/test/scala/com/sksamuel/elastic4s/get/GetDslTest.scala | Scala | apache-2.0 | 1,879 |
package ru.imho.dddmt
import ru.imho.dddmt.config.typesafe.UniverseBuilder
import ru.imho.dddmt.std.StandardParameterTypes._
import ru.imho.dddmt.core._
import Base._
import org.slf4j.LoggerFactory
import ru.imho.dddmt.core.impl.DGraph
/**
* Driver program
*
* @author VVybornov
*
*/
object Main {
val logger =... | IMHOVi/dddmt | dddmt-engine/src/main/scala/ru/imho/dddmt/Main.scala | Scala | apache-2.0 | 1,444 |
package com.ubirch.chain.core.actor.consumer
import com.ubirch.chain.config.ChainConfig
import com.ubirch.chain.core.actor.util.ActorTools
import com.ubirch.chain.core.actor.{ActorNames, BigchainActor}
import com.ubirch.chain.model.rest.DeviceMsgHashIn
import com.ubirch.util.json.{Json4sUtil, MyJsonProtocol}
import o... | ubirch/ubirch-chain-service | core/src/main/scala/com/ubirch/chain/core/actor/consumer/DeviceDataHashInConsumer.scala | Scala | apache-2.0 | 1,813 |
object Test extends App {
Macros.m1
Macros.m2
Macros.m3
}
| AlexSikia/dotty | tests/untried/neg/macro-quasiquotes/Test_2.scala | Scala | bsd-3-clause | 64 |
package com.sksamuel.elastic4s.http.search.aggs
import com.sksamuel.elastic4s.http.search.SearchBodyBuilderFn
import com.sksamuel.elastic4s.searches.SearchDefinition
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval
import org.scalatest.{FunSuite, Matchers}
class MaxBucketAggBuilderT... | aroundus-inc/elastic4s | elastic4s-http/src/test/scala/com/sksamuel/elastic4s/http/search/aggs/MaxBucketAggBuilderTest.scala | Scala | apache-2.0 | 997 |
package proofpeer.proofscript.serialization
import proofpeer.proofscript.frontend._
import ParseTree._
import proofpeer.general._
import proofpeer.indent.Span
import proofpeer.proofscript.logic._
object BasicSourceSerializer extends TransformSerializer[Source, (String, String)](
PairSerializer(StringSerializer, Str... | proofpeer/proofpeer-proofscript | shared/src/main/scala/proofpeer/proofscript/serialization/ParseTreeSerializer.scala | Scala | mit | 38,527 |
package scala.meta
package internal
package ast
import org.scalameta.data._
import org.scalameta.unreachable
@data class MergeException(culprits: Seq[Tree], message: String, cause: Option[Throwable] = None)
extends Exception(message, cause.orNull) with ScalametaException {
override def toString = super.toString
}
| beni55/scalameta | scalameta/trees/src/main/scala/scala/meta/internal/ast/Exceptions.scala | Scala | bsd-3-clause | 319 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | bravo-zhang/spark | sql/core/src/main/scala/org/apache/spark/sql/sources/package.scala | Scala | apache-2.0 | 917 |
package com.karasiq.nanoboard.streaming
import boopickle.CompositePickler
import boopickle.Default._
import com.karasiq.nanoboard.api.NanoboardMessageData
sealed trait NanoboardEvent
object NanoboardEvent {
case class PostAdded(post: NanoboardMessageData) extends NanoboardEvent
case class PostDeleted(hash: Strin... | Karasiq/nanoboard | shared/shared/src/main/scala/com/karasiq/nanoboard/streaming/NanoboardEvent.scala | Scala | apache-2.0 | 639 |
package lettergenerator
package renderer
import scala.swing.{MainFrame, Label, CheckBox, TextField}
import scala.swing.{Dialog, ComboBox, FileChooser}
import scala.swing.event.ValueChanged
import java.io.File
import javax.swing.filechooser.FileNameExtensionFilter
/**
* the main frame. Responsible for laying out th... | claudiusbr/LetterGenerator | src/main/scala/lettergenerator/renderer/Wizard.scala | Scala | mit | 3,873 |
import com.typesafe.sbt.SbtScalariform._
import scalariform.formatter.preferences._
object ScalariformSettings {
lazy val ourScalariformSettings = scalariformSettings ++ Seq(
ScalariformKeys.preferences := FormattingPreferences()
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCas... | equites-chess/equites-core | project/ScalariformSettings.scala | Scala | gpl-3.0 | 402 |
/*
* 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 ... | manishgupta88/carbondata | integration/spark2/src/test/scala/org/apache/carbondata/spark/util/DictionaryLRUCacheTestCase.scala | Scala | apache-2.0 | 18,483 |
/* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\\___/_/... | slothspot/scala | src/library/scala/reflect/ClassManifestDeprecatedApis.scala | Scala | bsd-3-clause | 11,700 |
/*
* Copyright 2015 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... | keithhall/ct-calculations | src/main/scala/uk/gov/hmrc/ct/computations/CPQ20.scala | Scala | apache-2.0 | 903 |
package com.softwaremill.play24.modules
import com.softwaremill.play24.dao.{CoffeeDao, SupplierDao}
import org.specs2.mock.Mockito
trait MockDaoModule extends Mockito {
lazy val coffeeDoa = mock[CoffeeDao]
lazy val supplierDoa = mock[SupplierDao]
}
| guersam/macwire | examples/play24/test/com/softwaremill/play24/modules/MockDaoModule.scala | Scala | apache-2.0 | 255 |
/*
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | jedesah/Quasar | connector/src/test/scala/quasar/qscript/qsu/ReifyAutoJoinsSpec.scala | Scala | apache-2.0 | 4,238 |
/*
* MOIS: Ordinary Differential Equations (Compat)
* Copyright (C) 2014 University of Edinburgh School of Informatics
*
* 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... | edinburgh-rbm/mois | src/main/scala/uk/ac/ed/inf/mois/ode/Compat.scala | Scala | gpl-3.0 | 932 |
sealed trait Option[+A]
case object None extends Option[Nothing]
case class Some[A](a: A) extends Option[A] | hmemcpy/milewski-ctfp-pdf | src/content/3.14/code/scala/snippet04.scala | Scala | gpl-3.0 | 107 |
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.