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 |
|---|---|---|---|---|---|
package 练习22
object Runner {
def main(arr: Array[String]): Unit = {
// 下次尝试 3数相乘.乘(t1, t2, t3)
// 下次尝试 乘数为0
val 乘数1 = 乘数T1.fromInt(47)
val 乘数2 = 乘数T2.fromInt(31)
val 乘数3 = 乘数T3.fromInt(23)
println(s"Type value: ${乘数3.乘3(乘数1, 乘数2).length}")
println(s"Count value: ${47 * 31 * 23}")
}
}... | djx314/ubw | a28-练习/src/main/scala/练习22/Runner.scala | Scala | bsd-3-clause | 393 |
package com.sksamuel.scapegoat.inspections.math
import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.{ FreeSpec, Matchers }
/** @author Matic Potočnik */
class UseExpM1Test extends FreeSpec with Matchers with PluginRunner {
override val inspections = Seq(new UseExpM1)
"using exp(x) - 1 instead of exp... | pwwpche/scalac-scapegoat-plugin | src/test/scala/com/sksamuel/scapegoat/inspections/math/UseExpM1Test.scala | Scala | apache-2.0 | 702 |
/*
* Copyright 2014–2017 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... | drostron/quasar | core/src/main/scala/quasar/fs/mount/cache/ViewCache.scala | Scala | apache-2.0 | 2,236 |
/*
* Copyright 2021 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/amls-frontend | test/controllers/businessactivities/TaxMattersControllerSpec.scala | Scala | apache-2.0 | 5,865 |
package com.github.bespalovdn.asteriskscala.common.protocol
object AsteriskFormatter
{
implicit class EscapeAndQuoteString(value: String){
def escaped: String = escapeAndQuote(value)
}
implicit class EscapeAndQuoteTraversable(value: Traversable[String]){
def escaped: String = escapeAndQuot... | bespalovdn/asterisk-scala | common/src/main/scala/com/github/bespalovdn/asteriskscala/common/protocol/AsteriskFormatter.scala | Scala | mit | 879 |
package com.lucidchart.open.cashy.uploaders
import com.lucidchart.open.cashy.amazons3.S3Client
import com.lucidchart.open.cashy.models.{Asset, User, AssetModel}
import com.lucidchart.open.cashy.utils.JsCompress
import com.lucidchart.open.cashy.config.UploadFeatureConfig
import scala.collection.mutable.MutableList
ob... | lucidsoftware/cashy | app/com/lucidchart/open/cashy/uploaders/JsUploader.scala | Scala | apache-2.0 | 2,252 |
package io.github.suitougreentea.VariousMinos
/**
* Created by suitougreentea on 14/12/04.
*/
class Timer {
var stackTime: Long = 0
var startTime: Long = -1
var stopped = true
def start(): Unit = {
startTime = System.currentTimeMillis()
stopped = false
}
def stop(): Unit = {
if(startTime != -... | suitougreentea/VariousMinos2 | src/main/scala/io/github/suitougreentea/VariousMinos/Timer.scala | Scala | mit | 623 |
package caustic.compiler.util
/**
* An indentation preserving string context. Standard string interpolation does not preserve
* indentation; s" $x" will indent only the first line of x and not subsequent lines. Indenters
* apply the same indentation to all lines of x; i" $x" will indent all lines of x by 2.
*
*... | ashwin153/caustic | caustic-compiler/src/main/scala/caustic/compiler/util/Indenter.scala | Scala | apache-2.0 | 980 |
package at.logic.gapt.proofs.sketch
import at.logic.gapt.expr.{ FOLAtom, Atom, clauseSubsumption }
import at.logic.gapt.proofs.resolution._
import at.logic.gapt.proofs.{ FOLClause, HOLClause, SequentConnector, SequentProof }
import at.logic.gapt.provers.ResolutionProver
import at.logic.gapt.provers.escargot.{ Escargot... | gebner/gapt | core/src/main/scala/at/logic/gapt/proofs/sketch/refutationSketch.scala | Scala | gpl-3.0 | 5,571 |
/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package scalaguide.xml.scalaxmlrequests {
import play.api.test._
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner
import play.api.Application
import play.api.mvc._
import play.api.mvc.Results._
import scala... | Shenker93/playframework | documentation/manual/working/scalaGuide/main/xml/code/ScalaXmlRequests.scala | Scala | apache-2.0 | 2,819 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | MyPureCloud/kafka | core/src/test/scala/unit/kafka/coordinator/transaction/ProducerIdManagerTest.scala | Scala | apache-2.0 | 3,474 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | unix1986/universe | tool/kafka-0.8.1.1-src/core/src/main/scala/kafka/controller/PartitionStateMachine.scala | Scala | bsd-2-clause | 29,647 |
package com.nutomic.ensichat.integration
import java.io.File
import java.util.concurrent.{CountDownLatch, TimeUnit}
import java.util.{Timer, TimerTask}
import com.nutomic.ensichat.core.messages.body.Text
import com.nutomic.ensichat.core.util.Crypto
import scala.concurrent.ExecutionContext.Implicits.global
import scal... | Nutomic/ensichat | integration/src/main/scala/com.nutomic.ensichat.integration/Main.scala | Scala | mpl-2.0 | 9,306 |
package gs.nick
import scala.concurrent.Future
trait GamesDaoTrait {
def getAllGames: Future[Seq[DbGame]]
def getAllBySystem(systemId: Int): Future[Seq[DbGame]]
def getGame(id: Int): Future[Option[DbGame]]
def addGame(game: DbGame): Future[Int]
}
| nickfun/api-games | src/main/scala/gs/nick/GamesDaoTrait.scala | Scala | gpl-3.0 | 260 |
package net.sf.latexdraw.parsers.pst.parser
import java.awt.Color
import net.sf.latexdraw.glib.models.interfaces.IShape
import net.sf.latexdraw.glib.views.latex.DviPsColors
/**
* A parser grouping parsers parsing text commands.<br>
*<br>
* This file is part of LaTeXDraw<br>
* Copyright (c) 2005-2013 Arnaud BLOUI... | arnobl/latexdraw-mutants | GUImutants/original/net.sf.latexdraw/src/main/net/sf/latexdraw/parsers/pst/parser/TextCommandsParser.scala | Scala | gpl-2.0 | 5,373 |
package io.travisbrown.abstracted.internal
import scala.reflect.ClassTag
private[abstracted] trait MacrosCompat {
type Context = scala.reflect.macros.Context
def resultType(c: Context)(tpe: c.Type)(implicit
/**
* See SI-5143 for discussion of why we need this class tag.
*/
tag: ClassTag[c.unive... | travisbrown/abstracted | core/src/main/scala-2.10/io/travisbrown/abstracted/internal/MacrosCompat.scala | Scala | apache-2.0 | 909 |
package chat.tox.antox.activities
import java.io.File
import android.content.Intent
import android.graphics.PorterDuff
import android.os.{Build, Bundle}
import android.support.v7.app.AppCompatActivity
import android.text.{Editable, TextWatcher}
import android.view.View
import android.widget.{EditText, TextView}
impo... | gale320/Antox | app/src/main/scala/chat/tox/antox/activities/FriendProfileActivity.scala | Scala | gpl-3.0 | 4,029 |
/**
* 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... | MykolaB/gatling | gatling-http/src/main/scala/io/gatling/http/response/ResponseBuilder.scala | Scala | apache-2.0 | 7,156 |
package skarn
package routing
/**
* Created by yusuke on 2015/03/04.
*/
import akka.actor.ActorContext
import skarn.push.PushServiceInfo
import spray.routing._
import Directives._
import spray.http.MediaTypes._
class IndexRoute(context: ActorContext) extends BasicRoute {
implicit val system = context.system
va... | trifort/skarn | src/main/scala/skarn/routing/IndexRoute.scala | Scala | mit | 736 |
package com.jaroop.anorm.debug
import anorm._
trait ParserDebugger {
val dash = "-" * 100
val star = "*" * 100
}
object RowParserDebugger extends ParserDebugger {
def apply[A](parser: RowParser[A], name: String): RowParser[A] = new RowParser[A] {
def apply(v1: Row): SqlResult[A] = {
... | mhzajac/anorm-debugger | src/main/scala/com/jaroop/anorm/debug/ParserDebugger.scala | Scala | apache-2.0 | 2,053 |
package com.equalinformation.scala.programs.gui
import scala.swing._
import scala.swing.event.ButtonClicked
/**
* Created by bpupadhyaya on 6/23/16.
*/
object SwingAppButton2 extends SimpleSwingApplication {
override def top: Frame = new MainFrame {
title = "Swing App with Button - 2"
val button = new B... | bpupadhyaya/scala-programs-collection | scala-programs-collection/src/main/scala/com/equalinformation/scala/programs/gui/SwingAppButton2.scala | Scala | apache-2.0 | 768 |
/*
* Copyright 2017-2022 John Snow Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | JohnSnowLabs/spark-nlp | src/main/scala/com/johnsnowlabs/nlp/annotators/btm/TMNodesReader.scala | Scala | apache-2.0 | 1,408 |
/*
* Copyright 2017 Zhang Di
*
* 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 ... | statgenetics/seqspark | src/main/scala/org/dizhang/seqspark/ds/Pedigree.scala | Scala | apache-2.0 | 1,099 |
package net.virtualvoid.sbt.graph.util
import org.specs2.mutable.Specification
class AsciiTreeLayoutSpecs extends Specification {
sealed trait Tree
case class Branch(left: Tree, right: Tree) extends Tree
case class Leaf(i: Int) extends Tree
def children(t: Tree): Seq[Tree] = t match {
case Branch(left, r... | jrudolph/sbt-dependency-graph | src/test/scala/net/virtualvoid/sbt/graph/util/AsciiTreeLayoutSpecs.scala | Scala | apache-2.0 | 2,558 |
/**
* Copyright (C) 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 or a... | lshift/diffa | kernel/src/test/scala/net/lshift/diffa/kernel/differencing/AttributesUtilTest.scala | Scala | apache-2.0 | 3,774 |
/*
* 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 ... | dbtsai/spark | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/complexTypesSuite.scala | Scala | apache-2.0 | 17,712 |
package org.openmole.core.workflow
import org.openmole.core.expansion.FromContext
import org.openmole.core.fileservice.FileService
import org.openmole.core.workspace.TmpDirectory
package object validation {
trait ValidationPackage
}
| openmole/openmole | openmole/core/org.openmole.core.workflow/src/main/scala/org/openmole/core/workflow/validation/package.scala | Scala | agpl-3.0 | 239 |
package pgep.Functions
object BoolFunctions {
val and = Func(Symbol("&"), List(classOf[Boolean], classOf[Boolean]), classOf[Boolean],
(ns: Seq[Any]) => (ns(0), ns(1)) match {
case (n1: Boolean, n2: Boolean) => n1 & n2},
(ns: Seq[String]) => (ns(0), ns(1)) match {
... | khernyo/PGEP | src/pgep/Functions/BoolFunctions.scala | Scala | gpl-3.0 | 982 |
/*
* 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/hive/src/main/scala/org/apache/spark/sql/hive/package.scala | Scala | apache-2.0 | 1,157 |
/*
* Copyright (c) 2014-2017 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0, and
* you may not use this file except in compliance with the Apache License
* Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
* http://www.a... | sspinc/snowplow | 2-collectors/scala-stream-collector/src/test/scala/com.snowplowanalytics.snowplow.collectors.scalastream/TestUtils.scala | Scala | apache-2.0 | 1,563 |
package korolev.blazeServer
import org.http4s.blaze.channel.ServerChannel
import org.http4s.blaze.http.HttpService
import slogging._
import scala.concurrent.ExecutionContextExecutorService
/**
* @author Aleksey Fomkin <aleksey.fomkin@gmail.com>
*/
abstract class KorolevBlazeServer(config: BlazeServerConfig = Bl... | PhilAndrew/JumpMicro | JMCloner/src/main/scala/korolev/blazeServer/KorolevBlazeServer.scala | Scala | mit | 861 |
package org.scalatest.examples.funspec
import org.scalatest.FunSpec
class SetSpec extends FunSpec {
describe("A Set") {
describe("when empty") {
it("should have size 0") {
assert(Set.empty.size === 0)
}
it("should produce NoSuchElementException when head is invoked") {
in... | hubertp/scalatest | examples/src/main/scala/org/scalatest/examples/funspec/SetSpec.scala | Scala | apache-2.0 | 409 |
package org.zalando.nakadi.client.scala.model
import org.scalatest.Matchers
import org.scalatest.WordSpec
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.databind.DeserializationFeature
import org.slf4j.Logger
import org.slf4j.LoggerF... | zalando/nakadi-klients | client/src/test/scala/org/zalando/nakadi/client/scala/model/ScalaJacksonJsonMarshallerTest.scala | Scala | mit | 4,976 |
/*
* Copyright 2020 Precog Data
*
* 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 ... | quasar-analytics/quasar | foundation/src/main/scala/quasar/contrib/iotac/package.scala | Scala | apache-2.0 | 1,761 |
package org.fathens.colorworks.config.dsl
import scala.io.Source
import scala.util.Random
import scala.tools.nsc.{Global, Settings}
import scala.tools.nsc.interpreter.AbstractFileClassLoader
import scala.tools.nsc.io.VirtualDirectory
import scala.tools.nsc.reporters.ConsoleReporter
import scala.tools.nsc.util.BatchSo... | sawatani/ColorWorks | src/main/scala/org/fathens/colorworks/config/dsl/DynamicCompiler.scala | Scala | mit | 3,453 |
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author Jerry Shi, John Miller
* @version 1.2
* @date Wed Jan 9 15:07:13 EST 2013
* @see LICENSE (MIT style license file).
* @see http://en.wikipedia.org/wiki/C4.5_algorithm
*/
package scalation.analytics
import ... | mvnural/scalation | src/main/scala/scalation/analytics/DecisionTreeC45.scala | Scala | mit | 21,662 |
import Allergen.Allergen
class Allergies {
private lazy val allergenList = Allergen.values
def isAllergicTo(allergen: Allergen, score: Int): Boolean =
(allergen.id & score) != 0
def allergies(score: Int): List[Allergen] =
allergenList.filter(a => isAllergicTo(a, score)).toList
}
object Allergies {
d... | nlochschmidt/xscala | allergies/example.scala | Scala | mit | 713 |
package ch.epfl.scala.index
package server
package routes
import akka.http.scaladsl.server.Directives._
object Assets {
val routes =
get {
path("assets" / "lib" / Remaining) { path ⇒
getFromResource("lib/" + path)
} ~
path("assets" / "img" / Remaining) { path ⇒
getFromResou... | adamwy/scaladex | server/src/main/scala/ch.epfl.scala.index.server/routes/Assets.scala | Scala | bsd-3-clause | 1,101 |
package com.netscout.aion2.split
import com.netscout.aion2.SplitStrategy
import com.netscout.aion2.except.IllegalQueryException
import com.netscout.aion2.model.{QueryStrategy, EmptyQueryStrategy}
import java.time.{Duration, Instant}
import java.util.Date
import javax.ws.rs.core.MultivaluedMap
import scala.concurren... | FlukeNetworks/aion | src/main/scala/com/netscout/aion2/split/DurationSplitStrategy.scala | Scala | apache-2.0 | 5,410 |
/**
* 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... | pwielgolaski/gatling | gatling-core/src/main/scala/io/gatling/core/util/Shard.scala | Scala | apache-2.0 | 1,848 |
package scala_pastebin
import java.io.File
case class CommandLineConfig(
api_dev_key: String = ApiDevKey(),
var api_paste_code: String = "",
api_paste_name: String = "",
api_paste_format: String = "java",
api_paste_expire_date: String = "10M",
api_option: String = "paste",
file: String = null) | humbhenri/scala_pastebin | src/main/scala/scala_pastebin/CommandLineConfig.scala | Scala | unlicense | 310 |
/*
* # Trove
*
* This file is part of Trove - A FREE desktop budgeting application that
* helps you track your finances, FREES you from complex budgeting, and
* enables you to build your TROVE of savings!
*
* Copyright © 2016-2021 Eric John Fredericks.
*
* Trove is free software: you can redistribute it ... | emanchgo/trove | src/main/scala/trove/ui/Main.scala | Scala | gpl-3.0 | 3,777 |
package lang.lightweightjava.ast.statement
import lang.lightweightjava.ast._
import name.namegraph.NameGraphExtended
import name.{Name, Renaming}
case class StatementBlock(blockBody: Statement*) extends Statement {
override def allNames = blockBody.foldLeft(Set[Name]())(_ ++ _.allNames)
override def rename(renam... | matthisk/hygienic-transformations | scala/src/main/scala/lang/lightweightjava/ast/statement/StatementBlock.scala | Scala | lgpl-3.0 | 1,579 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | gioenn/xSpark | core/src/main/scala/org/apache/spark/rdd/InputFileNameHolder.scala | Scala | apache-2.0 | 1,642 |
package org.scalafmt
import org.scalafmt.config.ScalafmtConfig
import org.scalafmt.util.DiffAssertions
import org.scalatest.FunSuite
class RangeTest extends FunSuite with DiffAssertions {
test("range preserves indent") {
val original = """object a {
|val x = 1
|val y = ... | olafurpg/scalafmt | scalafmt-tests/src/test/scala/org/scalafmt/RangeTest.scala | Scala | apache-2.0 | 714 |
package chrome.tabs.bindings
import chrome.windows.bindings.Window
import scala.scalajs.js
class DetachInfo extends js.Object {
def oldWindowId: Window.Id = js.native
def oldPosition: Int = js.native
}
| amsayk/scala-js-chrome | bindings/src/main/scala/chrome/tabs/bindings/DetachInfo.scala | Scala | mit | 213 |
package scalan
import java.io.File
import scalan.compilation.{GraphVizExport, GraphVizConfig}
/**
* Base trait for testing specific rewrite rules
*/
trait RewriteRuleSuite[A] extends BaseShouldTests {
lazy val folder = new File(prefix, suiteName)
def getCtx: TestCtx
trait TestCtx extends ScalanDslExp {
... | PCMNN/scalan-ce | core/src/test/scala/scalan/RewriteRuleSuite.scala | Scala | apache-2.0 | 2,355 |
/*
* 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 ... | bdrillard/spark | mllib/src/test/scala/org/apache/spark/ml/evaluation/BinaryClassificationEvaluatorSuite.scala | Scala | apache-2.0 | 3,869 |
package week5
import math.Ordering
object Merge {
def msort[T](xs: List[T])(implicit ord: Ordering[T]): List[T] = {
val n = xs.length / 2
if (n == 0) xs
else {
def merge(xs: List[T], ys: List[T]): List[T] = (xs, ys) match {
case (Nil, ys) => ys
cas... | M4573R/playground-notes | functional-programming-principles-in-scala/week5/Merge.scala | Scala | mit | 741 |
/*
* Copyright 2015-2016 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | domdom82/openwhisk | core/invoker/src/main/scala/whisk/core/containerpool/ContainerProxy.scala | Scala | apache-2.0 | 15,749 |
/**
* 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... | eljefe6a/kafka | core/src/main/scala/kafka/server/ReplicaFetcherThread.scala | Scala | apache-2.0 | 13,832 |
import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._
import sbtassembly.Plugin._
import sbtassembly.Plugin.AssemblyKeys._
object UschedulerBuild extends Build {
val Organization = "com.none"
val Name = "uScheduler"... | LarsHadidi/uScheduler | project/build.scala | Scala | apache-2.0 | 2,449 |
package pl.msitko.xml.optics
import pl.msitko.xml.BasicJvmSpec
class PlatedJvmSpec extends PlatedSpec with BasicJvmSpec
| note/xml-lens | optics/jvm/src/test/scala/pl/msitko/xml/optics/PlatedJvmSpec.scala | Scala | mit | 122 |
package scala.collection
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.junit.Assert._
import org.junit.Test
@RunWith(classOf[JUnit4])
class MapTest {
@Test def test: Unit = {
val map = collection.Map(
1 -> 1,
2 -> 2,
4 -> 4,
5 -> 5
)
val actual = map... | martijnhoekstra/scala | test/junit/scala/collection/MapTest.scala | Scala | apache-2.0 | 3,196 |
/* Copyright 2009-2016 EPFL, Lausanne */
package leon
package genc
import utils.{ NoPosition, Position }
/*
* The MiniReporter trait is a simple convinient trait that provides
* overloading and shorthands for the usual reporter from LeonContext.
*
* The MiniReporter object simply provides a way to create an inst... | regb/leon | src/main/scala/leon/genc/MiniReporter.scala | Scala | gpl-3.0 | 2,370 |
package structure.monad
// This example is based off the one in Runar Bjarnason's "Dead Simple Dependency Injection" talk.
// http://www.youtube.com/watch?v=ZasXwtTRkio
object FreeMonadEx1 {
sealed trait Interact[A]
case class Ask(prompt: String) extends Interact[String]
case class Tell(msg: String) extends Int... | adilakhter/scalaznoob | src/main/scala/structure/monad/Free.scala | Scala | apache-2.0 | 5,561 |
package com.twitter.finagle.zipkin.thrift
import com.twitter.finagle.tracing._
import com.twitter.util.Time
import com.twitter.util.events.Sink
import org.junit.runner.RunWith
import org.mockito.Mockito._
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
import org.scalatest.mock.MockitoSugar
@RunW... | kingtang/finagle | finagle-zipkin/src/test/scala/com/twitter/finagle/zipkin/thrift/SamplingTracerTest.scala | Scala | apache-2.0 | 1,150 |
package mesosphere.marathon.event.http
import akka.actor.{ Actor, ActorLogging }
import akka.pattern.pipe
import mesosphere.marathon.event.{
MarathonSubscriptionEvent,
Unsubscribe,
Subscribe
}
import mesosphere.marathon.event.http.SubscribersKeeperActor._
import mesosphere.marathon.state.MarathonStore
import sca... | 14Zen/marathon | src/main/scala/mesosphere/marathon/event/http/SubscribersKeeperActor.scala | Scala | apache-2.0 | 2,589 |
package org.mozartoz.bootcompiler
package symtab
/** Companion object for Builtin */
object Builtin {
/** Parameter kind */
object ParamKind extends Enumeration {
val In, Out = Value
}
/** Parameter kind */
type ParamKind = ParamKind.Value
def create(moduleName: String, name: String, arity: Int) = ne... | eregon/mozart-graal | bootcompiler/src/main/scala/org/mozartoz/bootcompiler/symtab/Builtin.scala | Scala | bsd-2-clause | 583 |
/*
* Copyright 2011-2022 GatlingCorp (https://gatling.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... | gatling/gatling | gatling-mqtt/src/main/scala/io/gatling/mqtt/protocol/LastWill.scala | Scala | apache-2.0 | 1,728 |
/*
* 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... | adarro/ddo-calc | subprojects/common/ddo-core/src/main/scala/io/truthencode/ddo/model/feats/FiendishResilience.scala | Scala | apache-2.0 | 1,214 |
//package io.youi.example.ui.hypertext
//
//import io.youi._
//import io.youi.hypertext.style.Image
//import io.youi.hypertext.{ImageView, TextInput}
//import io.youi.util.ImageUtility
//import org.scalajs.dom.Event
//import reactify._
//
//import scala.concurrent.Future
//
//object PreviewImageExample extends HTMLScre... | outr/youi | example/js/src/main/scala/io/youi/example/ui/hypertext/PreviewImageExample.scala | Scala | mit | 1,323 |
package dotty.tools.dotc
package transform
package sjs
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core._
import Contexts._
import Decorators._
import Denotations._
import Flags._
import NameKinds.DefaultGetterName
import StdNames._
import Symbols._
import SymUtils._
import Types._
import util.Spans.Span
... | lampepfl/dotty | compiler/src/dotty/tools/dotc/transform/sjs/PrepJSExports.scala | Scala | apache-2.0 | 18,190 |
/*
* Copyright (C) 2017 LREN CHUV for Human Brain Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version... | HBPSP8Repo/workflow | src/main/scala/ch/chuv/lren/woken/dispatch/package.scala | Scala | apache-2.0 | 990 |
package com.soteradefense.datawake.trails.bolts
import java.util
import java.util.Properties
import backtype.storm.task.TopologyContext
import backtype.storm.topology.OutputFieldsDeclarer
import backtype.storm.topology.base.BaseBasicBolt
import kafka.producer.{Producer, ProducerConfig}
import org.slf4j.{Logger, Logge... | Sotera/datawake-prefetch | trail-specific-search/src/main/scala/com/soteradefense/datawake/trails/bolts/HighLevelKafkaProducer.scala | Scala | apache-2.0 | 1,584 |
package leo.datastructures
/**
* Created by lex on 16.10.14.
*/
abstract class Position(protected val seq: Seq[Int]) extends Pretty {
import leo.datastructures.Position.DerivedPos
def posHead: Int = seq.head
def tail: Position = DerivedPos(seq.tail)
def abstrPos: Position = new DerivedPos(seq :+ 1)
def h... | cbenzmueller/LeoPARD | src/main/scala/leo/datastructures/Position.scala | Scala | bsd-3-clause | 1,235 |
/*
* 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 ... | mbode/flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/plan/rules/logical/PushFilterIntoTableSourceScanRule.scala | Scala | apache-2.0 | 5,631 |
package run.local
import org.apache.spark.sql.SparkSession
import run.shared.GraphXExample
object GraphXLocalExample {
def main(args: Array[String]): Unit = {
val ss = SparkSession.builder().appName("Word2Vec Local Example").master("local[*]").getOrCreate()
GraphXExample.runGraphXExample(ss)
}
}
| Erwangf/wikipedia-mining | src/main/scala/run/local/GraphXLocalExample.scala | Scala | mit | 312 |
package org.scalafmt.util
import scala.annotation.tailrec
import scala.collection.mutable
import scala.meta.Lit
import scala.meta.Name
import scala.meta.Term
import scala.meta.Tree
import scala.meta.tokens.Token
import scala.meta.tokens.Token.Comment
import scala.meta.tokens.Token.LeftParen
import scala.meta.tokens.To... | scalameta/scalafmt | scalafmt-core/shared/src/main/scala/org/scalafmt/util/StyleMap.scala | Scala | apache-2.0 | 5,592 |
package io.github.tailhq.dynaml.utils.sumac
import scala.util.parsing.combinator.RegexParsers
/**
* The base combinator parser definitions to parse a list of items, where items can be quoted and include the list
* separator or not.
* User: andrews
* Date: 3/28/14
*/
trait BaseCombinatorParser[T] extends RegexP... | mandar2812/DynaML | dynaml-core/src/main/scala/io/github/tailhq/dynaml/utils/sumac/BaseCombinatorParser.scala | Scala | apache-2.0 | 1,650 |
package janstenpickle.vault.manage
import janstenpickle.vault.core.VaultSpec
import janstenpickle.vault.manage.Model.Rule
import org.scalacheck.{Gen, Prop}
import org.specs2.ScalaCheck
import uscala.result.Result
class PolicyIT extends VaultSpec with ScalaCheck {
import PolicyIT._
import VaultSpec._
override d... | janstenpickle/scala-vault | manage/src/it/scala/janstenpickle/vault/manage/PolicyIT.scala | Scala | mit | 1,632 |
package com.scalableQuality.quick.core.phases
import org.scalatest.prop.{
GeneratorDrivenPropertyChecks,
TableDrivenPropertyChecks
}
import org.scalatest.{FlatSpec, Matchers}
class ShouldUseDuringTest
extends FlatSpec
with Matchers
with GeneratorDrivenPropertyChecks
with TableDrivenPropertyChecks ... | MouslihAbdelhakim/Quick | src/test/scala/com/scalableQuality/quick/core/phases/ShouldUseDuringTest.scala | Scala | apache-2.0 | 4,228 |
package lila.practice
import scala.concurrent.duration._
import reactivemongo.api.ReadPreference
import lila.common.Bus
import lila.db.dsl._
import lila.memo.CacheApi._
import lila.study.{ Chapter, Study }
import lila.user.User
final class PracticeApi(
coll: Coll,
configStore: lila.memo.ConfigStore[PracticeC... | luanlv/lila | modules/practice/src/main/PracticeApi.scala | Scala | mit | 4,458 |
package application
import java.time.ZonedDateTime
import javax.inject.Named
import adapter.BitFlyer
import adapter.aws.{MailContent, SES, OrderQueueBody, SQS}
import adapter.bitflyer.PubNubReceiver
import akka.actor.ActorRef
import com.google.gson.Gson
import com.google.inject.{Inject, Singleton}
import com.pubnub.a... | rysh/scalatrader | scalatrader/app/application/RealTimeReceiver.scala | Scala | mit | 5,300 |
package models
import scalikejdbc._
import skinny.orm.{Alias, SkinnyNoIdCRUDMapper}
import utils.MissionTime
case class GameProgress(
gameId: Long,
stationId: Long,
arrivalTime: Option[MissionTime],
station: Option[Station] = None
) {
def save()(implicit session: DBSession): Unit = GameProgress.save... | ponkotuy/train-stamp-rally | app/models/GameProgress.scala | Scala | apache-2.0 | 1,222 |
package app.restlike.common
case class RefProvider(initial: Long) {
private var count = initial
def next = synchronized {
count += 1
s"$count"
}
}
| alltonp/reprobate | src/main/scala/app/restlike/common/RefProvider.scala | Scala | apache-2.0 | 163 |
package model
import skinny.DBSettings
import skinny.test._
import org.scalatest.fixture.FlatSpec
import org.scalatest._
import scalikejdbc._
import scalikejdbc.scalatest._
import org.joda.time._
class MailBatchDetailSpec extends FlatSpec with Matchers with DBSettings with AutoRollback {
}
| yoshitakes/skinny-task-example | src/test/scala/model/MailBatchDetailSpec.scala | Scala | mit | 293 |
/**
* 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... | usakey/kafka | core/src/main/scala/kafka/api/StopReplicaRequest.scala | Scala | apache-2.0 | 5,056 |
package scala
class Board {
// dlaczego [String] jest po nazwie metody a nie po nazwie klasy?
// czy to ma jakiś związek z genericsami?
// var state = Array.fill[String]( 3, 3 )( " " )
var state = Array.ofDim[String]( 3, 3 )
for ( i <- 0 to 2 ) {
for ( j <- 0 to 2 ) {
// czy właściwie jest jakiś po... | jstolarek/sandbox | scala/Board.scala | Scala | unlicense | 1,028 |
package models
import spray.json.DefaultJsonProtocol
import spray.httpx.unmarshalling._
import spray.httpx.marshalling._
case class Tariff(pence: Int, desc: String)
object TariffJsonProtocol extends DefaultJsonProtocol {
implicit val TariffFormat = jsonFormat2(Tariff)
} | opyate/taximeter | src/main/scala/models/Tariff.scala | Scala | mit | 275 |
/*
* 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/MapStatus.scala | Scala | apache-2.0 | 6,736 |
/* RandomizedBackoffSpec.scala
*
* Copyright (c) 2013-2014 linkedin.com
* Copyright (c) 2013-2015 zman.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.o... | zmanio/atmos | src/test/scala/atmos/backoff/RandomizedBackoffSpec.scala | Scala | apache-2.0 | 1,977 |
package org.jetbrains.plugins.scala.lang.completion3
import org.jetbrains.plugins.scala.{LatestScalaVersions, ScalaVersion}
import org.jetbrains.plugins.scala.base.SharedTestProjectToken
class ScalaExtensionMethodCompletionTest extends ScalaCodeInsightTestBase {
override protected def supportedIn(version: ScalaVers... | JetBrains/intellij-scala | scala/scala-impl/test/org/jetbrains/plugins/scala/lang/completion3/ScalaExtensionMethodCompletionTest.scala | Scala | apache-2.0 | 2,261 |
/**
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
*/
package akka.util
import java.util.concurrent.ConcurrentSkipListSet
import akka.actor.{ ActorInitializationException, ActorRef }
/**
* A manager for listener actors. Intended for mixin by observables.
*
* @author Martin Krasser... | felixmulder/scala | test/disabled/presentation/akka/src/akka/util/ListenerManagement.scala | Scala | bsd-3-clause | 2,419 |
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
import java.util.regex.Pattern
import bintray.BintrayPlugin.autoImport._
import com.jsuereth.sbtpgp.PgpKeys
import com.typesafe.tools.mima.core.ProblemFilters
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.plugin.MimaKeys._
import... | benmccann/playframework | project/BuildSettings.scala | Scala | apache-2.0 | 13,220 |
import org.specs2.mutable._
import CSVLang._
class Week10Tests extends Specification {
def getStream(x:CsvData):Stream[Stream[String]] = x match { case CsvData(x,_) => x }
def toList(x:Stream[Stream[String]]):List[List[String]] = x.map(x => x.toList).toList
"Week10Tests" should {
/////////////////////////////... | Meemaw/scalaProgramming | week10/src/test/scala/MainTests.scala | Scala | mit | 2,063 |
/*
* 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 ... | wangyixiaohuihui/spark2-annotation | core/src/main/scala/org/apache/spark/network/netty/NettyBlockTransferService.scala | Scala | apache-2.0 | 7,010 |
/*
* Copyright 2012-2020 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 ap... | planet42/Laika | core/shared/src/main/scala/laika/directive/std/BreadcrumbDirectives.scala | Scala | apache-2.0 | 3,485 |
package scalarules.test.junit
import org.junit.Test
//Used to verify a folder doesn't match in test discovery.
//See JunitMatchesOnlyFilesEvenIfFolderMatchesPattern target
class scala {
@Test
def atLeastOneTestIsNeeded: Unit = {
}
}
| ianoc/rules_scala | test/src/main/scala/scalarules/test/junit/scala.scala | Scala | apache-2.0 | 242 |
package sand.gcs.system.distributed
import akka.actor.{ Actor, ActorRef, ActorSystem, Address, AddressFromURIString, Deploy, Props }
import akka.remote.{ RemoteClientLifeCycleEvent, RemoteScope }
import com.typesafe.config.ConfigFactory
import java.net.InetAddress
import sand.gcs.system.GraphCoordinateSystem
import sa... | snowland/scala-gcs | src/main/scala/sand/gcs/system/distributed/DistributedGCS.scala | Scala | bsd-3-clause | 4,966 |
package wow.auth.handlers
import akka.pattern.ask
import akka.util.Timeout
import wow.auth.AccountsState
import wow.auth.AccountsState.IsOnline
import wow.auth.data.Account
import wow.auth.protocol.AuthResults
import wow.auth.protocol.packets.{ClientLogonProof, ServerLogonProof, ServerLogonProofFailure, ServerLogonPro... | SKNZ/SpinaciCore | wow/core/src/main/scala/wow/auth/handlers/LogonProofHandler.scala | Scala | mit | 2,141 |
package dundertext.editor
import dundertext.data.Time
trait Player {
def cue(time: Time): Unit
def currentTime: Time
def isPaused: Boolean
def play(): Unit
def pause(): Unit
def cueStart(): Unit
def cueEnd(): Unit
def seek(offsetMillis: Int): Unit
def playUntil(time: Time): Unit
}
| dundertext/dundertext | editor/src/main/scala/dundertext/editor/Player.scala | Scala | gpl-3.0 | 302 |
package leon.gametictactoe
import scala.scalajs.js.JSApp
import scala.scalajs.js.annotation.JSExport
import org.scalajs.dom
import dom.document
import dom.html
import leon.lang._
import leon.util.Random
import leon.lang.StaticChecks._
@JSExport
object Main {
import GameTicTacToe._
type Ctx2D = dom.CanvasRend... | epfl-lara/leon | examples/gametictactoe/src/main/scala/leon/gametictactoe/Main.scala | Scala | gpl-3.0 | 3,448 |
package com.sksamuel.scapegoat.inspections.collections
import com.sksamuel.scapegoat._
/**
* @author Stephen Samuel
*
* Inspired by IntelliJ
*
* Checks for filter.size > 0, filter.size == 0, etc
*/
class FilterDotSizeComparison extends Inspection {
def inspector(context: InspectionContext): I... | pwwpche/scalac-scapegoat-plugin | src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotSizeComparison.scala | Scala | apache-2.0 | 976 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | BryanCutler/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/objects.scala | Scala | apache-2.0 | 12,071 |
package io.flow.reference
import io.flow.reference.v0.models.Country
import scala.collection.mutable
object Countries extends Validation[Country] {
override val cache: Map[String, Country] = Map(
data.Countries.all.flatMap { c =>
Seq(
c.iso31662.toLowerCase -> c,
c.iso31663.toLowerCase ->... | flowcommerce/lib-reference-scala | src/main/scala/io/flow/reference/Countries.scala | Scala | mit | 2,667 |
/*
* 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... | jenniew/BigDL | spark/dl/src/test/scala/com/intel/analytics/bigdl/nn/LogSoftMaxSpec.scala | Scala | apache-2.0 | 4,906 |
package org.bitcoins.wallet
import org.bitcoins.core.api.dlc.wallet.AnyDLCHDWalletApi
import org.bitcoins.core.api.wallet.db.AccountDb
import org.bitcoins.core.hd.AddressType
import org.bitcoins.core.protocol.BitcoinAddress
import scala.concurrent.Future
/** ScalaMock cannot stub traits with protected methods,
* s... | bitcoin-s/bitcoin-s | app/server-test/src/test/scala/org/bitcoins/wallet/MockWalletApi.scala | Scala | mit | 758 |
package uk.zebington.junkcraft.handlers
import net.minecraftforge.fml.common.network.NetworkRegistry
import net.minecraftforge.fml.relauncher.Side
import uk.zebington.junkcraft._
import uk.zebington.junkcraft.messages.MessageSpikeStation
/**
* Created by Charlotte on 22/02/2015.
*/
object JCPacketHandler {
val In... | zebington/JunkCraft | src/main/scala/uk/zebington/junkcraft/handlers/JCPacketHandler.scala | Scala | gpl-3.0 | 607 |
package is.hail.types.physical
import is.hail.types.virtual.TStream
abstract class PStream extends PIterable with PUnrealizable {
lazy val virtualType: TStream = TStream(elementType.virtualType)
def separateRegions: Boolean
def _asIdent = s"stream_of_${elementType.asIdent}"
}
abstract class PStreamCode exten... | cseed/hail | hail/src/main/scala/is/hail/types/physical/PStream.scala | Scala | mit | 374 |
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.