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 sample.stream.experiments
import rx.lang.scala.Observable
import scala.concurrent.duration._
object AmbExample {
def main(args: Array[String]): Unit = {
val observable1 = Observable.from(1 to 5)
val observable2 = observable1.map(_ + 10).delay(1.seconds)
val observable3 = observable1.map(_ + ... | pallavig/akka-examples | src/main/scala/sample/stream/experiments/AmbExample.scala | Scala | cc0-1.0 | 468 |
package Chapter11
object Operators {
// topics:
// identifiers
// infix operators
// unary operators
// assignment operators
// precedence
// associativity
// the apply and update methods
// extractors
// extractors with one or no arguments
// the unapplySeq method
// dynami... | vasnake/scala-for-the-impatient | src/main/scala/Chapter11/Operators.scala | Scala | gpl-3.0 | 36,560 |
/***********************************************************************
* Copyright (c) 2013-2020 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... | aheyne/geomesa | geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/cache/CacheKeyGenerator.scala | Scala | apache-2.0 | 1,312 |
package models.util
import play.api.libs.concurrent.Akka
import play.api.Play.current
import scala.concurrent.ExecutionContext
object ThreadPools {
implicit val analysisExecutionContext: ExecutionContext = Akka.system.dispatchers.lookup("akka.actor.analysis")
implicit val importExecutionContext: ExecutionContext... | haffla/stream-compare | app/models/util/ThreadPools.scala | Scala | gpl-3.0 | 377 |
package com.sageserpent.americium
import cats.Traverse
import com.sageserpent.americium.java.CaseFactory
import _root_.java.time.Instant
import scala.collection.Factory
trait TrialsApi {
def delay[Case](delayed: => Trials[Case]): Trials[Case]
def only[Case](onlyCase: Case): Trials[Case]
def choose[Case](
... | sageserpent-open/americium | src/main/scala/com/sageserpent/americium/TrialsApi.scala | Scala | mit | 2,405 |
package me.laiseca.restcale.http
object HttpMethod {
val DELETE = "DELETE"
val GET = "GET"
val PATCH = "PATCH"
val POST = "POST"
val PUT = "PUT"
} | xabierlaiseca/restcale | shared/src/main/scala/me/laiseca/restcale/http/HttpMethod.scala | Scala | apache-2.0 | 157 |
/*
* RichFunction0.scala
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package scala.actors.controlflow
import scala.actors._
import scala.actors.controlflow.ControlFlow._
/**
* An extension of a <code>Function0</code> that provides support for
* asynch... | bingoyang/scala-otp | controlflow/src/main/scala/scala/actors/controlflow/RichFunction0.scala | Scala | bsd-3-clause | 635 |
/*
* Copyright 2012-2013 Stephane Godbillon (@sgodbillon)
*
* 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 appl... | reallylabs/really | modules/really-core/src/main/scala/io/really/json/collection.scala | Scala | apache-2.0 | 6,845 |
package dmtest
import java.nio.file.{Path, Paths}
import dmtest.stack.{Memory, Direct, Pool}
import org.scalatest._
trait DMTestSuite extends FunSuite with BeforeAndAfterEach with BeforeAndAfterAll {
def isDebugMode: Boolean = Config.rootConfig.isEmpty
implicit class Compare[A](a: A) {
def `<>`(b: A): A = if... | akiradeveloper/dmtest | src/test/scala/dmtest/DMTestSuite.scala | Scala | apache-2.0 | 1,617 |
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This file is part of Rudder.
*
* Rudder is free software: you can redistribute it and/or modify
* it under the... | armeniaca/rudder | rudder-core/src/main/scala/com/normation/rudder/services/queries/QueryProcessor.scala | Scala | gpl-3.0 | 2,805 |
package io.ino.solrs
import io.ino.solrs.AsyncSolrClientMocks.mockDoRequest
import io.ino.solrs.CloudSolrServers.WarmupQueries
import io.ino.solrs.SolrMatchers.hasBaseUrlOf
import io.ino.solrs.SolrMatchers.hasQuery
import io.ino.time.Clock
import org.apache.solr.client.solrj.SolrQuery
import org.apache.solr.client.sol... | inoio/solrs | src/test/scala/io/ino/solrs/CloudSolrServersIntegrationSpec.scala | Scala | apache-2.0 | 10,039 |
/*
* 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 ... | rjpower/spark | core/src/main/scala/spark/util/SerializableBuffer.scala | Scala | apache-2.0 | 1,995 |
/*
* Copyright 2001-2008 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... | svn2github/scalatest | src/main/scala/org/scalatest/tools/ReporterConfiguration.scala | Scala | apache-2.0 | 4,304 |
/*
* 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... | chipsenkbeil/incubator-toree | kernel-api/src/main/scala/org/apache/toree/dependencies/DependencyDownloader.scala | Scala | apache-2.0 | 4,858 |
package de.ljfa.advbackport.logic
import net.minecraft.block.Block
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagList
import net.minecraftforge.common.util.Constants
object ItemLogic {
def canDestroy(tool: ItemStack, block: Block): Boolean = checkList("CanDestroy", tool, block)
def canPla... | ljfa-ag/Adventure-Backport | src/main/scala/de/ljfa/advbackport/logic/ItemLogic.scala | Scala | mit | 968 |
/**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... | ryan-williams/guacamole | src/main/scala/org/bdgenomics/guacamole/variants/Allele.scala | Scala | apache-2.0 | 2,495 |
import sbt._
import sbt.Keys._
import java.util.Properties
object ScctBuild extends Build {
lazy val root = Project(id = "scct", base = file(".")) settings (instrumentSettings :_*)
val scctReportDir = SettingKey[File]("scct-report-dir")
lazy val Scct = config("scct")
lazy val ScctTest = config("scct-test") ... | non/scct | project/Build.scala | Scala | apache-2.0 | 2,987 |
package com.scalaAsm.x86
package Instructions
package General
// Description: Convert Byte to Word
// Category: general/conver
trait CBW extends InstructionDefinition {
val mnemonic = "CBW"
}
object CBW extends ZeroOperands[CBW] with CBWImpl
trait CBWImpl extends CBW {
implicit object _0 extends NoOp{
val o... | bdwashbu/scala-x86-inst | src/main/scala/com/scalaAsm/x86/Instructions/General/CBW.scala | Scala | apache-2.0 | 397 |
package mesosphere.marathon
package core.deployment.impl
import akka.Done
import akka.actor.{Actor, ActorRef, Cancellable, PoisonPill, Props, UnhandledMessage}
import akka.stream.scaladsl.Source
import akka.testkit.TestActorRef
import mesosphere.AkkaUnitTest
import mesosphere.marathon.core.condition.Condition
import m... | mesosphere/marathon | src/test/scala/mesosphere/marathon/core/deployment/impl/TaskReplaceActorTest.scala | Scala | apache-2.0 | 34,164 |
class UnitReturnOneOutput {
def foo(i: Int) {
/*start*/
if (true) return
val x = 0
println(i)
/*end*/
println(x)
}
}
/*
class UnitReturnOneOutput {
def foo(i: Int) {
val x: Int = testMethodName(i) match {
case Some(result) => result
case None => return
}
println(x)
}
... | whorbowicz/intellij-scala | testdata/extractMethod/output/UnitReturnOneOutput.scala | Scala | apache-2.0 | 440 |
/**
* Copyright (C) 2012 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 prog... | wesley1001/orbeon-forms | src/main/scala/org/orbeon/oxf/xforms/analysis/controls/SingleNodeTrait.scala | Scala | lgpl-2.1 | 1,585 |
import scala.quoted.*
object scalatest {
inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition) }
def assertImpl(cond: Expr[Boolean])(using Quotes) : Expr[Unit] = {
import quotes.reflect.*
import util.*
cond.asTerm.underlyingArgument match {
case t @ Apply(TypeApply(Select(... | dotty-staging/dotty | tests/run-macros/reflect-pos-fun/assert_1.scala | Scala | apache-2.0 | 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 ... | bravo-zhang/spark | sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/UnivocityParser.scala | Scala | apache-2.0 | 11,360 |
/*
* Licensed to the Programming Language and Software Methodology Lab (PLSM)
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
* The PLSM licenses this file to You under the Apache License, Version 2.0
... | AtkinsChang/geoconvert | project/project/Plugins.scala | Scala | apache-2.0 | 937 |
package compiler
import datamodel._
import dto.UnitSpec
class ProtocolCompilerSpec extends UnitSpec {
private val protocolName = "TestProtocol"
"Protocol compiler" should "compile valid input" in {
val validInput =
"""
|issue {
| number Number jsonKey=issueNumber cType=uint32_t;
... | gatkin/cDTO | src/test/scala/compiler/ProtocolCompilerSpec.scala | Scala | mit | 2,584 |
object input_in_range2 {
def main(args: Array[String]) {
// Put code here
}
}
| LoyolaChicagoBooks/introcs-scala-examples | input_in_range2/input_in_range2.scala | Scala | gpl-3.0 | 86 |
package io.scalac.slack.bots
import akka.actor.{Actor, ActorLogging, ActorRef}
import akka.util.Timeout
import io.scalac.slack.MessageEventBus
import io.scalac.slack.common.{Incoming, MessageEvent, Outgoing, _}
import scala.concurrent.ExecutionContext
import scala.language.implicitConversions
trait MessagePublisher ... | Cheers-Dev/scala-slack-bot-core | src/main/scala/io/scalac/slack/bots/MessageListener.scala | Scala | mit | 2,057 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | hequn8128/flink | flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/plan/stream/table/validation/CalcValidationTest.scala | Scala | apache-2.0 | 5,406 |
package elascala
/**
* Created by vayne on 15. 2. 24..
*/
case class ElascalaException(code: Int, reason: String) extends RuntimeException | MinCha/elascala | src/main/scala/elascala/ElascalaException.scala | Scala | apache-2.0 | 141 |
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed ... | Ishiihara/kafka | core/src/test/scala/integration/kafka/api/CustomQuotaCallbackTest.scala | Scala | apache-2.0 | 21,016 |
package models
import com.datastax.driver.core.utils._
import org.junit.runner._
import org.specs2.mutable._
import org.specs2.runner._
import scala.concurrent._
import scala.concurrent.duration._
@RunWith(classOf[JUnitRunner])
class PeriodicallyCleanedSpec extends Specification with EmbeddedCassandra {
"C* Perio... | lizepeng/app.io | modules/models/test/models/PeriodicallyCleanedSpec.scala | Scala | apache-2.0 | 1,052 |
/***********************************************************************
* Copyright (c) 2013-2016 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 is ... | mdzimmerman/geomesa | geomesa-features/geomesa-feature-common/src/main/scala/org/locationtech/geomesa/features/serialization/AbstractWriter.scala | Scala | apache-2.0 | 5,703 |
package checklist.laws
import cats.laws.discipline.arbitrary._
import cats.laws.discipline.{ApplicativeTests, ProfunctorTests}
import cats.implicits._
import checklist._
import cats.laws.discipline.MiniInt
class RuleLawTests extends CatsSuite {
checkAll("Rule[Int, String]", ApplicativeTests[Rule[MiniInt, ?]].applic... | davegurnell/checklist | core/src/test/scala/checklist/laws/RuleLawTests.scala | Scala | apache-2.0 | 462 |
package plda.week11
/**
*
* @author Lorand Szakacs, lorand.szakacs@busymachines.com, lsz@lorandszakacs.com
* @since 06 Dec 2016
*
* http://scalapuzzlers.com/#pzzlr-051
*
*/
object Puzzler10Comparison extends App {
object Playroom {
case class Toy(squeezeMsg: String = this.toString) {
... | 2016-Fall-UPT-PLDA/labs | week-11/puzzlers/src/main/scala/plda/week11/Puzzler10Comparison.scala | Scala | gpl-3.0 | 567 |
/*
* Happy Melly Teller
* Copyright (C) 2013 - 2014, Happy Melly http://www.happymelly.com
*
* This file is part of the Happy Melly Teller.
*
* Happy Melly Teller 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 Fo... | HappyMelly/teller | app/models/admin/TransactionType.scala | Scala | gpl-3.0 | 1,189 |
/*
* 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 | core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala | Scala | apache-2.0 | 60,870 |
package org.ferrit.core.crawler
import org.ferrit.core.parser.ParserResult
import org.ferrit.core.uri.{CrawlUri, FetchJob}
import org.ferrit.core.model.CrawlJob
import org.ferrit.core.http.Response
object FetchMessages {
// Messages about decision to fetch or not
sealed abstract class CanFetch {
override de... | reggoodwin/ferrit | src/main/scala/org/ferrit/core/crawler/FetchMessages.scala | Scala | mit | 1,602 |
/*
* Copyright 2013 Commonwealth Computer Research, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... | jwkessi/geomesa | geomesa-utils/src/test/scala/org/locationtech/geomesa/utils/geohash/GeomDistanceTest.scala | Scala | apache-2.0 | 2,820 |
val limit = (1 to 1000).find(n => n + math.sqrt(n) >= 1000).get
val rs = for (b <- 2 until limit; a <- 1 until b; c = 1000 - a - b
if a * a + b * b == c * c) yield a * b * c
val r = rs.head
assert(r == 31875000) // 32 ms
| pavelfatin/projecteuler | p09.scala | Scala | gpl-3.0 | 238 |
package com.filez.astyanax.multientity.play2
import javax.persistence.PersistenceException
import play.api._
import scala.collection.JavaConversions.asScalaSet
import impl._
class MultiEntityPlugin(app:Application) extends Plugin {
/** start of context configuration hierarchy */
val CONTEXTS = "multientity.conte... | hsn10/multiplugin | src/main/scala/Plugin.scala | Scala | agpl-3.0 | 3,115 |
/*
* 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 ... | aosagie/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala | Scala | apache-2.0 | 28,022 |
package com.sksamuel.scrimage.filter
import org.scalatest.{ OneInstancePerTest, BeforeAndAfter, FunSuite }
import com.sksamuel.scrimage.Image
/** @author Stephen Samuel */
class HsbFilterTest extends FunSuite with BeforeAndAfter with OneInstancePerTest {
val original = Image(getClass.getResourceAsStream("/bird_sma... | davenatx/scrimage | scrimage-filters/src/test/scala/com/sksamuel/scrimage/filter/HsbFilterTest.scala | Scala | apache-2.0 | 545 |
/**
* The MIT License
*
* Copyright (c) 2011 Benjamin Klum
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, cop... | helgoboss/commons-scala | src/main/scala/org/helgoboss/commons_scala/MatchResult.scala | Scala | mit | 1,966 |
import scala.tools.partest.ReplTest
object Test extends ReplTest {
def code = """
object x { def x={} }
import x._
x
x
"""
}
| folone/dotty | tests/pending/run/t5655.scala | Scala | bsd-3-clause | 130 |
package services
import com.github.jurajburian.mailer.{Content, Message}
import javax.mail.internet.InternetAddress
import model.User
class MessageTemplateService {
def createConfirmRegistrationMessage(user: User, appName: String, fromEmail: String, followLink: String): Message =
Message(
subject = "Conf... | sysgears/apollo-universal-starter-kit | modules/user/server-scala/src/main/scala/services/MessageTemplateService.scala | Scala | mit | 1,086 |
package views.html.b3.my
package object vertical {
import views.html.b3._
import play.twirl.api.Html
import play.api.mvc.Call
import play.api.i18n.MessagesProvider
import views.html.helper._
/**
* Declares the class for the Vertical FieldConstructor.
*/
class VerticalFieldConstructor(val withFeed... | adrianhurt/play-bootstrap | play26-bootstrap3/sample/app/views/b3/my/vertical/package.scala | Scala | apache-2.0 | 1,925 |
package org.ensime.sexp.formats
import BigIntConvertor._
import org.scalacheck.{ Arbitrary, Gen }
import org.scalatest._
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import scala.collection.immutable.BitSet
class BigIntConvertorSpec extends FunSpec {
private val examples = List(
BitSet() -> BigInt(0)... | eddsteel/ensime | sexpress/src/test/scala/org/ensime/sexp/formats/BigIntConvertorSpec.scala | Scala | gpl-3.0 | 1,676 |
package com.sksamuel.elastic4s
package admin
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequestBuilder
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequestBuilder
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequestBuilder... | maxcom/elastic4s | src/main/scala/com/sksamuel/elastic4s/admin/SnapshotDsl.scala | Scala | apache-2.0 | 3,688 |
package com.dataintuitive
package object luciuscore {
type Value = Double
type ValueVector = Array[Value]
/**
* A RankVector is just an array of Ranks, being Double values.
*
* Please note that we wrap signatures but not RankVectors because we can't afford
* the overhead when running in a distribut... | data-intuitive/LuciusCore | src/main/scala/com/dataintuitive/luciuscore/package.scala | Scala | apache-2.0 | 511 |
object SCL5247 extends App {
var msg = "hello"
val msgUpdater = msg_= _ // This is red with type aware highlighting
/*start*/msgUpdater("bye")/*end*/
println(msg)
}
//Unit | ilinum/intellij-scala | testdata/typeInference/bugs5/SCL5247.scala | Scala | apache-2.0 | 184 |
package org.jetbrains.plugins.scala
package lang.refactoring.ui
import com.intellij.psi.PsiElement
import java.util
import com.intellij.refactoring.ui.AbstractMemberSelectionPanel
import java.awt.BorderLayout
import javax.swing.JScrollPane
import com.intellij.ui.{SeparatorFactory, ScrollPaneFactory}
import org.jetbrai... | consulo/consulo-scala | src/org/jetbrains/plugins/scala/lang/refactoring/ui/ScalaMemberSelectionPanelBase.scala | Scala | apache-2.0 | 1,323 |
package boatcraft.compatibility
import boatcraft.compatibility.ironchest.{IronChestsEventHandler, IronChestsGuiHandler}
import boatcraft.core.GUIHandler
import cpw.mods.fml.common.event.FMLPreInitializationEvent
import net.minecraftforge.common.MinecraftForge
import boatcraft.compatibility.ironchest.modifiers.blocks._... | Open-Code-Developers/BoatCraft | src/main/scala/boatcraft/compatibility/IronChests.scala | Scala | mit | 1,227 |
package nounou
//import breeze.linalg.DenseVector
import java.util.ServiceLoader
import com.google.gson.Gson
import nounou.elements.NNElement
import nounou.elements.data.NNData
import nounou.elements.data.filters.NNDataFilterMedianSubtract
import nounou.io.FileLoader
import nounou.elements.ranges._
import breeze.lin... | ktakagaki/nounou.rebooted150527 | src/main/scala/nounou/NN.scala | Scala | apache-2.0 | 6,836 |
package com.github.romangrebennikov.columnize.proxy
import java.nio.ByteBuffer
import akka.actor.{Actor, ActorLogging, ActorRef}
import akka.io.Tcp.{PeerClosed, Received, Register, Write}
import akka.util.ByteString
/**
* Created by shutty on 10/5/15.
*/
case class Request(data:ByteBuffer)
case class Response(data... | shuttie/columnize | src/main/scala/com/github/romangrebennikov/columnize/proxy/ServerConnection.scala | Scala | bsd-2-clause | 790 |
package edu.berkeley.nlp.entity.coref
import edu.berkeley.nlp.futile.util.Logger
import edu.berkeley.nlp.futile.fig.basic.Indexer
trait DocumentInferencer {
def getInitialWeightVector(featureIndexer: Indexer[String]): Array[Float];
def computeLikelihood(docGraph: DocumentGraph,
pairwi... | malcolmgreaves/berkeley-entity | src/main/java/edu/berkeley/nlp/entity/coref/DocumentInferencer.scala | Scala | gpl-3.0 | 1,944 |
package fpinscala.parallelism
import java.util.concurrent._
object Par {
type Par[A] = ExecutorService => Future[A]
def run[A](s: ExecutorService)(a: Par[A]): Future[A] = a(s)
/*
The implementation of `unit` does not use the `ExecutorService`, it simply returns a `Future` directly.
*/
def unit[A](a:... | ShokuninSan/fpinscala | answers/src/main/scala/fpinscala/parallelism/Par.scala | Scala | mit | 7,652 |
/*
* Copyright © 2015-2019 the contributors (see Contributors.md).
*
* This file is part of Knora.
*
* Knora 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
*... | musicEnfanthen/Knora | webapi/src/test/scala/org/knora/webapi/responders/v2/ResourcesResponseCheckerV2Spec.scala | Scala | agpl-3.0 | 2,954 |
package test;
trait T {
abstract class Foo;
private object FOO_0 extends Foo {
Console.println("FOO_0 initialized")
}
trait X {
def foo : Foo = FOO_0;
}
}
object Test extends App {
val t = new T{}
val x = new t.X{}
Console.println(x.foo)
}
| yusuke2255/dotty | tests/untried/pos/t675.scala | Scala | bsd-3-clause | 266 |
package com.eharmony.aloha.models.h2o
import com.eharmony.aloha
import com.eharmony.aloha.annotate.CLI
import com.eharmony.aloha.id.ModelId
import com.eharmony.aloha.io.vfs.VfsType.VfsType
import com.eharmony.aloha.io.vfs.{Vfs, VfsType}
/**
* Created by rdeak on 11/17/15.
*/
@CLI(flag = "--h2o")
object Cli {
p... | eHarmony/aloha | aloha-h2o/src/main/scala/com/eharmony/aloha/models/h2o/Cli.scala | Scala | mit | 2,993 |
package redstone
import org.scalatest._
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import scala.collection.mutable.HashSet
import redstone._
import redstone.piece._
import redstone.solver._
import redstone.solver.util._
@RunWith(classOf[JUnitRunner])
class PriorityQueueSuite extends FunSu... | skumargithub/redstone-solver | src/test/scala/redstone/PriorityQueueSuite.scala | Scala | gpl-2.0 | 919 |
/*
* Copyright 2017 Datamountaineer.
*
* 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... | datamountaineer/stream-reactor | kafka-connect-cassandra/src/main/scala/com/datamountaineer/streamreactor/connect/cassandra/sink/CassandraSinkConnector.scala | Scala | apache-2.0 | 2,924 |
package com.stefansavev.randomprojections.serialization.core
import java.io._
import com.stefansavev.randomprojections.serialization.core.PrimitiveTypeSerializers.TypedIntSerializer
//approach is losely based on "Scala for generic programmers"
trait TypedSerializer[T]{
type SerializerType = T
def toBinary(outpu... | codeaudit/random-projections-at-berlinbuzzwords | src/main/scala/com/stefansavev/randomprojections/serialization/core/CoreSerialization.scala | Scala | apache-2.0 | 5,760 |
package org.jetbrains.plugins.scala
package codeInsight
package intention
package booleans
import com.intellij.testFramework.EditorTestUtil
/**
* Nikolay.Tropin
* 4/29/13
*/
class SimplifyBooleanExprWithLiteralTest extends intentions.ScalaIntentionTestBase {
import EditorTestUtil.{CARET_TAG => CARET}
over... | JetBrains/intellij-scala | scala/codeInsight/test/org/jetbrains/plugins/scala/codeInsight/intention/booleans/SimplifyBooleanExprWithLiteralTest.scala | Scala | apache-2.0 | 2,157 |
/*
* Copyright 2022 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/fset-faststream | app/services/testdata/candidate/assessmentcentre/AssessmentCentreScoresEnteredStatusGenerator.scala | Scala | apache-2.0 | 6,247 |
package recfun
import common._
import scala.annotation.tailrec
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
for (col <- 0 to row)
print(pascal(col, row) + " ")
println()
}
}
/**
* Exercise 1
*/
def pascal(c: Int, r: I... | alvindaiyan/scalalearning | alvindaiyan-coursera-scala-recfun-18bbfb6a3fd5/src/main/scala/recfun/Main.scala | Scala | apache-2.0 | 1,190 |
/*
* Copyright (c) 2016. Fengguo (Hugo) Wei and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Detailed co... | arguslab/argus-cit-intellij | jc-plugin/src/main/scala/org/argus/jc/incremental/jawa/JawaBuilder.scala | Scala | epl-1.0 | 3,336 |
package taczombie.client.util
object RegexHelper {
def checkPort(input: String): Boolean = {
val portPatternNumber = """^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$""".r
if (portPatternNumber.findFirstIn(input) != None) {
return true
} else {
return fa... | mahieke/TacZombie | gui/src/main/scala/taczombie/client/util/RegexHelper.scala | Scala | gpl-2.0 | 339 |
/*
* 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/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala | Scala | apache-2.0 | 39,483 |
// Copyright (C) 2011-2012 the original author or authors.
// See the LICENCE.txt file distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You ... | scalastyle/scalastyle | src/test/scala/org/scalastyle/scalariform/ClassCheckerTest.scala | Scala | apache-2.0 | 2,902 |
/*
* 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 ... | bowenli86/flink | flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/batch/BatchExecSort.scala | Scala | apache-2.0 | 5,367 |
package com.programmaticallyspeaking.ncd.infra
import com.programmaticallyspeaking.ncd.testing.UnitTest
class TraversableExtensionsTest extends UnitTest {
import TraversableExtensions._
"distinctBy" - {
"ignores irrelevant properties" in {
val list = Seq(Subject("a", 42), Subject("a", 43), Subject("c",... | provegard/ncdbg | src/test/scala/com/programmaticallyspeaking/ncd/infra/TraversableExtensionsTest.scala | Scala | bsd-3-clause | 484 |
package resolver.parser.document
import scala.collection.mutable.HashMap
/**
* Taken from Berkeley's
*/
class BerkeleyPronounSet {
val firstPersonPronouns = Set("i", "me", "myself", "mine", "my", "we", "us", "ourself", "ourselves", "ours", "our");
val secondPersonPronouns = Set("you", "yourself", "yours", "your... | danielryan2430/WordEmbeddingCorefResolver | src/main/scala/resolver/parser/document/BerkeleyPronounSet.scala | Scala | apache-2.0 | 4,326 |
package com.wavesplatform.api.http
case class ApiException(apiError: ApiError) extends Exception(apiError.message)
| wavesplatform/Waves | node/src/main/scala/com/wavesplatform/api/http/ApiException.scala | Scala | mit | 116 |
/* sbt -- Simple Build Tool
* Copyright 2011 Mark Harrah
*/
package sbt
import java.io.File
import java.net.URI
import java.util.Locale
import Project.{ Initialize => _, Setting => _, _ }
import Keys.{ appConfiguration, stateBuildStructure, commands, configuration, historyPath, projectCommand, sessionSettings, shell... | jasonchaffee/sbt | main/src/main/scala/sbt/Project.scala | Scala | bsd-3-clause | 34,859 |
import spray.json._
object Lang extends Enumeration {
type Lang = Value
val scala, java, css, html, md, xml, sql, javascript = Value
implicit object LangFormat extends RootJsonFormat[Lang.Value] {
override def read(json: JsValue): Lang.Value = json match {
case JsString(v) => Lang.withName(v)
ca... | hermanbanken/play-metrics | src/main/scala/Lang.scala | Scala | mit | 483 |
package controllers
import javax.inject._
import models.film.{Film, FilmRepository, Isbn}
import play.api.Logger
import play.api.libs.json._
import play.api.mvc._
import scala.concurrent.{ExecutionContext, Future}
class FilmController @Inject()(filmRepository: FilmRepository)(implicit exec: ExecutionContext) extend... | fagossa/play-reactive-couchbase | app/controllers/FilmController.scala | Scala | mit | 1,460 |
package pl.gosub.akka.online.follow.the.leader
class FollowTheLeaderLogic(val hypotheses: Seq[Double => Double], lossFunction: ((Double, Double) => Double), windowSize: Int) {
private var past: Seq[(Double, Double)] = Seq.empty;
private var pastX = 0.0
def predict(x: Double, y: Double): Double = {
past =... | gosubpl/akka-online | src/main/scala/pl/gosub/akka/online/follow/the/leader/FollowTheLeaderLogic.scala | Scala | apache-2.0 | 720 |
/* ___ ____ ___ __ ___ ___
** / _// __// _ | / / / _ | / _ \\ Scala classfile decoder
** __\\ \\/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2010, LAMP/EPFL
** /____/\\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/
**
*/
package scala.tools.scalap
import scala.collection.mutable._
object Arguments {... | LPTK/intellij-scala | scalap/src/scalap/Arguments.scala | Scala | apache-2.0 | 5,854 |
/**
* Copyright 2014 Dropbox, 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... | mrdomino/djinni | src/source/meta.scala | Scala | apache-2.0 | 2,800 |
/*
* (c) Copyright 2016 Hewlett Packard Enterprise Development LP
*
* 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 b... | hpe-cct/cct-tutorial | src/main/scala/tutorial/libcog/fields/CombiningFields.scala | Scala | apache-2.0 | 2,839 |
trait Super[@specialized(Int) A] {
def superb = 0
}
object Sub extends Super[Int] {
// it is expected that super[Super].superb crashes, since
// specialization does parent class rewiring, and the super
// of Sub becomes Super$mcII$sp and not Super. But I consider
// this normal behavior -- if you want, I can... | yusuke2255/dotty | tests/untried/pos/SI-4012-b.scala | Scala | bsd-3-clause | 577 |
/*
* Copyright 2001-2008 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... | yyuu/scalatest | src/test/scala/org/scalatest/junit/JUnit3SuiteSpec.scala | Scala | apache-2.0 | 6,255 |
package com.datascience.education.tutorial.lecture5
object SineExample extends App {
import Sine._
import breeze.linalg._
import breeze.plot._
sine.print(32)
val f = Figure()
val p = f.subplot(0)
val x = linspace(0.0,2.5*math.Pi, 16)
val out: List[Double] = sine.toListFinite(16)
p+= plot(x, out)... | DS12/scala-class | tutorial/src/main/scala/com/datascience/education/tutorial/lecture5/InterpolationExamples.scala | Scala | cc0-1.0 | 1,426 |
package org.scalaide.debug.internal.launching
import com.sun.jdi.connect.Connector
import org.eclipse.jdt.launching.IVMConnector
import java.util.{Map => JMap}
import org.eclipse.debug.core.ILaunch
import org.scalaide.debug.internal.ScalaDebugPlugin
import com.sun.jdi.connect.Connector.Argument
object SocketConnector... | Kwestor/scala-ide | org.scala-ide.sdt.debug/src/org/scalaide/debug/internal/launching/SocketConnectorScala.scala | Scala | bsd-3-clause | 2,549 |
/*
* ModTruncateTail.scala
* (FScape)
*
* Copyright (c) 2001-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.fscape.modu... | Sciss/FScape-next | modules/src/main/scala/de/sciss/fscape/modules/ModTruncateTail.scala | Scala | agpl-3.0 | 4,829 |
/**
* 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... | sunlibin/incubator-eagle | eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/storm/StormExecutorForAlertWrapper.scala | Scala | apache-2.0 | 1,688 |
package com.github.diegopacheco.scala.akkastreams
object SeqRangeMain extends App {
import akka.stream._
import akka.stream.scaladsl._
import akka.{ NotUsed, Done }
import akka.actor.ActorSystem
import akka.util.ByteString
import scala.concurrent._
import scala.concurrent.duration._
import java.n... | diegopacheco/scala-playground | akkastreams-2.5.7-fun/src/main/scala/com/github/diegopacheco/scala/akkastreams/SeqRangeMain.scala | Scala | unlicense | 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 ... | eyeem/spark-testing-base | src/main/scala/org/apache/spark/streaming/TestManualClock.scala | Scala | apache-2.0 | 2,058 |
package pimpathon.scalaz.std
import org.junit.Test
import scalaz.{NonEmptyList ⇒ NEL, Failure, Success}
import pimpathon.scalaz.std.option._
class OptionTest {
@Test def toSuccessNel(): Unit = calling(_.toSuccessNel("fail")).produces(Success(1), Failure(NEL("fail")))
@Test def toFailureNel(): Unit = calling(_.t... | raymanoz/pimpathon | src/test/scala/pimpathon/scalaz/std/option.scala | Scala | apache-2.0 | 487 |
package com.arcusys.learn.facades
import com.arcusys.learn.models.report._
import com.arcusys.learn.models.report.OverallByPeriodResponse
import com.arcusys.learn.models.report.VerbResponse
import com.arcusys.learn.models.report.StudentMostActiveResponse
import com.arcusys.learn.models.report.OverallByTimeResponse
imp... | ViLPy/Valamis | learn-portlet/src/main/scala/com/arcusys/learn/facades/ReportFacadeContract.scala | Scala | lgpl-3.0 | 1,693 |
class Test {
case class Foo(x: Int, private var y: Int)
}
object Test {
val test = new Test
val x = test.Foo(1, 2)
x match {
case test.Foo(x, y) => println(x); println(y)
}
}
| yusuke2255/dotty | tests/untried/pos/caseaccs.scala | Scala | bsd-3-clause | 190 |
/*
* 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/simple-reactivemongo | src/main/scala/uk/gov/hmrc/mongo/geospatial/Coordinates.scala | Scala | apache-2.0 | 1,193 |
/*
* 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 ... | tophua/spark1.52 | mllib/src/test/scala/org/apache/spark/mllib/fpm/AssociationRulesSuite.scala | Scala | apache-2.0 | 3,500 |
// Copyright 2010 Twitter, Inc.
//
// Encapsulate communication to a single RPC endpoint.
//
// The "client" is the abstract endpoint, a "connection" is a concrete
// connection to said client.
package com.twitter.rpcclient
import scala.reflect.Manifest
import java.util.concurrent.atomic.AtomicInteger
import org.ap... | kmonkeyjam/rpc-client | src/main/scala/com/twitter/rpcclient/Client.scala | Scala | apache-2.0 | 6,311 |
package com.aluxian.tweeather.transformers
import java.text.SimpleDateFormat
import java.util.{Calendar, Date, Locale}
import com.aluxian.tweeather.RichDate
import com.aluxian.tweeather.models.{Coordinates, LocationBox}
import com.aluxian.tweeather.utils.LocationBoxParam
import org.apache.spark.ml.UnaryTransformer
im... | Aluxian/Tweeather | src/main/scala/com/aluxian/tweeather/transformers/GribUrlGenerator.scala | Scala | apache-2.0 | 2,674 |
package com.aurelpaulovic.transaction.config
case class Retries (val maxRetries: Int) extends TransactionConfigProperty {
} | AurelPaulovic/transactions-api | src/main/scala/com/aurelpaulovic/transaction/config/Retries.scala | Scala | apache-2.0 | 125 |
package net.rrm.ehour.persistence.backup.dao
import java.util
trait BackupDao {
def findAll(table: String): util.List[util.Map[String, Object]]
}
| momogentoo/ehour | eHour-persistence/src/main/scala/net/rrm/ehour/persistence/backup/dao/BackupDao.scala | Scala | gpl-2.0 | 152 |
package spatutorial.client.services
import autowire._
import rx._
import spatutorial.client.ukko._
import spatutorial.shared.{TodoItem, Api, _}
import boopickle.Default._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
import scala.scalajs.js
case object RefreshTodos
case class UpdateAllTodos(tod... | MikaelMayer/scalajs-spa-tutorial | client/src/main/scala/spatutorial/client/services/TodoStore.scala | Scala | apache-2.0 | 1,952 |
package controllers
import master.Mastermind
import play.api.Logger
import play.api.libs.json.Json
import play.api.mvc._
object MastermindController extends Controller {
def addWorker(ip: String) = Action {
val worker = Mastermind.registerWorker(ip)
Logger.info(s"$ip registered as worker ${worker.id}.")
... | rtfpessoa/distributed-twitter-crawler | app/controllers/MastermindController.scala | Scala | mit | 861 |
import scala.language.strictEquality
/**
* Multiversal Equality: http://dotty.epfl.ch/docs/reference/multiversal-equality.html
* scala.Eq definition: https://github.com/lampepfl/dotty/blob/master/library/src/scala/Eq.scala
*/
object MultiversalEquality {
def test: Unit = {
// Values of types Int and Stri... | smarter/dotty-example-project | src/main/scala/MultiversalEquality.scala | Scala | bsd-3-clause | 1,128 |
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.