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 ... | practice-vishnoi/dev-spark-1 | mllib/src/test/scala/org/apache/spark/mllib/linalg/distributed/CoordinateMatrixSuite.scala | Scala | apache-2.0 | 3,284 |
package org.treppo.mocoscala.wrapper
import com.github.dreamhead.moco.extractor.PlainExtractor
import com.github.dreamhead.moco.matcher.{ContainMatcher, EndsWithMatcher, EqRequestMatcher, StartsWithMatcher}
import org.scalatest.FlatSpec
import org.scalatest.Matchers._
class ExtractorMatcherTest extends FlatSpec {
v... | treppo/moco-scala | src/test/scala/org/treppo/mocoscala/wrapper/ExtractorMatcherTest.scala | Scala | mit | 979 |
/*
* 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... | danielcsant/sparta | serving-core/src/main/scala/com/stratio/sparta/serving/core/models/TransformationsModel.scala | Scala | apache-2.0 | 1,484 |
package org.http4s
package util
import java.nio.charset.StandardCharsets
import cats.implicits._
import fs2._
import fs2.text.utf8Decode
class DecodeSpec extends Http4sSpec {
"decode" should {
"be consistent with utf8Decode" in prop { (s: String, chunkSize: Int) =>
(chunkSize > 0) ==> {
val sourc... | ZizhengTai/http4s | tests/src/test/scala/org/http4s/util/DecodeSpec.scala | Scala | apache-2.0 | 1,519 |
package scala.slick.driver
import scala.slick.SLICKException
import scala.slick.ast._
import scala.slick.util._
import scala.slick.ql._
import scala.slick.ql.ColumnOps._
trait BasicStatementBuilderComponent { driver: BasicDriver =>
/** Builder for SELECT and UPDATE statements. */
class QueryBuilder(val ast: Node... | szeiger/scala-query | src/main/scala/scala/slick/driver/BasicStatementBuilderComponent.scala | Scala | bsd-2-clause | 20,030 |
//name = i
def foo(x: Int) {
/*start*/1 + 1/*end*/
}
/*
//name = i
def foo(x: Int, i: Int) {
/*start*/i/*end*/
}
*/ | ilinum/intellij-scala | testdata/introduceParameter/simple/OtherName.scala | Scala | apache-2.0 | 119 |
package com.kubukoz.adventofcode2016
import com.kubukoz.adventofcode2016.Day1._
import org.scalatest.{FlatSpec, Matchers}
class Day1Tests extends FlatSpec with Matchers {
"The first part" should "work for the given cases" in {
findDistanceToLast("R2, L3") shouldBe 5
findDistanceToLast("R2, R2, R2") shouldBe... | kubukoz/advent-of-code-2016 | src/test/scala/com/kubukoz/adventofcode2016/Day1Tests.scala | Scala | apache-2.0 | 506 |
package controllers
import akka.LifeActors
import models.StartCommand._
import models.World
import org.kirhgoff.ap.core.{WorldModel, WorldModelListener, WorldPrinter}
import org.kirhgoff.ap.model.lifegame.LifeGameWorldGenerator
import play.api.Play
import play.api.libs.EventSource
import play.api.libs.concurrent.Execu... | kirhgoff/life-server | app/controllers/Application.scala | Scala | mit | 3,551 |
package rocks.molarialessandro.coordinates
import rocks.molarialessandro.coordinates.converters.RGBAToHSBAConverter
case class RGBACoordinates(r: Int, g: Int, b: Int, a: Int) extends Coordinates {
private val converterToHSBA: RGBAToHSBAConverter = new RGBAToHSBAConverter
override def convertToHSBA: HSBACoordina... | alem0lars/claps | src/main/scala/rocks/molarialessandro/coordinates/RGBACoordinates.scala | Scala | apache-2.0 | 411 |
package org.me.hotel
import org.scalatest.Suites
class MySuites extends Suites(
new GuestTest,
new RoomTest) | Scalera/scalatest-handson-introduction | hotel-management/src/test/scala/org/me/hotel/MySuites.scala | Scala | apache-2.0 | 114 |
def f(s: String) = "f(" + s + ")"
def g(s: String) = "g(" + s + ")"
val fComposeG = f _ compose g _
fComposeG("yay")
val fAndThenG = f _ andThen g _
fAndThenG("yay")
val one: PartialFunction[Int, String] = {
case 1 => "one"
}
one.isDefinedAt(1)
one.isDefinedAt(2)
one(1)
val two: PartialFunction[Int, String]... | cmonkey/scala-school | src/main/scala/Patterns-Matching.scala | Scala | gpl-3.0 | 806 |
package com.example
case class StatisticsResponse(query: Query)
case class Query(results: Results)
case class Results(quote: List[StatisticData])
case class StatisticData(
//time: Timestamp, //"2016-04-14T20:56:05Z" //This field is not in the response
symbol: Stri... | frossi85/financial-statistics-crawler | src/main/scala/com/example/Entities.scala | Scala | apache-2.0 | 2,154 |
package net.gnmerritt.tetris.player
import net.gnmerritt.tetris.engine.{Field, Piece, Placement, Position}
/**
* Given a board and piece, generate a sequence of placements
*/
class PlacementGenerator(field: Field, piece: Piece) {
def allLegal = {
this.all.filter(_.isLegal)
}
def all = {
for (x <- 0 u... | gnmerritt/aig-tetris | src/main/scala/net/gnmerritt/tetris/player/PlacementGenerator.scala | Scala | mit | 427 |
package org.scalatest.suiteprop
import org.scalatest._
class TwoSlowAndOneWeakTestExamples extends SuiteExamples {
trait Services {
val theTestNames = Vector("first test", "second test")
}
trait NestedTestNames extends Services {
override val theTestNames = Vector("A subject should first test", "A sub... | hubertp/scalatest | src/test/scala/org/scalatest/suiteprop/TwoSlowAndOneWeakTestExamples.scala | Scala | apache-2.0 | 22,083 |
/*
* Copyright 2016 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 appli... | BenSeverson/rest-assured | examples/scalatra-example/src/main/scala/io/restassured/scalatra/ScalatraRestExample.scala | Scala | apache-2.0 | 33,981 |
/*
* 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-xml | src/main/scala/fm/xml/JAXBMarshaller.scala | Scala | apache-2.0 | 5,343 |
/*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package play.it.action
import akka.actor.ActorSystem
import akka.stream.{ ActorMaterializer, Materializer }
import play.api._
import play.api.data._
import play.api.data.Forms._
import play.api.data.format.Formats._
import play.api.libs.Files... | Shruti9520/playframework | framework/src/play-integration-test/src/test/scala/play/it/action/FormActionSpec.scala | Scala | apache-2.0 | 3,338 |
/*
* 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 ... | greghogan/flink | flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/batch/BatchExecSortWindowAggregate.scala | Scala | apache-2.0 | 2,983 |
package almond.protocol
import java.nio.charset.StandardCharsets
import java.{util => ju}
import scala.util.hashing.MurmurHash3
import scala.util.Try
// adapted from https://github.com/plokhotnyuk/jsoniter-scala/blob/209d918a030b188f064ee55505a6c47257731b4b/jsoniter-scala-macros/src/test/scala/com/github/plokhotnyuk... | alexarchambault/jupyter-scala | modules/shared/protocol/src/main/scala/almond/protocol/RawJson.scala | Scala | apache-2.0 | 1,264 |
/*
* 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... | psyyz10/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/example/udfpredictor/DataframePredictor.scala | Scala | apache-2.0 | 4,106 |
package com.alexitc.coinalerts.services
import javax.inject.Inject
import com.alexitc.coinalerts.core.AuthorizationToken
import com.alexitc.coinalerts.data.async.UserFutureDataHandler
import com.alexitc.coinalerts.errors.IncorrectPasswordError
import com.alexitc.coinalerts.models._
import com.alexitc.coinalerts.servi... | AlexITC/crypto-coin-alerts | alerts-server/app/com/alexitc/coinalerts/services/UserService.scala | Scala | gpl-3.0 | 3,301 |
/*
* Copyright 2016 LinkedIn Corp.
*
* 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... | bretlowery/dr-elephant-mapr | app/com/linkedin/drelephant/spark/data/SparkRestDerivedData.scala | Scala | apache-2.0 | 923 |
package ore.models.admin
import ore.db._
import ore.db.impl.ModelCompanionPartial
import ore.models.project.{Page, Project, Version}
import ore.models.user.{LoggedActionType, LoggedActionContext, User, UserOwned}
import com.github.tminglei.slickpg.InetString
import slick.lifted.TableQuery
case class LoggedProject(
... | SpongePowered/Ore | models/src/main/scala/ore/models/admin/LoggedActionView.scala | Scala | mit | 1,058 |
val x: /*ref*/SourceObjectPackage = null
/*
import `object`.foo.SourceObjectPackage
val x: SourceObjectPackage = null
*/ | whorbowicz/intellij-scala | testdata/autoImport/all/ObjectPackage.scala | Scala | apache-2.0 | 121 |
package com.gu.arts.music.net
import dispatch._
import dispatch.thread.ThreadSafeHttpClient
import org.apache.http.params.HttpParams
import org.apache.http.conn.params.ConnRouteParams
import org.apache.http.HttpHost
import org.slf4j.LoggerFactory
object ConfiguredHttp extends Http {
val logger = LoggerFactory getLo... | guardian/music-api-scala-client | api-base/src/main/scala/com/gu/arts/music/net/ConfiguredHttp.scala | Scala | apache-2.0 | 966 |
package knot.data
import java.nio.ByteBuffer
import java.nio.charset.{Charset, StandardCharsets}
import scala.collection.IndexedSeqOptimized
import scala.collection.immutable.IndexedSeq
object ByteNode {
def apply(text: String): ByteNode = new ByteNode(text.getBytes(StandardCharsets.UTF_8))
def wrap(bytes: Arra... | defvar/knot | knot-data/src/main/scala/knot/data/ByteNode.scala | Scala | mit | 2,657 |
/*
* 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 ... | pgandhi999/spark | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/DSLHintSuite.scala | Scala | apache-2.0 | 1,665 |
/*
Copyright (c) 2019, Robby, Kansas State University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions... | sireum/v3 | pilar/shared/src/main/scala/org/sireum/pilar/ast/Json.scala | Scala | bsd-2-clause | 13,243 |
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
object Test extends App {
reify {
class C {
def x = 2
def y = x * x
}
class D extends C {
override def x = 3
}
println(new D().y * new C().x)
}.eval
} | felixmulder/scala | test/files/run/reify_inheritance.scala | Scala | bsd-3-clause | 267 |
package com.etsy.sbt.checkstyle
import sbt.File
import scala.io.Source
/**
* Represents a Checkstyle XML configuration located locally, on the class path or remotely at a URL
*
* @author Joseph Earl
*/
sealed abstract class CheckstyleConfigLocation(val location: String) {
def read(resources: Seq[File]): ... | etsy/sbt-checkstyle-plugin | src/main/scala/com/etsy/sbt/checkstyle/CheckstyleConfigLocation.scala | Scala | mit | 1,096 |
/*
* Copyright 2013 - 2015, Daniel Krzywicki <[email protected]>
*
* 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
... | ros3n/IntOb | core/src/main/scala/pl/edu/agh/scalamas/util/Util.scala | Scala | mit | 2,129 |
/**
* Copyright 2011-2017 GatlingCorp (http://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... | timve/gatling | gatling-http/src/main/scala/io/gatling/http/request/builder/package.scala | Scala | apache-2.0 | 3,789 |
package keystoneml.nodes.nlp
import org.scalatest.FunSuite
import keystoneml.workflow.PipelineContext
class HashingTFSuite extends FunSuite with PipelineContext {
test("HashingTF with no collisions") {
val dims = 4000
val hashingTF = HashingTF[Seq[String]](dims)
val testDatum = Seq("1", "2", "4", "4",... | amplab/keystone | src/test/scala/keystoneml/nodes/nlp/HashingTFSuite.scala | Scala | apache-2.0 | 1,115 |
package org.scalatra
package oauth2
package auth
import scala.util.control.Exception._
import scalaz._
import Scalaz._
import org.scribe.model.Verifier
import org.scribe.oauth.{ OAuth20ServiceImpl, OAuth10aServiceImpl, OAuthService }
import OAuth2Imports._
import java.util.concurrent.ConcurrentHashMap
import scala.col... | scalatra/oauth2-server | src/main/scala/org/scalatra/oauth2/auth/ScribeAuthStrategy.scala | Scala | mit | 6,412 |
package builder.api_json
import com.bryzek.apidoc.spec.v0.models.Service
import com.bryzek.apidoc.spec.v0.models.json._
import lib.ServiceValidator
import play.api.libs.json.{Json, JsError, JsSuccess}
import com.fasterxml.jackson.core.{JsonParseException, JsonProcessingException}
import scala.util.{Failure, Success, T... | Seanstoppable/apidoc | core/src/main/scala/core/builder/api_json/ServiceJsonServiceValidator.scala | Scala | mit | 1,053 |
/*
* Copyright (C) 2009-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 a... | OpenMaths/parboiled | examples-scala/src/test/scala/org/parboiled/examples/json/JsonParserTest.scala | Scala | apache-2.0 | 3,299 |
package funpep.server
package service
import java.time.Instant.now
import scala.concurrent.ExecutionContext
import scalaz.concurrent._
import scalaz.stream._
import scalaz.std.option._
import scalaz.std.string._
import scalaz.syntax.std.boolean._
import atto._
import argonaut._
import argonaut.Argonaut._
import o... | agjacome/funpep | server/src/main/scala/funpep/server/service/AnalyzerService.scala | Scala | mit | 3,972 |
/*
* 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 ... | lincoln-lil/flink | flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/batch/ExplainTest.scala | Scala | apache-2.0 | 5,080 |
package org.antipathy.mvn_scalafmt.io
import java.io.File
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Paths}
import org.antipathy.mvn_scalafmt.model.RemoteConfig
import org.apache.commons.io.FileUtils
import org.apache.maven.plugin.logging.SystemStreamLog
import org.scalatest.flatspec.AnyFla... | SimonJPegg/mvn_scalafmt | src/test/scala/org/antipathy/mvn_scalafmt/io/RemoteConfigWriterSpec.scala | Scala | apache-2.0 | 2,371 |
package ml.combust.mleap.runtime.transformer.feature
import java.io.File
import ml.combust.bundle.BundleFile
import ml.combust.mleap.core.feature.MinMaxScalerModel
import ml.combust.mleap.core.types._
import ml.combust.mleap.runtime.frame.{DefaultLeapFrame, Row}
import ml.combust.mleap.runtime.transformer.Pipeline
im... | combust/mleap | mleap-runtime/src/test/scala/ml/combust/mleap/runtime/transformer/feature/MinMaxScalerSpec.scala | Scala | apache-2.0 | 2,257 |
package main.scala.calculator
class InfixCalculator {
def calculate(infixExpression: String): Either[String, ExpressionError] = {
val safeInfixExpression = if (infixExpression == null) "" else infixExpression
val infixTokens = InfixTokenizer.tokenize(safeInfixExpression) match {
case Left(tokens) => t... | sirIrishman/calculator | src/main/scala/calculator/InfixCalculator.scala | Scala | bsd-3-clause | 712 |
package filodb.cli
import akka.actor.{ActorRef, ActorSystem}
import akka.pattern.ask
import akka.util.Timeout
import com.opencsv.{CSVReader, CSVWriter}
import com.typesafe.scalalogging.slf4j.StrictLogging
import org.velvia.filo.{ArrayStringRowReader, RowReader}
import scala.concurrent.{Await, Future, ExecutionContext}... | markhamstra/FiloDB | cli/src/main/scala/filodb.cli/CsvImportExport.scala | Scala | apache-2.0 | 2,131 |
package io.vamp.model.reader
import io.vamp.model.artifact._
import io.vamp.model.reader.YamlSourceReader._
object TemplateReader extends YamlReader[Template] {
override protected def parse(implicit source: YamlSourceReader): Template = {
Template(name, metadata, first[Any]("definition", "def") match {
c... | magneticio/vamp | model/src/main/scala/io/vamp/model/reader/TemplateReader.scala | Scala | apache-2.0 | 429 |
/*
* Copyright (c) 2013 Daniel Krzywicki <[email protected]>
*
* 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
... | eleaar/scala-mas | core/src/main/scala/pl/edu/agh/scalamas/random/RandomGeneratorComponent.scala | Scala | mit | 2,326 |
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala
package reflect
... | martijnhoekstra/scala | src/reflect/scala/reflect/io/AbstractFile.scala | Scala | apache-2.0 | 9,578 |
/**
* Copyright (C) 2010 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This pr... | brunobuzzi/orbeon-forms | src/main/scala/org/orbeon/oxf/servlet/ServletExternalContext.scala | Scala | lgpl-2.1 | 18,122 |
/* Title: Pure/System/system_channel.scala
Author: Makarius
Socket-based system channel for inter-process communication.
*/
package isabelle
import java.io.{InputStream, OutputStream}
import java.net.{ServerSocket, InetAddress}
object System_Channel
{
def apply(): System_Channel = new System_Chann... | wneuper/libisabelle | pide/2015/src/main/scala/System/system_channel.scala | Scala | mit | 809 |
package scalapoi
package dragons
import org.apache.poi.hssf.usermodel._
import org.apache.poi.ss.util.WorkbookUtil._
import java.io.{File, FileOutputStream}
import scala.collection.JavaConverters._
import utils._
object Sheet {
// totes unsafe
def create(name: String, wb: Workbook): HSSFSheet = {
val safeName... | hamishdickson/scalapoi | src/main/scala/scalapoi/dragons/Sheet.scala | Scala | mit | 513 |
trait Result[+T]
case class Succ[T](m: List[T], rest: List[T]) extends Result[T]
case class Err(msg: String) extends Result[Nothing]
case object EOF extends Result[Nothing]
object ParserCombinator {
trait Parser[T] {
def apply(input: List[T]): Result[T]
}
abstract class PredicateParser[T](pred: T => Bo... | binape/code-snippets | 00-QuickExamples/ParserCombinator.scala | Scala | mit | 2,165 |
//
// Scaled - a scalable editor extensible via JVM languages
// http://github.com/scaled/scaled/blob/master/LICENSE
package scaled
import reactual.SignalV
/** Handles the invocation of fns and their binding to names and key combinations. */
abstract class Dispatcher {
/** A signal that is emitted with the name o... | swhgoon/scaled | api/src/main/scala/scaled/Dispatcher.scala | Scala | bsd-3-clause | 2,249 |
/**
* * Copyright (C) 2013 Carnegie Mellon University
*
* 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... | twmarshall/tdb | core/src/main/scala/tdb/util/LiveJournalData.scala | Scala | apache-2.0 | 1,494 |
package controllers
import models.{ Model, ModelCompanion}
import services.DatabaseService
import sql.ApiTable
import java.util.UUID
import scala.concurrent.Future
import scala.async.Async.{ async, await }
import scala.util.{ Try, Success, Failure }
import play.api._
import play.api.mvc._
import play.api.libs.json.{... | gilbertw1/personal-api | app/controllers/ApiModelController.scala | Scala | gpl-2.0 | 1,824 |
/*
* 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... | rodzyn0688/zipkin | zipkin-server/src/main/scala/com/twitter/zipkin/config/CassandraAggregatesConfig.scala | Scala | apache-2.0 | 1,363 |
/*
* Copyright 2017 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | liquidarmour/ct-calculations | src/main/scala/uk/gov/hmrc/ct/accounts/frs102/boxes/AC77.scala | Scala | apache-2.0 | 1,118 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | pferrel/PredictionIO | data/src/main/scala/org/apache/predictionio/data/store/java/PJavaEventStore.scala | Scala | apache-2.0 | 4,059 |
/**
* Copyright (c) 2013-2015 Patrick Nicolas - Scala for Machine Learning - All rights reserved
*
* The source code in this file is provided by the author for the sole purpose of illustrating the
* concepts and algorithms presented in "Scala for Machine Learning". It should not be used to
* build commercial ap... | batermj/algorithm-challenger | books/cs/machine-learning/scala-for-machine-learning/1rst-edition/original-src-from-the-book/src/main/scala/org/scalaml/trading/TradingStrategy.scala | Scala | apache-2.0 | 5,426 |
package monocle.law.discipline.function
import monocle.function.Cons1._
import monocle.function._
import monocle.law.discipline.{IsoTests, LensTests}
import org.scalacheck.Arbitrary
import org.typelevel.discipline.Laws
import monocle.catssupport.Implicits._
import cats.instances.tuple._
object Cons1Tests extends Law... | fkz/Monocle | law/shared/src/main/scala/monocle/law/discipline/function/Cons1Tests.scala | Scala | mit | 700 |
/*
* Copyright 2012 Eike Kettner
*
* 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... | eikek/publet | web/src/main/scala/org/eknet/publet/web/Settings.scala | Scala | apache-2.0 | 2,295 |
import sbt._
import sbt.Keys._
object Build extends sbt.Build {
lazy val project = Project(
id = "akka-actor-statsd",
base = file("."),
settings = Defaults.coreDefaultSettings ++ Seq(
name := "akka-actor-statsd",
organization := "com.deploymentzone",
version ... | edmundnoble/akka-actor-statsd | project/Build.scala | Scala | mit | 2,232 |
package io.youi.event
import io.youi._
import io.youi.component.Component
import reactify.Channel
class Swipe(component: Component,
events: Events,
onlyMobile: Boolean,
directions: Set[Swipe.Direction] = Swipe.Direction.All) {
private var dragging: Option[SwipeEvent] = None
la... | outr/youi | gui/src/main/scala/io/youi/event/Swipe.scala | Scala | mit | 2,641 |
package examples
import com.github.astonbitecode.di.diDefine
import com.github.astonbitecode.di.inject
object Example1 extends App {
/*
* The UseCase Class contains a val that should be injected. The injected class is of type 'HelpfulClass'.
* Try to initialize the UseCase before calling the diDefine for the ... | astonbitecode/kind-of-di | src/main/scala/examples/Example1.scala | Scala | mit | 1,260 |
package feh.util.file
import java.io.{FileInputStream, FileOutputStream, File => JFile}
import feh.util._
import scala.util.Try
import scala.language.implicitConversions
trait FileUtilWrappers{
val File: FileUtils
import File._
/** default string to path wrapper, uses File.separator to split the string */
i... | fehu/util | src/main/scala/feh/util/file/FileUtilWrappers.scala | Scala | mit | 2,681 |
/*
* Copyright 2001-2015 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... | dotty-staging/scalatest | examples/src/test/scala/org/scalatest/examples/asyncfunspec/ignoreall/AddSpec.scala | Scala | apache-2.0 | 1,464 |
package skinny.micro.contrib
import skinny.micro.SkinnyMicroBase
import skinny.micro.base.BeforeAfterDsl
import skinny.micro.context.SkinnyContext
import skinny.micro.contrib.csrf.CSRFTokenGenerator
/**
* Provides cross-site request forgery protection.
*
* If a request is determined to be forged, the `handleForger... | xerial/skinny-micro | micro/src/main/scala/skinny/micro/contrib/CSRFTokenSupport.scala | Scala | bsd-2-clause | 2,189 |
object Ambiguous
{
implicit val c1: C = ???
implicit val c2: C = ???
implicit def f1: D = ???
implicit def f2: D = ???
implicitly[D]
}
| tek/splain | core/src/test/resources-2.13.7+/latest/splain/plugin/PluginSpec/ambiguous/code.scala | Scala | mit | 145 |
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package viper.silicon.supporters
import viper.silver.components.StatefulComponent
import viper.silic... | sccblom/vercors | viper/silicon/src/main/scala/supporters/Brancher.scala | Scala | mpl-2.0 | 4,685 |
package s99
import scala.annotation.tailrec
object P01 {
def last[E](list: List[E]): E = {
list match {
case _ :+ e => e
case _ => throw new NoSuchElementException("last of empty list")
}
}
@tailrec
def lastRec[E](list: List[E]): E = {
list match {
case head :: Nil => head... | qilab-/algorithm-problems | s-99/src/main/scala/s99/P01.scala | Scala | unlicense | 455 |
/*
* Copyright (C) 2009-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 a... | OpenMaths/parboiled | parboiled-scala/src/main/scala/org/parboiled/scala/Input.scala | Scala | apache-2.0 | 1,726 |
package kmeans
import scala.annotation.tailrec
import scala.collection._
import scala.util.Random
import org.scalameter._
import common._
class KMeans {
def generatePoints(k: Int, num: Int): Seq[Point] = {
val randx = new Random(1)
val randy = new Random(3)
val randz = new Random(5)
(0 until num)
... | syhan/coursera | parprog1/kmeans/src/main/scala/kmeans/KMeans.scala | Scala | gpl-3.0 | 3,690 |
package parsec
import parsec.optimised.OptimisedParsers
object TestFastParse {
import fastparse.all._
case class NamedFunction[T, V](f: T => V, name: String) extends (T => V) {
def apply(t: T): V = f(t)
override def toString(): String = name
}
val Whitespace = NamedFunction(" \\r\\n".contains(_: Char... | manojo/parsequery | core/src/main/scala/parsec/Test.scala | Scala | mit | 1,375 |
object Dependency {
val v = 1
}
| felixmulder/scala | test/files/scalacheck/testdir/dep.scala | Scala | bsd-3-clause | 38 |
/*
* 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 ... | sh-cho/cshSpark | deploy/SparkSubmitArguments.scala | Scala | apache-2.0 | 24,174 |
/*
* 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 ... | paulcastro/openwhisk | tests/src/test/scala/whisk/core/database/test/BatcherTests.scala | Scala | apache-2.0 | 4,142 |
package nl.jappieklooster.gapl.lib.dsl.execution
import nl.jappieklooster.gapl.lib.model.Agent
/**
*
* @param agent
* @param environment the environment which handles synchronization
*/
class GoalExecutionDsl(agent:Agent, val environment:AnyRef) extends BelieveExecutionDsl(agent){
}
| jappeace/Gapl | library/src/main/scala/nl/jappieklooster/gapl/lib/dsl/execution/GoalExecutionDsl.scala | Scala | gpl-3.0 | 290 |
/**
* Copyright (C) 2015 DANS - Data Archiving and Networked Services ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0... | DANS-KNAW/easy-update-solr-index | lib/src/main/scala/nl.knaw.dans.easy.solr/SolrDocumentGenerator.scala | Scala | apache-2.0 | 12,905 |
package hoconspring
import java.lang.reflect.{Constructor, Method}
import org.springframework.core.ParameterNameDiscoverer
/**
* Author: ghik
* Created: 11/09/15.
*/
class AnnotationParameterNameDiscoverer extends ParameterNameDiscoverer {
def getParameterNames(ctor: Constructor[_]): Array[String] =
Option(... | ghik/hocon-spring | src/test/scala/hoconspring/AnnotationParameterNameDiscoverer.scala | Scala | apache-2.0 | 515 |
package com.crobox.clickhouse.dsl.language
import com.crobox.clickhouse.DslTestSpec
import com.crobox.clickhouse.dsl._
class LogicalFunctionTokenizerTest extends DslTestSpec {
def noto(other: LogicalOpsMagnet): ExpressionColumn[Boolean] = LogicalFunction(other, Not, other)
val select = SelectQuery(Seq(shieldId)... | crobox/clickhouse-scala-client | dsl/src/test/scala/com/crobox/clickhouse/dsl/language/LogicalFunctionTokenizerTest.scala | Scala | lgpl-3.0 | 9,052 |
/*
* This file is part of the sohva project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | gnieh/sohva | src/main/scala/gnieh/sohva/CList.scala | Scala | apache-2.0 | 1,560 |
import scala.reflect.runtime.universe._
import scala.tools.reflect.ToolBox
import scala.tools.reflect.Eval
object Test extends dotty.runtime.LegacyApp {
object C {
type T = Int
val code = reify {
List[C.T](2)
}
println(code.eval)
}
C
}
| yusuke2255/dotty | tests/disabled/macro/run/reify_newimpl_31.scala | Scala | bsd-3-clause | 266 |
package com.datastax.spark.connector.util
import java.lang.{Iterable => JIterable}
import java.util.{Collection => JCollection}
import java.util.{Map => JMap}
import scala.collection.JavaConversions._
import scala.reflect._
import scala.reflect.api.{Mirror, TypeCreator, _}
import scala.reflect.runtime.universe._
imp... | maasg/spark-cassandra-connector | spark-cassandra-connector/src/main/scala/com/datastax/spark/connector/util/JavaApiHelper.scala | Scala | apache-2.0 | 4,060 |
package skinny.assets
import org.scalatest._
import org.scalatest.matchers._
class SassCompilerSpec extends FlatSpec with ShouldMatchers {
behavior of "SassCompiler"
it should "compile scss code" in {
val compiler = SassCompiler
val css = compiler.compile("font.scss",
"""$font-stack: Helvetica, sa... | BlackPrincess/skinny-framework | assets/src/test/scala/skinny/assets/SassCompilerSpec.scala | Scala | mit | 1,009 |
/*
* Copyright 2018 PayPal
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writin... | akara/squbs | squbs-pipeline/src/main/scala/org/squbs/pipeline/PipelineExtension.scala | Scala | apache-2.0 | 5,001 |
package eventstreams.support
import akka.actor.{ActorRef, ActorSystem, Props, Terminated}
import com.typesafe.config._
import core.sysevents.SyseventOps.symbolToSyseventOps
import core.sysevents.WithSyseventPublisher
import core.sysevents.ref.ComponentWithBaseSysevents
import core.sysevents.support.EventAssertions
imp... | intelix/eventstreams | es-core/es-api/src/test/scala/eventstreams/support/MultiActorSystemTestContext.scala | Scala | apache-2.0 | 6,089 |
package cmwell.analytics.main
import java.nio.file.Paths
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import cmwell.analytics.data.{DataWriterFactory, IndexWithUuidOnly}
import cmwell.analytics.downloader.PartitionedDownloader
import cmwell.analytics.util.TimestampConversion.timestampConverter
i... | dudi3001/CM-Well | tools/dataConsistencyTool/extract-index-from-es/src/main/scala/cmwell/analytics/main/DumpUuidOnlyFromEs.scala | Scala | apache-2.0 | 4,216 |
package org.scaladebugger.api.lowlevel.threads
import org.scaladebugger.api.lowlevel.PendingRequestSupport
/**
* Provides pending thread death capabilities to an existing
* thread death manager.
*/
trait PendingThreadDeathSupportLike
extends ThreadDeathManager
with PendingRequestSupport
{
/**
* Processes ... | ensime/scala-debugger | scala-debugger-api/src/main/scala/org/scaladebugger/api/lowlevel/threads/PendingThreadDeathSupportLike.scala | Scala | apache-2.0 | 708 |
/*
* 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/main/scala/uk/gov/hmrc/ct/accounts/frsse2008/micro/AC405.scala | Scala | apache-2.0 | 1,120 |
/*
* 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 ... | shuangshuangwang/spark | sql/hive/src/main/scala/org/apache/spark/sql/hive/client/IsolatedClientLoader.scala | Scala | apache-2.0 | 14,843 |
package spark.streaming
import akka.actor.Actor
import akka.actor.IO
import akka.actor.IOManager
import akka.actor.Props
import akka.util.ByteString
import dstream.SparkFlumeEvent
import java.net.{InetSocketAddress, SocketException, Socket, ServerSocket}
import java.io.{File, BufferedWriter, OutputStreamWriter}
impor... | koeninger/spark | streaming/src/test/scala/spark/streaming/InputStreamsSuite.scala | Scala | bsd-3-clause | 11,403 |
/* scala-stm - (c) 2009-2010, Stanford University, PPL */
package scala.concurrent.stm
import scala.collection.{immutable, mutable, generic}
object TSet {
object View extends generic.MutableSetFactory[TSet.View] {
implicit def canBuildFrom[A]: generic.CanBuildFrom[Coll, A, TSet.View[A]] = setCanBuildFrom[A]... | djspiewak/scala-stm | src/main/scala/scala/concurrent/stm/TSet.scala | Scala | bsd-3-clause | 4,241 |
object SeveralDuplicates {
def foo(i: Int) {
/*start*/
println(i + 1)
/*end*/
println(2 + 1)
}
def bar() {
println(3 + 1)
}
println(4 + 1)
}
/*
object SeveralDuplicates {
def foo(i: Int) {
/*start*/
testMethodName(i)
/*end*/
testMethodName(2)
}
def testMethodName(i... | consulo/consulo-scala | testdata/extractMethod/duplicates/SeveralDuplicates.scala | Scala | apache-2.0 | 418 |
package org.atmosphere.cpr
import java.net.URI
import org.scalatra.atmosphere.{ RedisScalatraBroadcaster, ScalatraBroadcaster }
trait BroadcasterConf {
def broadcasterClass: Class[_ <: ScalatraBroadcaster]
def uri: URI
def extraSetup: Broadcaster => Unit // To perform optional plugin-specific Broadcaster setup... | dozed/scalatra | atmosphere/src/main/scala/org/atmosphere/cpr/broadcaster_configs.scala | Scala | bsd-2-clause | 1,673 |
package org.greencheek.spray.cache.memcached
// adds await on the future
import spray.util._
import org.greencheek.util.memcached.{WithMemcached, MemcachedBasedSpec}
import akka.actor.ActorSystem
import net.spy.memcached.ConnectionFactoryBuilder.Protocol
import scala.concurrent._
import ExecutionContext.Implicits.gl... | tootedom/spray-cache-spymemcached | src/test/scala/org/greencheek/spray/cache/memcached/MultiMemcachedHostsSpec.scala | Scala | apache-2.0 | 1,209 |
package chat.tox.antox.callbacks
import android.content.Context
import chat.tox.antox.data.State
import chat.tox.antox.utils.AntoxLog
import chat.tox.antox.wrapper.CallNumber
import im.tox.tox4j.av.data.{AudioChannels, SamplingRate}
class AntoxOnAudioReceiveFrameCallback(private var ctx: Context) {
def audioReceiv... | subliun/Antox | app/src/main/scala/chat/tox/antox/callbacks/AntoxOnAudioReceiveFrameCallback.scala | Scala | gpl-3.0 | 657 |
package toguru.api
import toguru.impl.{ToggleState, TogglesString}
/**
* Contains the information needed by [[toguru.api.Toggle]]s to make toggling decisions.
*/
trait Toggling {
def client: ClientInfo
def activations: Activations
/**
* Returns the activation state of the given toggle.
*
* @p... | AutoScout24/toguru-scala-client | core/src/main/scala/toguru/api/Toggling.scala | Scala | mit | 3,132 |
package breeze.stats.random
/*
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 applicable l... | tjhunter/scalanlp-core | learn/src/main/scala/breeze/stats/random/RandomGenerator.scala | Scala | apache-2.0 | 2,238 |
package temportalist.esotericraft.galvanization.common.task.ai.world
import net.minecraft.entity.{EntityCreature, EntityLivingBase}
import net.minecraft.item.ItemStack
import net.minecraft.util.EnumFacing.Axis
import net.minecraft.util.math.BlockPos
import net.minecraft.util.{EnumFacing, EnumHand}
import net.minecraft... | TheTemportalist/EsoTeriCraft | src/main/scala/temportalist/esotericraft/galvanization/common/task/ai/world/TaskItemExtract.scala | Scala | apache-2.0 | 3,949 |
package com.ing.baker.runtime.javadsl
import java.util
import java.util.Optional
import java.util.concurrent.CompletableFuture
import java.util.function.{BiConsumer, Consumer}
import com.ing.baker.il.{CompiledRecipe, RecipeVisualStyle}
import com.ing.baker.runtime.common.LanguageDataStructures.JavaApi
import com.ing.... | ing-bank/baker | core/baker-interface/src/main/scala/com/ing/baker/runtime/javadsl/Baker.scala | Scala | mit | 16,871 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); yo... | MyPureCloud/kafka | core/src/main/scala/kafka/server/DynamicBrokerConfig.scala | Scala | apache-2.0 | 35,307 |
package org.jetbrains.plugins.scala.debugger.evaluateExpression
import org.jetbrains.plugins.scala.debugger.ScalaDebuggerTestCase
/**
* User: Alefas
* Date: 15.10.11
*/
class ScalaLocalMethodEvaluationTest extends ScalaDebuggerTestCase {
def testSimple() {
addFileToProject("Sample.scala",
"""
|o... | triggerNZ/intellij-scala | test/org/jetbrains/plugins/scala/debugger/evaluateExpression/ScalaLocalMethodEvaluationTest.scala | Scala | apache-2.0 | 8,858 |
package diffson
package jsonpatch
import lcsdiff._
import jsonpointer._
import cats._
import cats.implicits._
import diffson.lcs.Patience
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
import scala.util.Try
import scala.language.implicitConversions
import org.scalatest.matchers.should.Matchers
abst... | gnieh/diffson | testkit/shared/src/main/scala/diffson/TestJsonDiff.scala | Scala | apache-2.0 | 7,545 |
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.