code stringlengths 5 1M | repo_name stringlengths 5 109 | path stringlengths 6 208 | language stringclasses 1
value | license stringclasses 15
values | size int64 5 1M |
|---|---|---|---|---|---|
/*
* Copyright 2015 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 applicab... | arkadius/scala-phases-chain | src/main/scala/phase/ProgressActor.scala | Scala | apache-2.0 | 2,726 |
package mesosphere.marathon.tasks
import mesosphere.marathon.core.base.ConstantClock
import mesosphere.marathon.core.launcher.impl.TaskOpFactoryImpl
import mesosphere.marathon.core.launcher.{ TaskOp, TaskOpFactory }
import mesosphere.marathon.core.task.{ Task, TaskStateOp }
import mesosphere.marathon.core.task.Task.Lo... | timcharper/marathon | src/test/scala/mesosphere/marathon/tasks/TaskOpFactoryImplTest.scala | Scala | apache-2.0 | 8,000 |
package com.mycompany.scalcium.wordnet
import java.io.File
import org.junit.Assert
import org.junit.Test
import net.didion.jwnl.data.POS
class WordnetTest {
val wn = new Wordnet(new File("src/main/resources/wnconfig.xml"))
/**
* >>> from nltk.corpus import wordnet as wn
* >>> wn.synsets('motorcar')
* [... | sujitpal/scalcium | src/test/scala/com/mycompany/scalcium/wordnet/WordnetTest.scala | Scala | apache-2.0 | 24,277 |
package vggames.scala.specs.string
import vggames.scala.specs.GameSpecification
import vggames.scala.code.RestrictedFunction1
import vggames.scala.specs.TestRun
class ReplaceString extends GameSpecification[RestrictedFunction1[String, String]] {
def runSignature = "(a:String):String"
def extendsType = "Restrict... | vidageek/games | games/scala/src/main/scala/vggames/scala/specs/string/ReplaceString.scala | Scala | gpl-3.0 | 767 |
package edu.rit.csh.linter
import _root_.fastparse.core.Parsed.{Failure, Success}
import _root_.fastparse.core.{ParseError, Parser}
import edu.rit.csh.scalaLint.parser.{ScalaParser, ScalaLexer}
import org.antlr.v4.runtime.ANTLRInputStream
import org.antlr.v4.runtime.CommonTokenStream
import org.scalatest.FunSuite
imp... | JDrit/ScalaLint | src/test/scala/edu/rit/csh/linter/TestUtils.scala | Scala | apache-2.0 | 1,475 |
package org.scalaide.ui.internal.editor.decorators.semantichighlighting
import org.eclipse.core.runtime.jobs.Job
import org.eclipse.jface.text.IRegion
import org.eclipse.jface.text.source.ISourceViewer
import org.scalaide.core.internal.decorators.semantichighlighting.PositionsTracker
/** This interface expose the min... | andrey-ilinykh/scala-ide | org.scala-ide.sdt.core/src/org/scalaide/ui/internal/editor/decorators/semantichighlighting/TextPresentationHighlighter.scala | Scala | bsd-3-clause | 887 |
/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager
import kafka.manager.ActorModel.BrokerInfo
/**
* @author hiral
*/
case class BrokerIdentity(id: String, host: String, port: Int)
object BrokerIdentity {
import play.api.lib... | wking1986/kafka-manager | app/kafka/manager/BrokerIdentity.scala | Scala | apache-2.0 | 520 |
package com.oct.sclaav
import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
import org.slf4j.LoggerFactory
class MainTest extends FunSuite with BeforeAndAfter with Matchers with TestHelpers {
val log = LoggerFactory.getLogger(getClass)
}
| ogeagla/sclaav | src/test/scala/com/oct/sclaav/MainTest.scala | Scala | apache-2.0 | 249 |
package test
import org.specs2.mutable.Specification
class AvroRecordUserDefinedTypesTest extends Specification {
"A case class with another record as a field" should {
"serialize and deserialize correctly" in {
val record1 = AvroRecordTest58(AvroRecordTest00(1))
val record2 = AvroRecordTest58(Avro... | julianpeeters/avro-scala-macro-annotations | tests/src/test/scala/AvroRecordTests/datatypetests/AvroRecordUserDefinedTypesTest.scala | Scala | apache-2.0 | 5,531 |
object Test {
def main(args: Array[String]): Unit = {
try {
println("0")
val f = new Foo
println("1")
println(f.foo)
} catch {
case e: NotImplementedError => println("???")
}
assert(!classOf[Foo].getDeclaredFields.exists(_.getName.startsWith("foo")), "field foo not eras... | som-snytt/dotty | tests/run/nothing-val.scala | Scala | apache-2.0 | 402 |
package provingground
// import scala.swing._
import java.awt.Dimension
import akka.actor._
import provingground.TextToInt._
object AckGUI /*extends SimpleSwingApplication*/ {
/*
val s = new Dimension(1500, 1500)
object Ack{
val posInts: Stream[Int] = Stream.from(0)
def ack(m: BigInt, n: BigInt): BigInt ... | siddhartha-gadgil/ProvingGround | digressions/src/main/scala/provingground/codeexperiments/AckGUI.scala | Scala | mit | 1,720 |
/*
* Copyright (C) 2011 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is di... | ISCPIF/PSEExperiments | openmole-src/openmole/plugins/org.openmole.plugin.hook.display/src/main/scala/org/openmole/plugin/hook/display/DisplayHook.scala | Scala | agpl-3.0 | 1,338 |
package app.restlike.common
case class CliCommand(value: String)
| alltonp/reprobate | src/main/scala/app/restlike/common/CliCommand.scala | Scala | apache-2.0 | 66 |
package uk.co.morleydev.zander.client.test.unit
import org.scalatest.Tag
object UnitTag extends Tag("uk.co.morleydev.zander.client.test.unit.UnitTag")
| MorleyDev/zander.client | src/test/scala/uk/co/morleydev/zander/client/test/unit/UnitTag.scala | Scala | mit | 153 |
/*
* Copyright 2015 LG CNS.
*
* 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... | jahnaviancha/scouter | scouter.server/src/scouter/server/db/xlog/XLogProfileDataReader.scala | Scala | apache-2.0 | 3,281 |
/*
* 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 ... | HuaweiBigData/carbondata | integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/package.scala | Scala | apache-2.0 | 1,814 |
package com.sksamuel.scapegoat.inspections.unnecessary
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.unneccesary.UnnecessaryConversion
/** @author Stephen Samuel */
class UnnecessaryConversionTest extends InspectionTest {
override val inspections = Seq(new UnnecessaryConver... | sksamuel/scalac-scapegoat-plugin | src/test/scala/com/sksamuel/scapegoat/inspections/unnecessary/UnnecessaryConversionTest.scala | Scala | apache-2.0 | 4,819 |
package org.hammerlab.guacamole.strings
trait TruncatedToString {
override def toString: String = truncatedString(Int.MaxValue)
/** String representation, truncated to maxLength characters. */
def truncatedString(maxLength: Int = 500): String =
TruncatedToString(stringPieces, maxLength)
/**
* Iterator... | hammerlab/guacamole | src/main/scala/org/hammerlab/guacamole/strings/TruncatedToString.scala | Scala | apache-2.0 | 1,269 |
// Databricks notebook source exported at Sun, 28 Aug 2016 15:52:30 UTC
// MAGIC %md
// MAGIC
// MAGIC # [Big Data Analysis for Humanities and Social Sciences](https://www.eventbrite.co.uk/e/big-data-analysis-for-the-humanities-and-social-sciences-tickets-26708754604)
// MAGIC
// MAGIC ### August 26, 2016, King's Dig... | lamastex/scalable-data-science | db/20160826_KDL_Intro2BDA_HumSocSci/03_WordCount/005_WordCount.scala | Scala | unlicense | 21,202 |
package org.knora.webapi.store.triplestore
import akka.actor.Props
import akka.testkit.ImplicitSender
import com.typesafe.config.ConfigFactory
import org.knora.webapi.messages.v1.store.triplestoremessages.{RdfDataObject, ResetTriplestoreContent, ResetTriplestoreContentACK, SparqlUpdateRequest}
import org.knora.webapi.... | nie-ine/Knora | webapi/src/test/scala/org/knora/webapi/store/triplestore/GraphDBConsistencyCheckingSpec.scala | Scala | agpl-3.0 | 105,485 |
/*
* Copyright (c) 2014-2015 by its authors. Some rights reserved.
* See the project homepage at: http://www.monifu.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://... | virtualirfan/monifu | monifu/jvm/src/test/scala/monifu/reactive/observers/BufferDropNewConcurrencySuite.scala | Scala | apache-2.0 | 10,512 |
/*
* 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... | lhfei/spark-in-action | spark-2.x/src/main/scala/org/apache/spark/examples/streaming/DirectKafkaWordCount.scala | Scala | apache-2.0 | 3,333 |
/*
* Copyright 2019 Google LLC All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... | CloudVLab/professional-services | tools/bigquery-zos-mainframe-connector/src/main/scala/com/google/cloud/bqsh/QueryConfig.scala | Scala | apache-2.0 | 1,846 |
package org.jetbrains.plugins.scala
package lang
package parser
package parsing
package top.params
import com.intellij.lang.PsiBuilder
import builder.ScalaPsiBuilder
/**
* @author Alexander Podkhalyuzin
* Date: 08.02.2008
*/
/*
* ClassParamClauses ::= {ClassParamClause}
* [[nl] '(' 'implicit'... | consulo/consulo-scala | src/org/jetbrains/plugins/scala/lang/parser/parsing/top/params/ClassParamClauses.scala | Scala | apache-2.0 | 637 |
package org.littlewings.tweetbot.application.lilymyu.lyrics.service
import org.junit.Test
import org.littlewings.tweetbot.test.JaxrsServerTestSupport
class LilymyuLyricsTweetServiceITests extends JaxrsServerTestSupport {
@Test
def tweet(): Unit =
withServer { _ =>
injectedBean(classOf[LilymyuLyricsTweet... | kazuhira-r/tweet-bot | src/integration-test/scala/org/littlewings/tweetbot/application/lilymyu/lyrics/service/LilymyuLyricsTweetServiceITests.scala | Scala | mit | 354 |
package org.faker
import org.scalatest.{FlatSpec, Matchers}
class PhoneNumberSpec extends FlatSpec with Matchers with FakerBehaviors {
"phoneNumber" should behave like validResult(PhoneNumber.phoneNumber)
"cellPhone" should behave like validResult(PhoneNumber.cellPhone)
}
| ralli/faker_scala | src/test/scala/org/faker/PhoneNumberSpec.scala | Scala | bsd-3-clause | 281 |
package org.infinispan.spark.suites
import org.apache.spark.SparkConf
import org.infinispan.client.hotrod.{RemoteCache, Search}
import org.infinispan.spark.config.ConnectorConfiguration
import org.infinispan.spark.domain._
import org.infinispan.spark.rdd.InfinispanRDD
import org.infinispan.spark.test._
import org.scal... | galderz/infinispan-spark | src/test/scala/org/infinispan/spark/suites/FilterByQueryProtoSuite.scala | Scala | apache-2.0 | 2,569 |
/*
* This file is part of the "silex" library of helpers for Apache Spark.
*
* Copyright (c) 2016 Red Hat, 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.ap... | erikerlandson/silex | src/main/scala/com/redhat/et/silex/sample/split.scala | Scala | apache-2.0 | 4,738 |
/**
* Copyright (C) 2009-2011 the original author or authors.
* See the notice.md 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.
* Yo... | dnatic09/scalate | scalate-jsp-converter/src/test/scala/org/fusesource/scalate/converter/ConvertJspTest.scala | Scala | apache-2.0 | 4,135 |
/*
* Copyright 2010 LinkedIn
*
* 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... | jinfei21/kafka | src/kafka/consumer/ConsumerConfig.scala | Scala | apache-2.0 | 3,127 |
/*
* Test.scala
* Test runner for com.cra.figaro.test.algorithm.
*
* Created By: Avi Pfeffer (apfeffer@cra.com)
* Creation Date: Jan 1, 2009
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for information.
*
* See http://www.gith... | agarbuno/figaro | Figaro/src/test/scala/com/cra/figaro/test/algorithm/Test.scala | Scala | bsd-3-clause | 653 |
package sparklyr
import java.io.{ByteArrayOutputStream, OutputStream}
import java.nio.channels.Channels
import scala.collection.JavaConverters._
import org.apache.arrow.vector._
import org.apache.arrow.vector.ipc.ArrowStreamReader
import org.apache.arrow.vector.ipc.message.MessageSerializer
import org.apache.arrow.v... | rstudio/sparklyr | java/spark-3.0.0/arrowconverters.scala | Scala | apache-2.0 | 9,606 |
/**
* Intel Intrinsics for Lightweight Modular Staging Framework
* https://github.com/ivtoskov/lms-intrinsics
* Department of Computer Science, ETH Zurich, Switzerland
* __ _ __ _ _
* / /____ ___ _____ (_)____ / /_ _____ (_)____ __... | ivtoskov/lms-intrinsics | src/main/scala/ch/ethz/acl/intrinsics/SSE200.scala | Scala | apache-2.0 | 181,634 |
/*
* 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 ... | goldmedal/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVFilters.scala | Scala | apache-2.0 | 8,252 |
package org.jetbrains.plugins.scala.testingSupport.test
import com.intellij.codeInsight.TestFrameworks
import com.intellij.execution.TestStateStorage
import com.intellij.execution.lineMarker.{ExecutorAction, RunLineMarkerContributor}
import com.intellij.execution.testframework.TestIconMapper
import com.intellij.icons.... | jastice/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/testingSupport/test/ScalaTestRunLineMarkerProvider.scala | Scala | apache-2.0 | 4,082 |
/*
* 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... | chenc10/Spark-PAF | sql/core/src/main/scala/org/apache/spark/sql/execution/local/SeqScanNode.scala | Scala | apache-2.0 | 1,607 |
/*
* Copyright (c) 2011 Sony Pictures Imageworks Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, thi... | imageworks/scala-migrations | src/test/scala/com/imageworks/migration/tests/alter_column/Migrate_20110214060042_AlterColumn.scala | Scala | bsd-3-clause | 2,003 |
package io.eels.component.avro
import org.apache.avro.{Schema, SchemaBuilder}
import org.scalatest.{Matchers, WordSpec}
class ConverterTest extends WordSpec with Matchers {
"Converter" should {
"convert to long" in {
AvroSerializer(SchemaBuilder.builder().longType()).serialize("123") shouldBe 123l
... | stheppi/eel | eel-components/src/test/scala/io/eels/component/avro/ConverterTest.scala | Scala | apache-2.0 | 1,431 |
// Databricks notebook source
// MAGIC %md
// MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html)
// COMMAND ----------
// MAGIC %md
// MAGIC # [The Alternating Least Squares method (ALS)]()
// COMMAND ----------
// M... | lamastex/scalable-data-science | dbcArchives/2021/000_0-sds-3-x-projects/student-project-18_group-ProjectRL/01_The_ALS_method.scala | Scala | unlicense | 18,206 |
package com.adlawson.json4s
import org.json4s._
/**
* Serialize scala Types and Type Aliases
*
* A is the Type Alias
* B is a constructor type for the type alias
*
* The constructor type is needed only during the [de]serialization stages
* and isn't exposed in any other way.
*
* Example:
* ```
* import c... | adlawson/scala-json4s | src/main/scala/TypeSerializer.scala | Scala | mit | 1,583 |
package com.haskforce.tooling.ghcPkg
final class CachedPkgs(
val toMap: Map[String, CachedPkgs.Versions]
) extends AnyVal {
def named(name: String): Option[CachedPkgs.Versions] = toMap.get(name)
def add(pkg: Pkg): CachedPkgs = {
new CachedPkgs(
toMap.updated(
pkg.name,
toMap.getOrElse... | carymrobbins/intellij-haskforce | src/com/haskforce/tooling/ghcPkg/CachedPkgs.scala | Scala | apache-2.0 | 944 |
package com.twitter.gizzard.nameserver
import org.specs.mock.{ClassMocker, JMocker}
import com.twitter.conversions.time._
import com.twitter.gizzard.thrift.{JobInjectorService, TThreadServer, JobInjector}
import com.twitter.gizzard.ConfiguredSpecification
object JobRelaySpec extends ConfiguredSpecification {
val r... | kmiku7/gizzard | src/test/scala/com/twitter/gizzard/nameserver/JobRelaySpec.scala | Scala | apache-2.0 | 3,133 |
// Copyright: 2010 - 2016 https://github.com/ensime/ensime-server/graphs
// Licence: http://www.gnu.org/licenses/gpl-3.0.en.html
package org.ensime.sexp.formats
import BigIntConvertor._
import org.scalacheck.{ Arbitrary, Gen }
import org.scalatest._
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import scala.... | j-mckitrick/ensime-sbt | src/sbt-test/ensime-sbt/ensime-server/s-express/src/test/scala/org/ensime/sexp/formats/BigIntConvertorSpec.scala | Scala | apache-2.0 | 1,805 |
package dregex
import org.scalatest.funsuite.AnyFunSuite
class EmbeddedFlagTest extends AnyFunSuite {
test("embedded flags") {
// OK
Regex.compile("(?x)a")
// flags in the middle
intercept[InvalidRegexException] {
Regex.compile(" (?x)a")
}
intercept[InvalidRegexException] {
Reg... | marianobarrios/dregex | src/test/scala/dregex/EmbeddedFlagTest.scala | Scala | bsd-2-clause | 452 |
package ch.epfl.bluebrain.nexus.iam.client
import akka.actor.ActorSystem
import akka.http.scaladsl.client.RequestBuilding._
import akka.http.scaladsl.model.Uri.Query
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.OAuth2BearerToken
import akka.http.scaladsl.unmarshalling.FromEntityUnmarshalle... | hygt/nexus-iam | client/src/main/scala/ch/epfl/bluebrain/nexus/iam/client/IamClient.scala | Scala | apache-2.0 | 10,660 |
import java.lang.RuntimeException
import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
import org.apache.spark.sql.hive.HiveContext
import scala.sys.process._
import scalax.file.{Path}
import scalax.io.StandardOpenOption._
import scopt.OptionParser
import org.apache.hadoop.io._
import org.apache.spar... | nlesc-sherlock/spark-docker | caffeseq/src/main/scala/CaffeAppSeq.scala | Scala | apache-2.0 | 2,379 |
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright 2016-2020 Daniel Urban and contributors listed in NOTICE.txt
*
* 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.ap... | durban/exp-reagents | bench/src/main/scala/dev/tauri/choam/kcas/BenchmarkAccess.scala | Scala | apache-2.0 | 876 |
package com.caibowen.prma.logger.logback
import ch.qos.logback.classic.spi.{ILoggingEvent, IThrowableProxy, StackTraceElementProxy}
import com.caibowen.prma.api.model.ExceptionVO
import com.caibowen.prma.core.filter.StrFilter
import scala.collection.immutable.{Vector, List}
import scala.collection.mutable.ArrayBuffer... | xkommando/PRMA | logger/src/main/scala/com/caibowen/prma/logger/logback/FilteredAdaptor.scala | Scala | lgpl-3.0 | 1,743 |
package jgo.tools.compiler
package transl
package func
import interm._
import instr._
trait Returns extends FuncTranslBase {
protected override def translateInstr(i: Instr): Unit = i match {
case Return => gen.returnValue() //hopefully, this works.
case ValueReturn => gen.returnValue()
case _ ... | thomasmodeneis/jgo | src/src/main/scala/jgo/tools/compiler/transl/func/Returns.scala | Scala | gpl-3.0 | 352 |
package net.sansa_stack.rdf.spark.io
import java.net.URI
import scala.reflect.ClassTag
import com.google.common.base.Predicates
import com.google.common.collect.Iterators
import net.sansa_stack.rdf.benchmark.io.ReadableByteChannelFromIterator
import net.sansa_stack.rdf.common.io.riot.lang.LangNTriplesSkipBad
import ... | SANSA-Stack/Spark-RDF | sansa-rdf-spark/src/main/scala/net/sansa_stack/rdf/spark/io/NTripleReader.scala | Scala | gpl-3.0 | 9,746 |
package com.productfoundry.akka.cqrs.process
import akka.actor.ActorRef
import com.productfoundry.akka.cqrs._
import com.productfoundry.akka.cqrs.publish.EventPublication
import com.productfoundry.akka.messaging.ConfirmDelivery
import com.productfoundry.support.EntityTestSupport
import org.scalatest.prop.GeneratorDriv... | Product-Foundry/akka-cqrs | core/src/test/scala/com/productfoundry/akka/cqrs/process/ProcessManagerSpec.scala | Scala | apache-2.0 | 2,818 |
package com.dt.scala.implicits
/**
* @author Wang Jialin
* Date 2015/7/19
* Contact Information:
* WeChat: 18610086859
* QQ: 1740415547
* Email: 18610086859@126.com
* Tel: 18610086859
*/
object Implicit_Conversions_with_Implicit_Parameters {
def main(args: Array[String]) {
def bigger[T](a: ... | slieer/scala-tutorials | src/main/scala/com/dt/scala/implicits/Implicit_Conversions_with_Implicit_Parameters.scala | Scala | apache-2.0 | 494 |
def flatMap[A,B](f: Rand[A])(g: A => Rand[B]): Rand[B] =
rng => {
val (a, r1) = f(rng)
g(a)(r1) // We pass the new state along
}
def nonNegativeLessThan(n: Int): Rand[Int] = {
flatMap(nonNegativeInt) { i =>
val mod = i % n
if (i + (n-1) - mod >= 0) unit(mod) else nonNegativeLessThan(n)
}
}
| ud3sh/coursework | functional-programming-in-scala-textbook/answerkey/state/08.answer.scala | Scala | unlicense | 316 |
package pureconfig
import com.typesafe.config.{ConfigFactory, ConfigValueFactory, ConfigValueType}
import shapeless.test.illTyped
import pureconfig.error.WrongType
import pureconfig.generic.error.NoValidCoproductOptionFound
import pureconfig.generic.semiauto._
class EnumerationsSuite extends BaseSuite {
sealed tr... | pureconfig/pureconfig | modules/generic/src/test/scala/pureconfig/EnumerationsSuite.scala | Scala | mpl-2.0 | 4,297 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | sh-cho/cshSpark | network/netty/NettyBlockTransferService.scala | Scala | apache-2.0 | 6,466 |
/**
* Copyright (c) 2002-2012 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j 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 Foundati... | dksaputra/community | cypher/src/main/scala/org/neo4j/cypher/internal/executionplan/builders/ColumnFilterBuilder.scala | Scala | gpl-3.0 | 2,598 |
package chess
import language.implicitConversions
object Rank {
def figureRank(figure: Figure) = figure.figureType match {
case Queen => 900
case Rook => 450
case Knight | Bishop => 300
case Pawn => 100
case _ => 0
}
def fieldRank(field: Field) = {
def colRowRank(cr: Int) = if (cr>=5) ... | grzegorzbalcerek/scala-book-examples | examples/Rank.scala | Scala | mit | 1,144 |
package tokens
import org.scalatest.{FreeSpec, MustMatchers}
class TokenGeneratorSpec extends FreeSpec with MustMatchers {
"TokenGenerator" - {
s"generates strings of one size" in new Fixture {
tokenGenerator.nextTokenFor(smith).value.length mustBe tokenSize
tokenGenerator.nextTokenFor(smith).value... | jawp/testinator | src/test/scala/tokens/TokenGeneratorSpec.scala | Scala | mit | 642 |
/***********************************************************************
* 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-utils/src/main/scala/org/locationtech/geomesa/utils/text/BasicParser.scala | Scala | apache-2.0 | 1,838 |
/*
* GitAllSpark.scala - Analyze all Git commits in parallel on a cluster.
*/
package se_hpc
import org.apache.spark.SparkContext
import ammonite.ops._
import ammonite.ops.ImplicitWd._
import java.net._
import java.io._
import org.json4s.JsonDSL._
import scala.util._
object GitAllSparkScala {
def main(args: Ar... | gkthiruvathukal/git-all-spark-scala | src/main/scala/GitAllSpark.scala | Scala | agpl-3.0 | 17,037 |
package tifmo
import dcstree.Executor
import dcstree.SemRole
import dcstree.Relation
import scala.collection.mutable
package inference {
import Finder._
import RulesQuick._
import RulesLight._
/**
* The core of inference engine.
*
* This class implements the forward chaining algorithm, provides the
... | tianran/tifmo | src/tifmo/inference/IEngineCore.scala | Scala | bsd-2-clause | 25,620 |
/*
* 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... | Chasego/kafka | core/src/test/scala/integration/kafka/server/RaftClusterTest.scala | Scala | apache-2.0 | 7,730 |
/*
* Copyright 2019 Spotify AB.
*
* 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 ... | regadas/scio | scio-core/src/main/scala/com/spotify/scio/VersionUtil.scala | Scala | apache-2.0 | 5,563 |
package com.seanshubin.todo.persistence.domain
import org.scalatest.FunSuite
import scala.collection.mutable.ArrayBuffer
/*
test-driven-014
Dispatch logic can be generic
*/
class DispatcherTest extends FunSuite {
test("unknown request") {
//given
val handlersBySubject = Map[String, RequestValueHandler](... | SeanShubin/todo-persistence | domain/src/test/scala/com/seanshubin/todo/persistence/domain/DispatcherTest.scala | Scala | unlicense | 2,256 |
/*
* 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-modeling/src/main/scala/io/truthencode/ddo/model/effect/DamageReduction.scala | Scala | apache-2.0 | 3,650 |
/***********************************************************************
* Copyright (c) 2013-2015 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 ... | vpipkt/geomesa | geomesa-accumulo/geomesa-accumulo-datastore/src/main/scala/org/locationtech/geomesa/accumulo/iterators/DeDuplicatingIterator.scala | Scala | apache-2.0 | 1,557 |
///////////////////////////////////////////////////////////////////////////////
// numeric.scala
//
// Copyright (C) 2011-2014 Ben Wing, The University of Texas at Austin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You... | utcompling/textgrounder | src/main/scala/opennlp/textgrounder/util/numeric.scala | Scala | apache-2.0 | 7,648 |
package com.scalaAsm.x86
package Instructions
package x87
// Description: Subtract
// Category: general/arith
trait FSUB extends InstructionDefinition {
val mnemonic = "FSUB"
}
object FSUB extends OneOperand[FSUB] with FSUBImpl
trait FSUBImpl extends FSUB {
implicit object _0 extends OneOp[m32] {
val opcode... | bdwashbu/scala-x86-inst | src/main/scala/com/scalaAsm/x86/Instructions/x87/FSUB.scala | Scala | apache-2.0 | 573 |
package regolic
package dpllt
import sat.Solver.Results._
import sat.FixedIntStack
import sat.FixedIntDoublePriorityQueue
import sat.Vector
import util.{HasLogger, Logger}
/*
* TODO: what should we do with multiple copy of the same literal with different id ?
* Can break communication with theory solver with... | regb/scabolic | src/main/scala/regolic/dpllt/DPLLSolver.scala | Scala | mit | 33,435 |
package im.actor.server.persist.push
import scala.concurrent.ExecutionContext
import slick.driver.PostgresDriver.api._
import im.actor.server.models
class GooglePushCredentialsTable(tag: Tag) extends Table[models.push.GooglePushCredentials](tag, "google_push_credentials") {
def authId = column[Long]("auth_id", O.... | chenbk85/actor-platform | actor-server/actor-persist/src/main/scala/im/actor/server/persist/push/GooglePushCredentials.scala | Scala | mit | 1,399 |
package service
import java.io.File
import base.TestBaseDefinition
import org.apache.commons.io.FileUtils
import org.apache.poi.ss.usermodel.IndexedColors
import org.joda.time.LocalDate
import org.scalatest.WordSpec
import service.sheet._
class SheetServiceSpec extends WordSpec with TestBaseDefinition {
"A SheetS... | THK-ADV/lwm-reloaded | test/service/SheetServiceSpec.scala | Scala | mit | 1,537 |
package com.boldradius.astrolabe.client.domain
import com.boldradius.astrolabe.client.d3.Layout.GraphLink
import scala.scalajs.js
trait ClusterGraphLink extends GraphLink {
var sourceHost: String = js.native
var targetHost: String = js.native
}
trait ClusterGraphRoleLink extends ClusterGraphLink {
var index: ... | boldradius/cluster-console | js/src/main/scala/com/boldradius/astrolabe/client/domain/ClusterGraphLink.scala | Scala | bsd-3-clause | 338 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | shaoxuan-wang/flink | flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/util/RelShuttles.scala | Scala | apache-2.0 | 7,201 |
package viewModel
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import com.thetestpeople.trt.model._
import com.thetestpeople.trt.utils.DateUtils
abstract class AbstractExecutionView(execution: AbstractExecution) {
def id: Id[_]
def executionTime: TimeDescription = TimeDescription(ex... | thetestpeople/trt | app/viewModel/AbstractExecutionView.scala | Scala | mit | 769 |
/*
* 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
* distrib... | fusepoolP3/p3-silk | silk-workspace/src/main/scala/de/fuberlin/wiwiss/silk/workspace/Project.scala | Scala | apache-2.0 | 1,714 |
package scalan.compilation.language
import java.io.File
import java.lang.reflect.Method
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.reflect.ClassTag
import scalan.util.ReflectionUtil
trait Adjustment {
def apply[A](x: A) = Adjusted(x, Some(this))
}
/** Converts a functi... | PCMNN/scalan-ce | core/src/main/scala/scalan/compilation/language/MethodMappingDSL.scala | Scala | apache-2.0 | 12,546 |
package spark.broadcast
import java.io._
import java.net._
import java.util.{Comparator, PriorityQueue, Random, UUID}
import scala.collection.mutable.{Map, Set}
import scala.math
import spark._
class ChainedBroadcast[T](@transient var value_ : T, isLocal: Boolean)
extends Broadcast[T] with Logging with Serializable... | jperla/spark-advancers | core/src/main/scala/spark/broadcast/ChainedBroadcast.scala | Scala | bsd-3-clause | 25,949 |
/*
* Copyright 2006-2011 WorldWide Conferencing, LLC
*
* 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... | lzpfmh/framework-2 | core/util/src/main/scala/net/liftweb/util/ClassHelpers.scala | Scala | apache-2.0 | 15,496 |
package org.hello.foo
import org.hello.bar._
import scala.util.Random
import scala.io.Source
class Simple(step:Int) {
private val _step:Int = step
def timeStep: Long = this._step * Bar.showTiming
def showStep: Int = this._step
}
object Foo {
private val Limit = 10
def main(args:Array[String])... | sadikovi/sbt-multi-project-example | foo/src/main/scala/Foo.scala | Scala | mit | 916 |
import scala.language.dynamics
class Foo extends scala.Dynamic {
def applytDynamicNamed(name: String)(args: Any*): String = ???
}
object DynamicTest {
implicit class Bar(foo: Foo) {
def bazApply: Int = ???
}
def baz: String = new Foo().bazApply(a = "") // error
}
| lampepfl/dotty | tests/neg/dynamicDynamicImplicitsTest3.scala | Scala | apache-2.0 | 279 |
package com.github.otsoaunloco
import java.awt.BorderLayout
import javax.swing.JPanel
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent
import uk.co.caprica.vlcj.discovery.NativeDiscovery
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.swing._
impo... | otsoaUnLoco/WolfPlayer | src/main/scala/Gui.scala | Scala | gpl-3.0 | 8,779 |
package dotty.tools.languageserver.util.actions
import dotty.tools.languageserver.util.embedded.CodeMarker
import dotty.tools.languageserver.util.{CodeRange, PositionContext}
import org.junit.Assert.{assertEquals, assertNull, assertTrue}
import scala.collection.JavaConverters._
/**
* An action requesting for the i... | lampepfl/dotty | language-server/test/dotty/tools/languageserver/util/actions/CodeHover.scala | Scala | apache-2.0 | 1,251 |
package org.biosys.pubmed.models
object Authors {
def fromXml(doc: xml.Node):Author = {
Author(
lastname = (doc \\ "LastName").text,
initials = (doc \\ "Initials").text,
affiliation = (doc \\ "AffiliationInfo" \\ "Affiliation").map(_.text).toList
)
}
}
case class Author(lastname:String,... | sdor/biosys | pubmed_common/src/main/scala/org/biosys/pubmed/models/Author.scala | Scala | gpl-2.0 | 359 |
/*
* A real-time collaborative tool to develop files over the network.
* Copyright (C) 2010 Mauro Ciancio and Leandro Gilioli
* {maurociancio,legilioli} at gmail dot com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Publi... | maurociancio/parallel-editor | src/parallel-editor-kernel/src/main/scala/ar/noxit/paralleleditor/kernel/messages/ClientKernelMessages.scala | Scala | gpl-3.0 | 3,819 |
package com.dominikgruber.fpinscala.chapter06
import org.scalatest._
class Exercise05Spec extends FlatSpec with Matchers {
"double2" should "generate a double" in {
Chapter06.double2(Simple(-10000000))._1 should be (0.3733188882470131)
}
} | TheDom/functional-programming-in-scala | src/test/scala/com/dominikgruber/fpinscala/chapter06/Exercise05Spec.scala | Scala | mit | 250 |
/*
* 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 ... | csantanapr/incubator-openwhisk | common/scala/src/main/scala/org/apache/openwhisk/core/connector/Message.scala | Scala | apache-2.0 | 10,043 |
package io.straight.ete.config
import javax.sql.DataSource
import java.io.{InputStream, File}
/**
* @author rbuckland
*/
abstract class SourceDataConfig(val dataSetId:String)
// --------------
// JDBC type DataSources
// --------------
abstract class JdbcSourceData(
override val dataSet... | rbuckland/ete | ete-extractor/src/main/scala/io/straight/ete/config/SourceDataConfig.scala | Scala | apache-2.0 | 4,151 |
package domala.internal.reflect.util
import domala.internal.macros.reflect.ReflectAbortException
import domala.jdbc.entity.{EntityCompanion, EntityDesc}
import domala.jdbc.holder.{HolderCompanion, HolderDesc}
import org.seasar.doma.message.MessageResource
import scala.reflect.ClassTag
object ReflectionUtil {
def ... | bakenezumi/domala | core/src/main/scala/domala/internal/reflect/util/ReflectionUtil.scala | Scala | apache-2.0 | 1,964 |
package org.openurp.edu.eams.teach.election
import org.beangle.data.model.Entity
import org.beangle.commons.entity.TimeEntity
import org.beangle.ems.rule.model.RuleConfig
trait ElectPlan extends Entity[Long] with TimeEntity {
def getName(): String
def setName(name: String): Unit
def getDescription(): Stri... | openurp/edu-eams-webapp | election/src/main/scala/org/openurp/edu/eams/teach/election/ElectPlan.scala | Scala | gpl-3.0 | 473 |
/*
* Copyright 2014 porter <https://github.com/eikek/porter>
*
* 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... | eikek/porter | openid/src/main/scala/porter/app/openid/routes/AvatarRoute.scala | Scala | apache-2.0 | 1,850 |
package org.jetbrains.plugins.scala
package codeInsight
package intention
package argument
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.... | JetBrains/intellij-scala | scala/codeInsight/src/org/jetbrains/plugins/scala/codeInsight/intention/argument/AddNameToArgumentIntention.scala | Scala | apache-2.0 | 1,051 |
/*
* 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 ... | ueshin/apache-spark | sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/costing.scala | Scala | apache-2.0 | 2,075 |
package scala.meta.internal.semanticdb.scalac
import scala.{meta => m}
trait ParseOps { self: SemanticdbOps =>
implicit class XtensionCompilationUnitSource(unit: g.CompilationUnit) {
def toSource: m.Source = {
val dialect =
m.Dialect.standards.getOrElse(language, sys.error(s"unsupported dialect $... | olafurpg/scalameta | semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/ParseOps.scala | Scala | bsd-3-clause | 399 |
/*
* 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 ... | rezasafi/spark | streaming/src/main/scala/org/apache/spark/streaming/scheduler/ReceiverTracker.scala | Scala | apache-2.0 | 25,772 |
package ch.epfl.yinyang
package transformers
import ch.epfl.yinyang._
import ch.epfl.yinyang.transformers._
import scala.reflect.macros.blackbox.Context
import language.experimental.macros
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
/**
* Converts captured variables to holes, which wi... | vjovanov/scala-yinyang | components/core/src/transformers/HoleTransformation.scala | Scala | bsd-3-clause | 2,133 |
/*
* Licensed to Intel Corporation under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* Intel Corporation licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use t... | SeaOfOcean/BigDL | dl/src/test/scala/com/intel/analytics/bigdl/dataset/DataSetSpec.scala | Scala | apache-2.0 | 12,030 |
package ChatShare
import common._
import akka.actor.{Actor, ActorRef, ActorSelection}
import akka.event.Logging
import akka.pattern.ask
import akka.util.Timeout
import scala.concurrent.duration._
import scala.concurrent.{Future, ExecutionContext}
import scala.collection.mutable.Map
class ClientHandler extends Actor... | highlanderkev/ChatShare | ChatShare/chatshare/src/main/scala/clienthandler.scala | Scala | mit | 5,225 |
/*
* (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-core | src/main/scala/cogx/platform/cpumemory/readerwriter/ComplexFieldReader.scala | Scala | apache-2.0 | 1,302 |
/*
* 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 ... | zhangjunfang/eclipse-dir | spark/graphx/src/main/scala/org/apache/spark/graphx/impl/EdgePartition.scala | Scala | bsd-2-clause | 8,353 |
package org.openurp.edu.eams.base.web.action
import org.beangle.data.jpa.dao.OqlBuilder
import org.beangle.data.model.Entity
import org.openurp.edu.eams.base.School
import org.openurp.edu.eams.base.code.ministry.Institution
import org.openurp.edu.eams.web.action.BaseAction
class SchoolAction extends BaseAction {
... | openurp/edu-eams-webapp | web/src/main/scala/org/openurp/edu/eams/base/web/action/SchoolAction.scala | Scala | gpl-3.0 | 1,157 |
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.