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 |
|---|---|---|---|---|---|
abstract class Coroutine[+T] {
def continue: Option[T]
}
object Macros {
import scala.quoted.*
inline def coroutine[T](inline body: Any): Coroutine[T] = ${ coroutineImpl('{body}) }
def coroutineImpl[T: Type](expr: Expr[_ <: Any])(using Quotes): Expr[Coroutine[T]] = {
import quotes.reflect.*
'{
new ... | dotty-staging/dotty | tests/pos-macros/i8651b.scala | Scala | apache-2.0 | 553 |
/*
* 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-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala | Scala | apache-2.0 | 6,385 |
package akka.ainterface.remote.epmd.client
import java.nio.charset.StandardCharsets
import org.scalacheck.Arbitrary.arbitrary
import org.scalacheck.Gen
import org.scalatest.WordSpec
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import scodec.bits.BitVector
import scodec.{Attempt, DecodeResult, Decoder, Err}
... | ainterface/ainterface | ainterface/src/test/scala/akka/ainterface/remote/epmd/client/Port2RespSpec.scala | Scala | apache-2.0 | 2,269 |
/*
* 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... | yu-iskw/gihyo-spark-book-example | src/test/scala/jp/gihyo/spark/ch08/GeneratePurchaseLogExampleSuite.scala | Scala | apache-2.0 | 1,505 |
/*
* Copyright 2016 Alexey Kardapoltsev
*
* 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 ag... | kardapoltsev/astparser | src/test/scala/com/github/kardapoltsev/astparser/parser/LexerSpec.scala | Scala | apache-2.0 | 5,237 |
package spinoco.protocol.mail
import org.scalacheck.Properties
import org.scalacheck.Prop._
import spinoco.protocol.mail.header.codec.EmailAddressCodec
/**
* Created by pach on 18/10/17.
*/
object EmailAddressSpec extends Properties("EmailAddress") {
import SpecUtil._
implicit val codec = EmailAddressCodec.c... | Spinoco/protocol | mail/src/test/scala/spinoco/protocol/mail/EmailAddressSpec.scala | Scala | mit | 2,511 |
/*
* Copyright (c) 2014-2018 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... | Wogan/monix | monix-execution/js/src/main/scala/monix/execution/internal/DefaultUncaughtExceptionReporter.scala | Scala | apache-2.0 | 1,067 |
package drt.shared.airportconfig
import uk.gov.homeoffice.drt.auth.Roles.MAN
import drt.shared.PaxTypes.EeaMachineReadable
import drt.shared.PaxTypesAndQueues._
import drt.shared.Queues.{EGate, EeaDesk, NonEeaDesk}
import drt.shared.SplitRatiosNs.{SplitRatio, SplitRatios, SplitSources}
import drt.shared.Terminals.{T1,... | UKHomeOffice/drt-scalajs-spa-exploration | shared/src/main/scala/drt/shared/airportconfig/Man.scala | Scala | apache-2.0 | 3,956 |
/*
* Copyright 2019 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... | rossabaker/http4s | ember-server/shared/src/test/scala/org/http4s/ember/server/ConnectionSuite.scala | Scala | apache-2.0 | 5,287 |
import leon.annotation._
import leon.lang._
object Coins {
case class CoinDist(pHead: Rational) {
def pTail: Rational = Rational(1) - pHead
}
def isDist(dist: CoinDist): Boolean =
dist.pHead.isRational && dist.pHead >= Rational(0) && dist.pHead <= Rational(1)
case class CoinsJoinDist(hh: Rational,... | epfl-lara/leon | testcases/proof/proba/rationals/Coins.scala | Scala | gpl-3.0 | 6,457 |
// Copyright (c) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors)
//
// 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, inc... | paulbutcher/ScalaMock | shared/src/main/scala/org/scalamock/util/MacroUtils.scala | Scala | mit | 4,151 |
/**
* 修改前一个函数,返回最大的输出对应的输入。
* 举例来说,largestAt(fun:(Int)=>Int,inputs:Seq[Int])应该返回5。不得使用循环或递归
*/
def largestAt1(fun:(Int)=>Int, inputs:Seq[Int]) = inputs.reduce((a,b)=> if(fun(b)>fun(a)) b else a)
def largestAt2(fun: (Int) => Int, inputs: Seq[Int]) = inputs.map(x => (x, fun(x))).reduceLeft((x,y) => if (x._2 > y._2) x... | vernonzheng/scala-for-the-Impatient | src/Chapter12/exercise06.scala | Scala | mit | 510 |
package com.github.gdefacci.briscola
package competition
import player._
import com.github.gdefacci.ddd._
import scalaz.{ -\\/, \\/, \\/- }
import java.time.LocalDateTime
import com.github.gdefacci.briscola.game._
trait CompetitionDecider extends Decider[CompetitionState, CompetitionCommand, CompetitionEvent, Compet... | gdefacci/briscola | ddd-briscola/src/main/scala/com/github/gdefacci/briscola/competition/competition.scala | Scala | bsd-3-clause | 4,074 |
/**
* 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... | Esquive/kafka | core/src/test/scala/unit/kafka/controller/ReplicaStateMachineTest.scala | Scala | apache-2.0 | 16,850 |
package blended.jms.utils.internal
import akka.actor.ActorSystem
import blended.jms.utils.{BlendedJMSConnection, BlendedJMSConnectionConfig}
import javax.jms._
import scala.util.Try
class DummyConnection extends Connection {
var clientId : String = "clientId"
var el : ExceptionListener = _
override def creat... | lefou/blended | blended.jms.utils/src/test/scala/blended/jms/utils/internal/DummyConnection.scala | Scala | apache-2.0 | 1,810 |
package com.nulabinc.backlog.migration.common.utils
import java.nio.charset.Charset
import better.files.{File => Path}
/**
* @author
* uchida
*/
object IOUtil {
def createDirectory(path: Path): Unit =
path.createDirectories()
def input(path: Path): Option[String] = {
if (!path.isDirectory && path.... | nulab/backlog-migration-common | core/src/main/scala/com/nulabinc/backlog/migration/common/utils/IOUtil.scala | Scala | mit | 936 |
package com.sfxcode.sapphire.extension.showcase.controller
import com.sfxcode.sapphire.core.application.ApplicationEnvironment
import com.sfxcode.sapphire.core.controller.ViewController
import com.sfxcode.sapphire.extension.showcase.ApplicationController
trait BaseController extends ViewController {
def applicatio... | sfxcode/sapphire-extension | demos/showcase/src/main/scala/com/sfxcode/sapphire/extension/showcase/controller/BaseController.scala | Scala | apache-2.0 | 642 |
/*
* 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/examples/src/test/scala/org/apache/mxnetexamples/profiler/ProfilerSuite.scala | Scala | apache-2.0 | 2,244 |
/**
* Copyright (C) 2010-2011 LShift 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... | lshift/diffa | kernel/src/main/scala/net/lshift/diffa/kernel/participants/QueryAction.scala | Scala | apache-2.0 | 1,348 |
package app.db
import com.datastax.driver.core.Session
import com.outworkers.phantom.connectors.KeySpace
trait RootConnector {
implicit def space: KeySpace
implicit def session: Session
}
| PScopelliti/ProjectTracker | note-service/src/main/scala/app/db/RootConnector.scala | Scala | apache-2.0 | 196 |
/***********************************************************************
* Copyright (c) 2013-2017 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... | ronq/geomesa | geomesa-filter/src/main/scala/org/locationtech/geomesa/filter/AndSplittingFilter.scala | Scala | apache-2.0 | 1,173 |
package pl.writeonly.son2.vaadin.servlets
import com.vaadin.annotations.VaadinServletConfiguration
import com.vaadin.server.VaadinServlet
import pl.writeonly.son2.vaadin.ui._
@VaadinServletConfiguration(ui = classOf[UIMain], productionMode = false)
class Servlet extends VaadinServlet
@VaadinServletConfiguration(ui =... | writeonly/scalare | scalare-adin/src/main/scala/pl/writeonly/son2/vaadin/servlets/Servlet.scala | Scala | artistic-2.0 | 1,010 |
package io.config
import locals._
case class Configuration(
settings: SettingsConfig,
spawn: SpawnConfig,
turbulence: TurbulenceConfig,
larva: LarvaConfig,
flow: FlowConfig,
habitat: HabitatConfig,
output: OutputFilesConfig
)
case class SettingsConfig(
randomSeed: Int
)
case class Spa... | shawes/zissou | src/main/scala/io/config/Configuration.scala | Scala | mit | 2,665 |
/*
* 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 not u... | gioenn/xSpark | sql/catalyst/src/test/scala/org/apache/spark/sql/types/DataTypeSuite.scala | Scala | apache-2.0 | 13,652 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | maropu/spark | core/src/main/scala/org/apache/spark/internal/config/Network.scala | Scala | apache-2.0 | 3,353 |
package lila.game
import cats.data.Validated
import chess.format.{ FEN, pgn => chessPgn }
import org.joda.time.DateTime
object Rewind {
private def createTags(fen: Option[FEN], game: Game) = {
val variantTag = Some(chessPgn.Tag(_.Variant, game.variant.name))
val fenTag = fen.map(f => chessPgn.Tag(_.FEN... | luanlv/lila | modules/game/src/main/Rewind.scala | Scala | mit | 1,612 |
package db
import javax.inject.{Inject, Singleton}
import io.flow.dependency.actors.BinaryActor
import io.flow.dependency.v0.models.{Binary, BinaryForm, SyncEvent}
import io.flow.common.v0.models.UserReference
import io.flow.postgresql.{OrderBy, Pager, Query}
import anorm._
import com.google.inject.Provider
import io.... | flowcommerce/dependency | api/app/db/BinariesDao.scala | Scala | mit | 4,729 |
package models.daos
import akka.actor.Status.Success
import com.google.inject.Inject
import com.mohiva.play.silhouette.api.LoginInfo
import com.mohiva.play.silhouette.api.util.{PasswordHasherRegistry, PasswordInfo}
import com.mohiva.play.silhouette.password.BCryptPasswordHasher
import com.mohiva.play.silhouette.persis... | agoetschm/linkmanager | server/app/models/daos/PasswordInfoDAO.scala | Scala | gpl-3.0 | 3,300 |
package text.kanji
/**
* @author K.Sakamoto
* Created on 2016/07/26
*/
object JISLevel3KanjiCharacter extends KanjiCharacter {
override val kanji: Seq[String] = readKanjiCSV("jis_level_3")
}
| ktr-skmt/FelisCatusZero | src/main/scala/text/kanji/JISLevel3KanjiCharacter.scala | Scala | apache-2.0 | 208 |
package net.fwbrasil.activate.serialization
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.io.Serializable
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.io.Output
import com.esoter... | xdevelsistemas/activate | activate-core/src/main/scala/net/fwbrasil/activate/serialization/kryoSerializer.scala | Scala | lgpl-2.1 | 1,872 |
/*
* 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 ... | chenc10/Spark-PAF | sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala | Scala | apache-2.0 | 14,298 |
/*
* 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 ... | irudyak/ignite | modules/scalar/src/main/scala/org/apache/ignite/scalar/pimps/Packet.scala | Scala | apache-2.0 | 934 |
val test1 = Array(
Array(2),
Array(3,4),
Array(6,5,7),
Array(4,1,8,3),
)
def miniTotal(b:Array[Array[Int]], a:Int=0):Int = {
if (b.isEmpty)
a
else {
miniTotal(b.tail, b.head.map(x => x+a).min)
}
}
println(miniTotal(test1))
println(miniTotal(Array(Array(2))))
| ccqpein/Arithmetic-Exercises | Triangle/Triangle.scala | Scala | apache-2.0 | 283 |
/* Copyright 2015 Alessandro Maria Rizzi
* Copyright 2016 Eugenio Gianniti
*
* 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
*
* Unle... | deib-polimi/Profiler | src/main/scala-2.11/session/Session.scala | Scala | apache-2.0 | 2,630 |
package se.gigurra.wallace.gamemodel
case class Entity(val id: String,
val isPlayerUnit: Boolean,
var position: WorldVector = new WorldVector(),
// Extensions
var name: Option[String] = None,
var team: Option[String] = None,
... | GiGurra/Wall-Ace | game_model/src/main/scala/se/gigurra/wallace/gamemodel/Entity.scala | Scala | gpl-2.0 | 567 |
/*
* Original implementation (C) 2014-2015 Kenji Yoshida and contributors
* Adapted and extended in 2016 by foundweekends 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
*
* h... | wolfendale/giter8 | library/src/main/scala/giter8/MavenHelper.scala | Scala | apache-2.0 | 1,938 |
package tastytest
object TestReader extends Suite("TestReader") {
implicit def mkReaderMonad[Ctx]: Reader[Ctx] = new Reader[Ctx]() {}
def pureToString[F[_], A](fa: F[A])(implicit F: Monad[F]): F[String] =
F.flatMap(fa)(a => F.pure(a.toString))
test {
val f = pureToString((s: Unit) => 101)
assert(f... | scala/scala | test/tasty/run/src-2/tastytest/TestReader.scala | Scala | apache-2.0 | 342 |
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package test.http.model
//import java.net.InetAddress
import akka.http.model.Uri._
import akka.scalajs.UTF8
import akka.http.model.{IllegalUriException, Uri}
import utest._
import scala.annotation.tailrec
object UriSpec extends TestSuite {
... | bblfish/akka.http.model.Uri | akka.UriJS/src/test/scala/test/http/model/UriSpec.scala | Scala | apache-2.0 | 31,292 |
/*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... | alexandru/monifu | monix-execution/shared/src/main/scala/monix/execution/CancelablePromise.scala | Scala | apache-2.0 | 9,884 |
package io.peregrine
import io.peregrine.ContentType._
import io.peregrine.test.FlatSpecHelper
class ExampleSpec extends FlatSpecHelper {
/* ###BEGIN_APP### */
class ExampleApp extends Controller {
/**
* Basic Example
*
* curl http://localhost:7070/ => "hello world"
*/
get("/") { r... | dvarelap/stilt | src/test/scala/io/peregrine/ExampleSpec.scala | Scala | apache-2.0 | 9,433 |
package controllers
import play.api._
import play.api.mvc._
import com.dropbox.core.{DbxAppInfo, DbxAuthFinish, DbxWebAuth}
object Application extends Controller {
def index = Action {
Ok(views.html.index("Your new application is ready."))
}
}
| vjousse/dropbox-scala-play | app/controllers/Application.scala | Scala | mit | 257 |
package com.rasterfoundry.datamodel
import java.net.URI
import geotrellis.proj4.CRS
import geotrellis.vector.{MultiPolygon, Projected}
import io.circe.generic.extras.{Configuration, ConfiguredJsonCodec}
@ConfiguredJsonCodec
final case class ExportOptions(mask: Option[Projected[MultiPolygon]],
... | azavea/raster-foundry | app-backend/datamodel/src/main/scala/ExportOptions.scala | Scala | apache-2.0 | 926 |
package soymilky
import soymilky.Configuration._
import soymilky.rally.Story
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.io.Source
import scala.util.{Failure, Success, Try, Random => r}
object Utterances {
def phrase(team: String, story: Story): Future[Str... | Synesso/soymilky | src/main/scala/soymilky/Utterances.scala | Scala | apache-2.0 | 1,646 |
package com.acework.js.components.bootstrap
import com.acework.js.utils.{Mappable, Mergeable}
import japgolly.scalajs.react.Addons.ReactCloneWithProps
import japgolly.scalajs.react._
import scala.scalajs.js
import scala.scalajs.js.UndefOr
/**
* Created by weiyin on 09/03/15.
*/
object Utils {
object ValidCompon... | lvitaly/scalajs-react-bootstrap | core/src/main/scala/com/acework/js/components/bootstrap/Utils.scala | Scala | mit | 7,219 |
trait MatcherYYY {
trait NodeImpl;
trait Matchable extends NodeImpl {
protected def doMatch : Unit = {}
}
}
trait BraceMatcherXXX extends MatcherYYY {
trait NodeImpl extends super.NodeImpl {
def doMatch (braces : BracePair) : Unit
}
trait BracePair {
trait BraceImpl extends NodeImpl with Match... | yusuke2255/dotty | tests/pending/pos/t805.scala | Scala | bsd-3-clause | 420 |
/*
* Copyright 2016 Alexey Kuzin <amkuzink@gmail.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 applicab... | leviathan941/choiceroulette | guiapp/src/main/scala/choiceroulette/gui/controls/actions/ActionModule.scala | Scala | apache-2.0 | 875 |
/*
* 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 ... | zzcclp/carbondata | integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoAllDataTypeLocalDictTest.scala | Scala | apache-2.0 | 13,254 |
/*
* 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 ... | minixalpha/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statsEstimation/SizeInBytesOnlyStatsPlanVisitor.scala | Scala | apache-2.0 | 6,657 |
package ru.wordmetrix.enwiz
import EnWizLookup.{ EnWizStatRequest, EnWizMnemonicRequest, EnWizWords }
//import akka.routing.ActorRefRoutee
import akka.routing.Router
import akka.routing.RoundRobinRouter
//import akka.routing.
//import akka.routing.RoundRobinRoutingLogic
import EnWizParser.EnWizText
import akka.actor... | electricmind/enwiz | src/main/scala/ru/wordmetrix/enwiz/EnWizActor.scala | Scala | apache-2.0 | 1,617 |
/**
* OEML - REST API
* This section will provide necessary information about the `CoinAPI OEML REST API` protocol. <br/> This API is also available in the Postman application: <a href=\\"https://postman.coinapi.io/\\" target=\\"_blank\\">https://postman.coinapi.io/</a> <br/><br/> Implemented Standards: * [HT... | coinapi/coinapi-sdk | oeml-sdk/scala-akka/src/main/scala/org/openapitools/client/api/BalancesApi.scala | Scala | mit | 1,822 |
package mesosphere.marathon
package core.task.update.impl
import java.time.Clock
import javax.inject.Inject
import akka.event.EventStream
import com.google.inject.name.Names
import com.typesafe.scalalogging.StrictLogging
import mesosphere.marathon.core.condition.Condition
import mesosphere.marathon.core.event.Unknown... | guenter/marathon | src/main/scala/mesosphere/marathon/core/task/update/impl/TaskStatusUpdateProcessorImpl.scala | Scala | apache-2.0 | 4,900 |
package com.karasiq.bittorrent.protocol
import java.nio.ByteBuffer
import scala.collection.BitSet
import scala.util.Try
import akka.util.ByteString
import com.karasiq.bittorrent.protocol.extensions.PeerExtensions
private[bittorrent] object BitTorrentTcpProtocol {
def int32FromBytes(bytes: ByteString): Int = {
... | Karasiq/torrentstream | library/src/main/scala/com/karasiq/bittorrent/protocol/BitTorrentTcpProtocol.scala | Scala | apache-2.0 | 6,482 |
/*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... | alexandru/monifu | monix-eval/shared/src/test/scala/monix/eval/TaskStartSuite.scala | Scala | apache-2.0 | 2,802 |
package com.mesosphere.cosmos.rpc.v1.model
import com.mesosphere.cosmos.finch.DispatchingMediaTypedEncoder
import com.mesosphere.cosmos.finch.MediaTypedEncoder
import com.mesosphere.cosmos.rpc.MediaTypes
import com.mesosphere.universe
import io.circe.Decoder
import io.circe.Encoder
import io.circe.JsonObject
import io... | dcos/cosmos | cosmos-common/src/main/scala/com/mesosphere/cosmos/rpc/v1/model/ServiceUpdateResponse.scala | Scala | apache-2.0 | 1,027 |
package example
import scalaz._
import Scalaz._
object SafeVal {
sealed trait SafeVal[+T]
case class Val[T](x:T) extends SafeVal[T]
case class Err(msg:String) extends SafeVal[Nothing]
implicit object safeValMonadPlus extends MonadPlus[SafeVal] {
override def point[A](a: => A):SafeVal[A] = Val(a)
override d... | luzhuomi/learn_you_a_scala_for_great_good | examples/monad/src/main/scala/example/SafeVal.scala | Scala | apache-2.0 | 638 |
/*
* 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.tools.nsc.transf... | scala/scala | src/compiler/scala/tools/nsc/transform/async/AsyncPhase.scala | Scala | apache-2.0 | 12,957 |
/* Copyright (C) 2008-2014 University of Massachusetts Amherst.
This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible)
http://factorie.cs.umass.edu, http://github.com/factorie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with... | zxsted/factorie | src/main/scala/cc/factorie/directed/CollapsedGibbsSampler.scala | Scala | apache-2.0 | 17,901 |
/*
* 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 l... | psyyz10/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/nn/Euclidean.scala | Scala | apache-2.0 | 6,214 |
package com.tuplejump.calliope.native
import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD
import com.datastax.driver.core.Row
import com.tuplejump.calliope.{NativeCasBuilder, CasBuilder}
import scala.annotation.implicitNotFound
class NativeCassandraSparkContext(self: SparkContext) {
/**
*
* ... | brenttheisen/calliope-public | src/main/scala/com/tuplejump/calliope/native/NativeCassandraSparkContext.scala | Scala | apache-2.0 | 1,994 |
package org.powlab.jeye.utils
import org.powlab.jeye.core._
import scala.reflect.runtime.universe._
import scala.reflect.runtime.currentMirror
/**
* TODO here: перенести в core назвать Attributes
*/
object AttributeUtils {
def has[T: TypeTag](attributes: Array[AttributeBaseInfo]): Boolean = attributes.exists(che... | powlab/jeye | src/main/scala/org/powlab/jeye/utils/AttributeUtils.scala | Scala | apache-2.0 | 686 |
package me.danielpes.spark.datetime
import org.scalatest.FlatSpec
class PeriodSuite extends FlatSpec {
"A Period" should "be created directly by its fields" in {
val input = Period(7, 6, 5, 4, 3, 2, 1)
assert(input == new Period(90, 446582001L))
assert(input == Period(months = 90, milliseconds = 446582... | danielpes/spark-datetime-lite | src/test/scala/me/danielpes/spark/datetime/PeriodSuite.scala | Scala | apache-2.0 | 3,597 |
package counters.bench
import java.util.concurrent.TimeUnit
import counters.adder.AtomicLongCounter
import org.jctools.counters.Counter
import org.openjdk.jmh.annotations._
@State(Scope.Group)
@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(2)
@Warmup(iterations = 10)
@Measurement... | dpsoft/Counters | src/main/scala/counters/bench/AtomicLongCounterBench.scala | Scala | apache-2.0 | 558 |
package shield.transports
import com.amazonaws.services.lambda._
import spray.http.HttpHeaders.RawHeader
import spray.http.{HttpEntity, _}
import spray.json._
import spray.json.JsonParser
import com.amazonaws.handlers.AsyncHandler
import com.amazonaws.services.lambda.model._
import com.google.common.io.BaseEncoding
im... | RetailMeNot/shield | src/main/scala/shield/transports/LambdaTransport.scala | Scala | mit | 3,871 |
import shapeless._
import shapeless.ops.hlist._
object WitnessImp
{
def fn[A, B](a: A, b: B)(implicit ev: A *** B) = ???
fn(Witness(3).value, Witness(4).value)
}
| tek/splain | core/src/test/resources-2.13.7+/latest/splain/plugin/ShapelessSpec/witness-value/code.scala | Scala | mit | 168 |
package net.revenj.storage
import org.specs2.mutable.Specification
class S3Check extends Specification {
"S3 smoke test" >> {
S3 ne null
}
}
| ngs-doo/revenj | scala/revenj-storage/src/test/scala/net/revenj/storage/S3Check.scala | Scala | bsd-3-clause | 151 |
/**
* _____ _____ _____ _____ __ _____ _____ _____ _____
* | __| | | | | | | | | __| | |
* |__ | | | | | | | | | |__| | | | |- -| --|
* |_____|_____|_|_|_|_____| |_____|_____|_____|_____|_____|
*
* UNICORNS AT WARP SPEED SINCE 2010
*
* ... | SumoLogic/sumo-gae-collector | gaeCollector-core/src/main/scala/com/sumologic/collector/gae/servlet/ReceiveTestServlet.scala | Scala | apache-2.0 | 2,361 |
package com.andre_cruz.collection
import org.scalatest.{Matchers, WordSpecLike}
class RichTraversableOnceTest extends WordSpecLike with Matchers {
import TraversableOnceUtils.RichTraversableOnce
"A RichTraversableOnce" when {
/** minOption tests */
"using minOption while empty" should {
"yield No... | codecruzer/scala-utils | src/test/scala/com/andre_cruz/collection/RichTraversableOnceTest.scala | Scala | apache-2.0 | 2,537 |
package net.hearthstats.modules
import net.hearthstats.modules.upload.DummyFileUploader
import net.hearthstats.modules.upload.FileUploader
class FileUploaderFactory extends ModuleFactory[FileUploader](
"video uploader",
classOf[FileUploader],
classOf[DummyFileUploader]) | HearthStats/HearthStats.net-Uploader | companion/src/main/scala/net/hearthstats/modules/FileUploaderFactory.scala | Scala | bsd-3-clause | 278 |
package nasa.nccs.esgf.utilities
import scala.io.Source
import scala.util.parsing.combinator._
class OperationNotationParser extends JavaTokenParsers {
var key_index = 0
def new_key: String = { key_index += 1; "ivar#" + key_index }
def expr: Parser[Map[String, Any]] = repsep(function, ",") ^^ (Map() ++ _)
de... | nasa-nccs-cds/EDAS | src/main/scala/nasa/nccs/esgf/utilities/parsers.scala | Scala | gpl-2.0 | 1,826 |
/*
* 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... | dnvriend/akka-http-test | app/com/github/dnvriend/component/simpleserver/route/TryRoute.scala | Scala | apache-2.0 | 1,143 |
package spire.math
import spire.algebra._
import spire.syntax.field._
import spire.syntax.isReal._
import spire.syntax.nroot._
import spire.syntax.order._
import scala.{specialized => spec}
import scala.annotation.tailrec
import scala.math.{ScalaNumber, ScalaNumericConversions, ScalaNumericAnyConversions}
import jav... | lrytz/spire | core/src/main/scala/spire/math/Complex.scala | Scala | mit | 25,046 |
/*
* Copyright (c) 2013-2014 Telefónica Investigación y Desarrollo S.A.U.
*
* 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
*
* Unles... | telefonicaid/fiware-cosmos-platform | cosmos-api/test/es/tid/cosmos/api/controllers/task/TaskDetailsTest.scala | Scala | apache-2.0 | 1,641 |
package pl.arapso.scaffoldings.scala.kafka
import akka.actor.Actor
import net.liftweb.json._
import pl.arapso.scaffoldings.scala.kafka.model.Event
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
class Accountant extends Actor {
implicit val formats = DefaultFormats
c... | arapso-scaffoldings/scala | scala-akka-kafka/events-kafka-producer/src/main/java/pl/arapso/scaffoldings/scala/kafka/Accountant.scala | Scala | apache-2.0 | 997 |
package com.sksamuel.elastic4s.analyzers
import com.sksamuel.elastic4s.anaylzers.AnalyzerDsl
import org.scalatest.{Matchers, WordSpec}
class StandardAnalyzerTest extends WordSpec with AnalyzerDsl with Matchers {
"StandardAnalyzer builder" should {
"set stopwords" in {
standardAnalyzer("testy")
.s... | tototoshi/elastic4s | elastic4s-core-tests/src/test/scala/com/sksamuel/elastic4s/analyzers/StandardAnalyzerTest.scala | Scala | apache-2.0 | 659 |
package com.gjos.scala.swoc
import java.io.{BufferedReader, InputStreamReader}
object Main extends App {
val ioManager = IOManager.runMode
val bot = new Bot(None)
val engine = new Engine(bot, ioManager)
try {
engine.run()
} catch {
case e: RuntimeException => e.printStackTrace()
}
}
| Oduig/swoc2014 | Greedy/src/main/scala/com/gjos/scala/swoc/Main.scala | Scala | apache-2.0 | 307 |
package org.sisioh.aws4s.s3.model
import java.util
import com.amazonaws.services.s3.model.{ S3Event, QueueConfiguration }
import org.sisioh.aws4s.PimpedType
object QueueConfigurationFactory {
def createWithS3Events(queueARN: String, events: Seq[S3Event]): QueueConfiguration =
new QueueConfiguration(queueARN, ... | everpeace/aws4s | aws4s-s3/src/main/scala/org/sisioh/aws4s/s3/model/RichQueueConfiguration.scala | Scala | mit | 684 |
/*
* OpenURP, Open University Resouce Planning
*
* Copyright (c) 2013-2014, OpenURP Software.
*
* OpenURP is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your ... | openurp/edu-core | attendance/ws/src/main/scala/org/openurp/edu/attendance/ws/domain/WeekStates.scala | Scala | gpl-3.0 | 1,960 |
/*
* 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... | dotty-staging/scalatest | scalatest-test/src/test/scala/org/scalatest/ShouldEqualNullSpec.scala | Scala | apache-2.0 | 5,939 |
package yugioh
import yugioh.action.{ActionModule, NoAction, PlayerCause}
import yugioh.action.monster.{Battle, DeclareAttackOnMonster, DeclareDirectAttack}
import yugioh.card.monster.{Attack, Defense, Monster, Set}
import yugioh.events._
sealed trait Step
trait BattlePhaseModule {
def loop(gameState: GameState)(i... | micseydel/yugioh | src/main/scala/yugioh/BattlePhaseStep.scala | Scala | mit | 8,872 |
package org.jetbrains.plugins.scala
package lang
package psi
package impl
package base
package patterns
import com.intellij.lang.ASTNode
import org.jetbrains.plugins.scala.lang.psi.api.base.patterns._
/**
* @author Alexander Podkhalyuzin
* Date: 28.02.2008
*/
class ScCaseClausesImpl(node: ASTNode) extends ScalaPsiE... | ilinum/intellij-scala | src/org/jetbrains/plugins/scala/lang/psi/impl/base/patterns/ScCaseClausesImpl.scala | Scala | apache-2.0 | 407 |
/*
* Copyright (C) 2011-2013 org.bayswater
*
* 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... | newlandsvalley/musicrest | src/main/scala/org/bayswater/musicrest/abc/Tune.scala | Scala | apache-2.0 | 10,739 |
/*
* 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 not u... | knockdata/spark-highcharts | src/main/scala/com/knockdata/spark/highcharts/model/Tooltip.scala | Scala | apache-2.0 | 3,272 |
package models.consul
import play.api.libs.json.Json
case class CheckInfo(
Node: String,
CheckID: String,
Name: String,
Status: String,
Notes: String,
Output: String,
... | leanovate/microzon-web | app/models/consul/CheckInfo.scala | Scala | mit | 480 |
package org.hatdex.hat.she.mappers
import java.util.UUID
import org.hatdex.hat.api.models.{
EndpointQuery,
EndpointQueryFilter,
PropertyQuery
}
import org.hatdex.hat.api.models.applications.{
DataFeedItem,
DataFeedItemContent,
DataFeedItemLocation,
DataFeedItemTitle,
LocationAddress,
LocationGeo
}
i... | Hub-of-all-Things/HAT2.0 | hat/app/org/hatdex/hat/she/mappers/TwitterMappers.scala | Scala | agpl-3.0 | 6,590 |
/*
* Copyright (c) 2013 Curry Order System authors.
* This file is part of Curry Order System. Please refer to the NOTICE.txt file for license details.
*/
import org.mortbay.jetty.Connector
import org.mortbay.jetty.Server
import org.mortbay.jetty.webapp.WebAppContext
import org.mortbay.jetty.nio._
object RunWebApp... | scott-abernethy/curry-order-system | src/test/scala/RunWebApp.scala | Scala | gpl-3.0 | 938 |
package io.github.tailhq.dynaml.graphics.charts.highcharts
/**
* User: austin
* Date: 12/12/14
*/
object Stacking {
type Type = String
val (normal, percent) = ("normal", "percent")
def values = Set(normal, percent)
}
| mandar2812/DynaML | dynaml-core/src/main/scala/io/github/tailhq/dynaml/graphics/charts/highcharts/PlotOptionElements.scala | Scala | apache-2.0 | 227 |
package sigmastate.helpers
import scorex.crypto.hash.Digest32
import special.collection.{Coll, CollOverArray, PairOfCols}
import scorex.util.ModifierId
import org.ergoplatform.{ErgoLikeTransactionTemplate, ErgoLikeTransaction, ErgoLikeContext, UnsignedInput, Input, ErgoBox, DataInput, ErgoBoxCandidate}
import sigmasta... | ScorexFoundation/sigmastate-interpreter | sigmastate/src/test/scala/sigmastate/helpers/TestingHelpers.scala | Scala | mit | 5,878 |
package xitrum.view
import scala.util.control.NonFatal
import org.fusesource.scalate.InvalidSyntaxException
import org.fusesource.scalate.Template
import xitrum.Action
/** Additional utility methods. */
trait ScalateEngineRenderTemplate {
this: ScalateEngine =>
def renderTemplateFile(templateUri: String)(impli... | xitrum-framework/xitrum-scalate | src/main/scala/xitrum/view/ScalateEngineRenderTemplate.scala | Scala | mit | 2,419 |
package me.sgrouples.rogue.naming
import scala.reflect.ClassTag
/** Created by mwielocha on 09/08/16.
*/
sealed trait NamingStrategy {
def apply[T: ClassTag]: String
}
class ClassNamingStrategy(format: Class[_] => String) extends NamingStrategy {
override def apply[T: ClassTag]: String =
format(implicitl... | sgrouples/rogue-fsqio | cc/src/main/scala/me/sgrouples/rogue/naming/NamingStrategy.scala | Scala | apache-2.0 | 798 |
// -----------------------------------------------------------------------------
//
// Scalax - The Scala Community Library
// Copyright (c) 2005-8 The Scalax Project. All rights reserved.
//
// The primary distribution site is http://scalax.scalaforge.org/
//
// This software is released under the terms of the Rev... | geggo98/json4s | scalap/src/main/scala/org/json4s/scalap/Rule.scala | Scala | apache-2.0 | 7,062 |
package korolev.server
/**
* @author Aleksey Fomkin <aleksey.fomkin@gmail.com>
*/
object mimeTypes extends (String => Option[String]) {
def apply(key: String): Option[String] = default.get(key)
// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
val default = Map(
"ez" -> "applica... | PhilAndrew/JumpMicro | JMSangriaGraphql/src/main/scala/korolev/server/mimeTypes.scala | Scala | mit | 40,714 |
package json2caseclass.implementation
import json2caseclass.model.CaseClass.{ClassFieldName, ClassName}
import json2caseclass.model.ScalaType._
import json2caseclass.model.{CaseClass, ScalaObject, ScalaOption, ScalaType}
object CaseClassOperations {
def renameAmbiguous(makeUnique: (Set[String], ClassName) => Option... | battermann/sbt-json | src/main/scala/json2caseclass/implementation/CaseClassOperations.scala | Scala | mit | 2,378 |
package org.scaladebugger.api.utils
import java.util
import java.util.concurrent._
import java.util.concurrent.atomic.AtomicInteger
import scala.util.Try
import LoopingTaskRunner._
/**
* Contains defaults for the looping task runner.
*/
object LoopingTaskRunner {
/** Default initial workers is equal to number o... | chipsenkbeil/scala-debugger | scala-debugger-api/src/main/scala/org/scaladebugger/api/utils/LoopingTaskRunner.scala | Scala | apache-2.0 | 7,185 |
package astar
package test
import org.scalatest._
import org.scalatest.matchers._
class AStarTest extends FunSpec with Matchers {
// x, y, rotation (0, 1, 2, 3)
type State = (Int, Int, Int)
trait Command
case object Left extends Command
case object Right extends Command
case object Up extends Command
... | b-studios/parametric-a-star | src/test/scala/astar/AStarTest.scala | Scala | mit | 1,928 |
package org.libss.util
import org.slf4j.LoggerFactory
/**
* Created by Kaa
* on 03.06.2016 at 05:20.
*/
trait Loggable {
@transient lazy val Logger = LoggerFactory.getLogger(this.getClass)
}
| kanischev/libss | libss-utils/src/main/scala/org/libss/util/Loggable.scala | Scala | apache-2.0 | 202 |
package com.sksamuel.scapegoat.inspections.collections
import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.{ FreeSpec, Matchers, OneInstancePerTest }
/** @author Stephen Samuel */
class CollectionNamingConfusionTest extends FreeSpec with Matchers with PluginRunner with OneInstancePerTest {
override val... | pwwpche/scalac-scapegoat-plugin | src/test/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNamingConfusionTest.scala | Scala | apache-2.0 | 880 |
/* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\\___/_/... | cran/rkafkajars | java/scala/CountedIterator.scala | Scala | apache-2.0 | 865 |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2015-2021 Andre White.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
... | adarro/ddo-calc | subprojects/common/ddo-core/src/main/scala/io/truthencode/ddo/model/enhancement/enhancements/SwiftAmbition.scala | Scala | apache-2.0 | 1,225 |
import leon.lang._
import leon.annotation._
object AssociativeList {
sealed abstract class KeyValuePairAbs
case class KeyValuePair(key: BigInt, value: BigInt) extends KeyValuePairAbs
sealed abstract class List
case class Cons(head: KeyValuePairAbs, tail: List) extends List
case object Nil extends List
s... | ericpony/scala-examples | testcases/web/verification/02_Associative_List.scala | Scala | mit | 1,667 |
package dao
import java.util.UUID
import base.PostgresDbSpec
import database.RoleDb
import database.helper.LdapUserStatus._
import models.{Authority, Role}
import play.api.inject.guice.GuiceableModule
import security.LWMRole
import security.LWMRole._
import slick.dbio.Effect.Write
import slick.jdbc.PostgresProfile.api... | THK-ADV/lwm-reloaded | test/dao/RoleDaoSpec.scala | Scala | mit | 4,300 |
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.