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 cmd
import inputdata.{DataHolder, MovieLensDataHolder, NetflixInManyFilesDataHolder, NetflixInOneFileDataHolder}
/**
* Created by Ondra Fiedler on 27.8.14.
*/
trait DataHolderFactoryFromConf extends NameAndDescription {
/**
* Returns an instance of DataHolder
* @param conf Instance of Conf with pa... | OndraFiedler/spark-recommender | src/main/scala/cmd/DataHolderFactoryFromConf.scala | Scala | mit | 1,967 |
package dawn.flow
class ModelHook[A] {
var model: Option[A] = None
def setModel(m: A) =
model = Some(m)
}
object ModelHook {
def apply[A] = new ModelHook[A]()
}
object RequireModel {
def isRequiring(x: Any) = x match {
case x: RequireModel[_] => true
case x: NamedFunction[_, _] => x.requireModel... | rubenfiszel/scala-flow | core/src/main/scala/ModelHook.scala | Scala | mit | 436 |
object ADTWithArray1 {
case class A(x: Int)
case class B(content: Array[A]) {
require(content.length > 0)
def contains(y: Int): Boolean = {
require(content.length > 0)
content(0).x == y
} ensuring(res => res)
}
}
| regb/leon | src/test/resources/regression/verification/purescala/invalid/ADTWithArray1.scala | Scala | gpl-3.0 | 247 |
import org.velocity4s.ScalaVelocityEngine
import java.io.StringWriter
import org.apache.velocity.VelocityContext
import org.apache.velocity.app.VelocityEngine
import org.apache.velocity.runtime.RuntimeConstants
import org.apache.velocity.runtime.resource.loader.StringResourceLoader
object Example {
def main(args: ... | kazuhira-r/velocity4s | examples/src/main/scala/Example.scala | Scala | apache-2.0 | 2,831 |
package com.twitter.finagle.service
import com.twitter.conversions.time._
import com.twitter.finagle._
import com.twitter.finagle.client.Transporter
import com.twitter.finagle.stats.StatsReceiver
import com.twitter.finagle.util.{DefaultLogger, Updater}
import com.twitter.logging.Level
import com.twitter.util.{Future, ... | koshelev/finagle | finagle-core/src/main/scala/com/twitter/finagle/service/FailFastFactory.scala | Scala | apache-2.0 | 7,723 |
package com.github.chengpohi.parser.impl
/**
* seccrawler
* Created by chengpohi on 12/26/15.
*/
object IteratorHelper {
implicit class PredicateSliceIterator(it: Iterator[String]) {
def sliceByPredicate(start: String => Boolean, end: String => Boolean): Iterator[String] = {
val self = it.buffered
... | chengpohi/secer | parser/src/main/scala/com/github/chengpohi/parser/impl/IteratorHelper.scala | Scala | apache-2.0 | 888 |
package support
case class State(
data: Data,
logs: List[Log]
)
object State {
def load(): State =
State(
data = Data.load(),
logs = Logger.read())
}
| loicknuchel/scala-class | src/main/scala/support/State.scala | Scala | unlicense | 222 |
package ru.zconstz.simuctor
import akka.actor.{ActorRef, Actor}
import scala.collection.mutable
trait WorldObject
case object Rock extends WorldObject
case object Pit extends WorldObject
trait ActiveWorldObject extends WorldObject {
def actor: ActorRef
}
sealed trait WorldMessage
case class MoveObject(from: (I... | konstantin-zlobin/simuctor | src/main/scala/ru/zconstz/simuctor/World.scala | Scala | apache-2.0 | 1,031 |
/*
* 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 ... | hwstreaming/flink | flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/batch/sql/WindowAggregateTest.scala | Scala | apache-2.0 | 7,823 |
package com.github.akileev.akka.serial.io
import akka.actor._
import akka.util.ByteString
/**
* Serial port extension based on the rxtx library for the akka IO layer.
*/
object Serial extends ExtensionId[SerialExt] with ExtensionIdProvider {
override def lookup = Serial
override def createExtension(system: Ex... | akileev/akka-serial-io | src/main/scala/com/github/akileev/akka/serial/io/Serial.scala | Scala | apache-2.0 | 3,366 |
package dhg.ccg.tag.learn
import dhg.util._
import scalaz._
import scalaz.Scalaz._
import dhg.ccg.prob._
import dhg.ccg.tagdict.TagDictionary
import com.typesafe.scalalogging.slf4j.{ StrictLogging => Logging }
/**
* Turn raw sentences and a tagdict into P(Tag->Tag)
*/
trait TransitionInitializer[Tag] {
type Word ... | dhgarrette/2015-ccg-parsing | src/main/scala/dhg/ccg/tag/learn/TypesupHmmInitialization.scala | Scala | apache-2.0 | 13,429 |
/* Title: Pure/Tools/spell_checker.scala
Author: Makarius
Spell checker with completion, based on JOrtho (see
https://sourceforge.net/projects/jortho).
*/
package isabelle
import java.lang.Class
import scala.collection.mutable
import scala.annotation.tailrec
import scala.collection.immutable.SortedMa... | larsrh/libisabelle | modules/pide/2019-RC4/src/main/scala/Tools/spell_checker.scala | Scala | apache-2.0 | 8,377 |
package refpay
//
//import unfiltered.filter.Plan
//import unfiltered.request._
//import unfiltered.response._
/**
*
*/
//class RefPayPlan extends Plan{
//
// override def intent = {
// case r@_ => {
// Ok ~> Html5(<p>Her kommer en ny tjeneste for dommere</p>)
// }
// }
//}
| magott/refpay | src/main/scala/refpay/RefPayPlan.scala | Scala | apache-2.0 | 293 |
class Test {
object Foo { def unapply(x: Int) = if (x == 2) Some(x.toString) else None }
def test: Unit = {
val a: PartialFunction[Int, String] = { case Foo(x) => x }
val b: PartialFunction[Int, String] = { case x => x.toString }
val e: PartialFunction[String, String] = { case x @ "abc" => x }
va... | som-snytt/dotty | tests/pos/i4177.scala | Scala | apache-2.0 | 647 |
package io.fintrospect
import com.twitter.finagle.http.Status
import com.twitter.io.Buf.ByteArray.Shared.extract
import io.fintrospect.formats.{Argo, JsonLibrary}
import io.fintrospect.parameters.BodySpec
import scala.util.Try
import scala.xml.Elem
/**
* Defines a potential response from a route, with a possible e... | daviddenton/fintrospect | core/src/main/scala/io/fintrospect/ResponseSpec.scala | Scala | apache-2.0 | 1,216 |
package kvstore
import akka.actor.Props
import akka.actor.Actor
import akka.actor.ActorRef
import scala.concurrent.duration._
import akka.actor.ReceiveTimeout
object Replicator {
case class Replicate(key: String, valueOption: Option[String], id: Long)
case class Replicated(key: String, id: Long)
case class S... | ByzanTine/Coursera-Scala | kvstore/src/main/scala/kvstore/Replicator.scala | Scala | mit | 1,880 |
/* Copyright 2014, 2015 Richard Wiedenhöft <richard@wiedenhoeft.xyz>
*
* 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 requir... | Richard-W/scalacrypt | src/main/scala/KeyedHash.scala | Scala | apache-2.0 | 2,144 |
package org.biosys.affy.models
import play.api.libs.json.Json
case class AffyDbRef(db:String, acc:String) {
}
object AffyDbRef {
implicit val affyDbRefFormat = Json.format[AffyDbRef]
}
| sdor/biosys | affy/src/main/scala/org/biosys/affy/models/AffyDbRef.scala | Scala | gpl-2.0 | 191 |
/*
* 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... | nhambletCCRI/geomesa | geomesa-core/src/main/scala/org/locationtech/geomesa/core/index/index.scala | Scala | apache-2.0 | 2,795 |
/*
*
* * Copyright 2020 Lenses.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 app... | datamountaineer/stream-reactor | kafka-connect-jms/src/main/scala/com/datamountaineer/streamreactor/connect/jms/source/JMSSourceTask.scala | Scala | apache-2.0 | 4,850 |
object Test extends dotty.runtime.LegacyApp {
import scala.tools.nsc.io._
val dir: VirtualDirectory = new VirtualDirectory("foo", None)
dir.subdirectoryNamed("foo")
assert(dir.lookupName("foo", true) != null)
}
| yusuke2255/dotty | tests/run/t1618.scala | Scala | bsd-3-clause | 224 |
/**
* Copyright 2009 Google 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 agree... | titanpad/titanpad | infrastructure/net.appjet.oui/main.scala | Scala | apache-2.0 | 14,117 |
package org.xarcher.ea.macros.common
import scala.reflect.macros.blackbox.Context
import scala.language.experimental.macros
/**
* Created by djx314 on 15-5-24.
*/
trait MacroUtils {
val c: Context
import c.universe._
def typeFromParamTree(tree: Tree) = c.typecheck(tree.duplicate, c.TYPEmode).tpe
def extr... | scalax/slickea | src/main/scala/org/xarcher/ea/macros/common/MacroUtils.scala | Scala | mit | 403 |
package io.buoyant.linkerd
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonIgnore, JsonSubTypes}
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.twitter.conversions.DurationOps._
import com.twitter.finagle.Stack
import com.twitter.finag... | linkerd/linkerd | linkerd/core/src/main/scala/io/buoyant/linkerd/LoadBalancerConfig.scala | Scala | apache-2.0 | 2,538 |
/*
* 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 | core/src/test/scala/org/apache/spark/metrics/sink/GraphiteSinkSuite.scala | Scala | apache-2.0 | 3,263 |
package com.artclod.mathml.scalar.concept
import com.artclod.math.TrigonometryFix
import com.artclod.mathml.scalar._
object Trigonometry {
def cos(v: Double) : Double = TrigonometryFix.cos0(v)
def sin(v: Double) : Double = TrigonometryFix.sin0(v)
def tan(v: Double) : Double = TrigonometryFix.tan0(v)
def cs... | kristiankime/calc-tutor | app/com/artclod/mathml/scalar/concept/Trigonometry.scala | Scala | mit | 1,649 |
package mesosphere.marathon.core.task.update.impl
import javax.inject.Inject
import com.google.inject.name.Names
import mesosphere.marathon.MarathonSchedulerDriverHolder
import mesosphere.marathon.core.base.Clock
import mesosphere.marathon.core.task.bus.MarathonTaskStatus
import mesosphere.marathon.core.task.tracker.... | vivekjuneja/marathon | src/main/scala/mesosphere/marathon/core/task/update/impl/TaskStatusUpdateProcessorImpl.scala | Scala | apache-2.0 | 2,919 |
package korolev.http
import java.net.SocketAddress
import java.nio.channels.AsynchronousChannelGroup
import korolev.data.BytesLike
import korolev.data.syntax._
import korolev.effect.io.ServerSocket
import korolev.effect.syntax._
import korolev.effect.{Decoder, Effect, Stream}
import korolev.http.protocol.Http11
impor... | fomkin/korolev | modules/http/src/main/scala/korolev/http/HttpServer.scala | Scala | apache-2.0 | 1,863 |
package com.atomist.source
import org.scalatest.{FlatSpec, Matchers}
class ArtifactSourceExceptionTest extends FlatSpec with Matchers {
it should "create new ArtifactSourceAccessException with message" in {
val e = new ArtifactSourceException("message")
e.getMessage should equal("message")
e.getCause s... | atomist/artifact-source | src/test/scala/com/atomist/source/ArtifactSourceExceptionTest.scala | Scala | gpl-3.0 | 904 |
import play.api._
import play.api.mvc._
import play.filters.csrf._
object Global extends WithFilters(CSRFFilter()) with GlobalSettings {
} | MJCallahanPage/CsrfDemoApp | app/Global.scala | Scala | mit | 139 |
package com.aurelpaulovic.transaction
trait Context {
} | AurelPaulovic/transactions-api | src/main/scala/com/aurelpaulovic/transaction/Context.scala | Scala | apache-2.0 | 57 |
package kafka.consumer
import com.softwaremill.react.kafka.ConsumerProperties
import kafka.serializer.DefaultDecoder
import kafka.utils.Logging
import scala.concurrent.duration._
import scala.language.postfixOps
/**
* Copied from https://github.com/stealthly/scala-kafka, 0.8.2-beta (not released at the moment)
*/
... | kali786516/reactive-kafka | core/src/main/scala/kafka/consumer/KafkaConsumer.scala | Scala | apache-2.0 | 1,146 |
/*
* 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 ... | hengyicai/OnlineAggregationUCAS | sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveTableScan.scala | Scala | apache-2.0 | 5,460 |
package org.alitouka.spark.dbscan.util.commandLine
private [dbscan] trait NumberOfBucketsArgParsing [C <: CommonArgs with NumberOfBucketsArg]
extends CommonArgsParser[C] {
opt[Int] ("numBuckets")
.foreach { args.numberOfBuckets = _ }
.valueName("<numBuckets>")
.text("Number of buckets in a histogram")... | isaacboucinha/CardioStream | web-app/src/main/scala/org/alitouka/spark/dbscan/util/commandLine/NumberOfBucketsArgParsing.scala | Scala | apache-2.0 | 323 |
// 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... | helifu/kudu | java/kudu-backup-common/src/test/scala/org/apache/kudu/backup/TestBackupGraph.scala | Scala | apache-2.0 | 5,289 |
package visitor
case class StyleVisitor() extends Visitor {
private lazy val ParentWidth = 58
private lazy val ElWidth = 46
override def visit(element: HtmlElement): Unit = applyWidth(element, ElWidth)
override def visit(parentElement: HtmlParentElement): Unit = applyWidth(parentElement, ParentWidth)
priva... | BBK-PiJ-2015-67/sdp-portfolio | exercises/week11/src/main/scala/visitor/StyleVisitor.scala | Scala | unlicense | 456 |
/*
* The MIT License
*
* Copyright (c) 2016 Fulcrum Genomics LLC
*
* 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 us... | fulcrumgenomics/dagr | tasks/src/main/scala/dagr/tasks/samtools/SamtoolsPileup.scala | Scala | mit | 2,219 |
package p04Euler
import p05Func.{ListFunc, Prime}
object HighDivTriNum {
def main() = {
val ln: Stream[Long] = ListFunc.listTriangularNumber
println(ln.find(Prime.nDivisor(_) > 500))
}
} | vkubicki/ScalaTest | src/main/scala/p04Euler/012 - HighDivTriNum.scala | Scala | mit | 208 |
package com.github.diegopacheco.scala.sandbox.fp.cats.fun
object EQMain extends App {
import java.util.Date
import cats.Eq
import cats.syntax.eq._
import cats.instances.long._
implicit val dateEq:Eq[Date] =
Eq.instance[Date] { (date1,date2) =>
date1.getTime === date2.getTime
}
val ... | diegopacheco/scala-playground | cats-scala-fp/src/main/scala/com/github/diegopacheco/scala/sandbox/fp/cats/fun/EQMain.scala | Scala | unlicense | 431 |
package example
class ValPattern {
val (left, right) = (1, 2)
val Some(number1) =
Some(1)
var (leftVar, rightVar) = (1, 2)
var Some(number1Var) =
Some(1)
def app(): Unit = {
println(
(
number1,
left,
right,
number1Var,
leftVar,
rightVar
... | scalameta/scalameta | semanticdb/integration/src/main/scala/example/ValPattern.scala | Scala | bsd-3-clause | 673 |
trait Monad[T <: Bound[T], MyType[x <: Bound[x]], Bound[_]] {
def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_],
Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]]
(f: T => Result[S]): Result[S]
def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_],
... | yusuke2255/dotty | tests/pending/pos/tcpoly_overloaded.scala | Scala | bsd-3-clause | 1,225 |
package is.hail.expr.ir
import scala.collection.mutable
object RefEquality {
def apply[T <: AnyRef](t: T): RefEquality[T] = new RefEquality[T](t)
}
class RefEquality[+T <: AnyRef](val t: T) {
override def equals(obj: scala.Any): Boolean = obj match {
case r: RefEquality[T] => t.eq(r.t)
case _ => false
... | danking/hail | hail/src/main/scala/is/hail/expr/ir/RefEquality.scala | Scala | mit | 2,015 |
/*
* @author Philip Stutz
*
* Copyright 2013 University of Zurich
*
* 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
*
* U... | hicolour/signal-collect | src/main/scala/com/signalcollect/storage/JavaMapVertexStorage.scala | Scala | apache-2.0 | 1,402 |
/*
* Copyright 2014 okumin.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | okumin/akka-persistence-sql-async | core/src/test/scala/akka/persistence/snapshot/sqlasync/PostgreSQLSnapshotStoreSpec.scala | Scala | apache-2.0 | 931 |
/*
* =========================================================================================
* Copyright © 2013-2017 the kamon project <http://kamon.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... | kamon-io/kamon-netty | src/main/scala/kamon/netty/util/MonitoredQueue.scala | Scala | apache-2.0 | 2,783 |
package com.twitter.scalding.typed.memory_backend
import org.scalatest.FunSuite
import org.scalatest.prop.PropertyChecks
import com.twitter.scalding.{ TypedPipe, Execution, Config, Local }
import com.twitter.scalding.typed.TypedPipeGen
class MemoryTest extends FunSuite with PropertyChecks {
private def mapMatch[K,... | jzmq/scalding | scalding-core/src/test/scala/com/twitter/scalding/typed/memory_backend/MemoryTest.scala | Scala | apache-2.0 | 3,463 |
package org.apache.kafka.streams.processor.internals.assignment
import com.twitter.inject.Test
// Currently empty as Kafka 2.5 doesn't need any test and BUILD requires a
// non empty set of source files.
class StaticPartitioningTest extends Test {}
| twitter/finatra | kafka-streams/kafka-streams-static-partitioning/src/test/scala-kafka2.5/StaticPartitioningTest.scala | Scala | apache-2.0 | 251 |
/*
* 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 ... | djspiewak/quasar | impl/src/main/scala/quasar/impl/datasources/DatasourceModules.scala | Scala | apache-2.0 | 7,548 |
/*
* Copyright 2017 PayPal
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in ... | anilgursel/squbs | squbs-testkit/src/main/scala/org/squbs/testkit/CustomTestKit.scala | Scala | apache-2.0 | 7,245 |
package org.scalatra
import java.net.URI
import javax.servlet.http.{ HttpServletRequest, HttpServletResponse }
import org.scalatra.servlet.ServletApiImplicits
/**
* Redirects unsecured requests to the corresponding secure URL.
*/
trait SslRequirement extends Handler with ServletApiImplicits {
abstract override ... | lightvector/scalatra | core/src/main/scala/org/scalatra/SslRequirement.scala | Scala | bsd-2-clause | 995 |
// Copyright 2014 Commonwealth Bank of Australia
//
// 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... | toddmowen/maestro | maestro-core/src/main/scala/au/com/cba/omnia/maestro/core/clear/Clean.scala | Scala | apache-2.0 | 1,591 |
package com.twitter.finatra.tests.json.internal
import com.fasterxml.jackson.annotation.{JsonIgnore, JsonIgnoreProperties, JsonProperty}
import com.fasterxml.jackson.databind.JsonNode
import com.twitter.finatra.domain.WrappedValue
import com.twitter.finatra.request._
import com.twitter.finatra.validation.{NotEmpty, Va... | kaushik94/finatra | jackson/src/test/scala/com/twitter/finatra/tests/json/internal/ExampleCaseClasses.scala | Scala | apache-2.0 | 5,566 |
/*
* Copyright (C) 2016 Christopher Batey and Dogan Narinc
*
* 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... | mikefero/cpp-driver | gtests/src/integration/scassandra/server/codec/src/test/scala/org/scassandra/codec/messages/ReadySpec.scala | Scala | apache-2.0 | 1,041 |
/*
* Copyright 2001-2013 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | dotty-staging/scalatest | scalactic-test/src/test/scala/org/scalactic/TypeCheckedSetEqualityConstraintsSpec.scala | Scala | apache-2.0 | 2,950 |
package mesosphere.mesos.simulation
import akka.actor.{ Actor, ActorRef, Cancellable, Props }
import akka.event.LoggingReceive
import mesosphere.mesos.simulation.DriverActor.{ KillTask, LaunchTasks }
import org.apache.mesos.Protos._
import org.apache.mesos.SchedulerDriver
import org.slf4j.LoggerFactory
import scala.c... | quamilek/marathon | mesos-simulation/src/main/scala/mesosphere/mesos/simulation/DriverActor.scala | Scala | apache-2.0 | 3,674 |
package nodes.learning
import breeze.linalg._
import breeze.stats.distributions.Multinomial
import breeze.stats.mean
import org.apache.spark.rdd.RDD
import pipelines.{Estimator, Transformer}
import utils.MatrixUtils
/**
*
* @param means matrix of dimension numClusters by numFeatures
*/
case class KMeansModel(means... | shivaram/keystone | src/main/scala/nodes/learning/KMeansPlusPlus.scala | Scala | apache-2.0 | 4,838 |
/*
Copyright (c) 2013, Noel Raymond Cower
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, this list of conditions... | nilium/spastic | src/main/scala/util/io/IOUtils.scala | Scala | bsd-2-clause | 5,288 |
package util
object Util {
def readFile(fileName: String, maxTries: Int = 3): String = {
def readFile0(count: Int): String = {
try { // if file is empty, try again, it should be there
val contents: String = scala.io.Source.fromFile(fileName).mkString
if (contents.isEmpty && (count < maxTri... | julianpeeters/avrohugger | avrohugger-core/src/test/scala/util/Util.scala | Scala | apache-2.0 | 789 |
package b
class A {
def foo = 1
}
| som-snytt/xsbt | sbt/src/sbt-test/source-dependencies/package-object-name/changes/A1.scala | Scala | bsd-3-clause | 37 |
package com.bizo.hive.sparkplug.auth
import com.amazonaws.auth.AWSCredentials
import org.json.simple.JSONObject
import org.json.simple.parser.JSONParser
import org.json.simple.JSONValue
import java.io.File
import java.io.{FileInputStream, InputStreamReader, InputStream}
/**
* Parse credentials.json style creds
*/
c... | pkallos/spark-plug | src/main/scala/com/bizo/hive/sparkplug/auth/EmrJsonCredentials.scala | Scala | apache-2.0 | 1,534 |
package com.caibowen.prma.monitor
import java.util.{List => JList, Map => JMap}
import akka.AkkaException
import akka.actor._
import akka.actor.SupervisorStrategy._
import com.caibowen.prma.api.model.EventVO
import com.caibowen.prma.monitor.eval._
import com.caibowen.prma.monitor.notify.Notifier
import org.slf4j.Logg... | xkommando/PRMA | monitor/src/main/scala/com/caibowen/prma/monitor/Monitor.scala | Scala | lgpl-3.0 | 1,760 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | maropu/spark | mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala | Scala | apache-2.0 | 12,321 |
package djinni
import djinni.ast._
import djinni.generatorTools._
import djinni.meta._
class CppMarshal(spec: Spec) extends Marshal(spec) {
// The scopeSymbols parameter accepted by many of these functions describes a Seq of
// symbols/names that are declared in the current scope. The TypeRef or MExpr expression
... | dropbox/djinni | src/source/CppMarshal.scala | Scala | apache-2.0 | 9,714 |
package scuff.web
import org.junit._
import org.junit.Assert._
import scuff.MediaType
class AcceptHeaderTest {
@Test
def basic(): Unit = {
val acceptTypes = Set(MediaType("text/html"))
assertTrue(AcceptHeader("text/html").get.accepts("text/html"))
assertTrue(AcceptHeader("*/*").get.accepts("text/html"... | nilskp/scuff | src/test/scala/scuff/web/AcceptHeaderTest.scala | Scala | mit | 3,940 |
/*
* Copyright 2014 Christos KK Loverdos
*
* 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... | loverdos/topsort | src/main/scala/com/ckkloverdos/topsort/GraphStructure.scala | Scala | apache-2.0 | 1,319 |
/*
* Copyright 2011, Patrick Boe
* ===========================
* This program is distributed under the terms of the GNU General Public License.
*
* This file is part of Thimblus.
*
* Thimblus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as publ... | patrickboe/thimblus | src/main/scala/org/thimblus/model/HomeModel.scala | Scala | gpl-3.0 | 2,160 |
/*
* 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/Elf.scala | Scala | apache-2.0 | 1,057 |
/*
* Copyright 2014 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | bpburns/spark-kernel | kernel-api/src/main/scala/com/ibm/spark/utils/ArgumentParsingSupport.scala | Scala | apache-2.0 | 1,890 |
/*
* Copyright (c) 2010-2011 Belmont Technology Pty Ltd. 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
*
* U... | GrahamLea/SodaTest | sodatest-runtime/src/main/scala/org/sodatest/runtime/data/SodaTest.scala | Scala | apache-2.0 | 781 |
package models.daos.slick
import models.User
import play.api.db.slick._
import play.api.db.slick.Config.driver.simple._
import models.daos.slick.DBTableDefinitions._
import com.mohiva.play.silhouette.core.LoginInfo
import scala.concurrent.Future
import java.util.UUID
import play.Logger
import models.daos.UserDAO
/**
... | sne11ius/play-silhouette-slick-seed | app/models/daos/slick/UserDAOSlick.scala | Scala | apache-2.0 | 4,100 |
/**
* 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... | flange/drift-dev | kafka/00-kafka_2.11-0.10.1.0/libs/tmp/kafka/producer/BrokerPartitionInfo.scala | Scala | apache-2.0 | 4,875 |
package models.join
import models.db._
/**
*
* @author ponkotuy
* Date: 14/12/16.
*/
case class ShipWithSpecs(ship: Ship, master: MasterShipBase, stype: MasterStype, spec: MasterShipSpecs) extends ShipParameter
| nekoworkshop/MyFleetGirls | server/app/models/join/ShipWithSpecs.scala | Scala | mit | 217 |
/*
* 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 ... | yew1eb/flink | flink-tests/src/test/scala/org/apache/flink/api/scala/util/DataSetUtilsITCase.scala | Scala | apache-2.0 | 2,840 |
package org.jetbrains.plugins.scala
package lang.resolve.processor
import java.util
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.{PsiClass, PsiElement, PsiPackage}
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScTypeAliasDefinition
import org.jetbrains.plugins.scala.lang.psi.api.tople... | LPTK/intellij-scala | src/org/jetbrains/plugins/scala/lang/resolve/processor/PrecedenceHelper.scala | Scala | apache-2.0 | 7,661 |
package sigmastate.serialization.generators
import org.scalacheck.{Arbitrary, Gen}
import sigmastate.Values.{FalseLeaf, TrueLeaf}
import sigmastate.{If, SInt, TreeLookup}
trait RelationGenerators {
this: ObjectGenerators with ConcreteCollectionGenerators =>
val treeLookupGen: Gen[TreeLookup] = for {
t <- arb... | ScorexFoundation/sigmastate-interpreter | sigmastate/src/test/scala/sigmastate/serialization/generators/RelationGenerators.scala | Scala | mit | 784 |
/*
* 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/test/scala/org/apache/spark/streaming/MasterFailureTest.scala | Scala | apache-2.0 | 15,744 |
package domala.jdbc.query
import domala.internal.expr.ExpressionEvaluator
import domala.internal.jdbc.sql.NodePreparedSqlBuilder
import org.seasar.doma.jdbc._
class SqlFileModifyQuery(kind: SqlKind, sqlFilePath: String) extends AbstractSqlModifyQuery(kind) {
protected var sqlFile: SqlFile = _
protected def pre... | bakenezumi/domala | core/src/main/scala/domala/jdbc/query/SqlFileModifyQuery.scala | Scala | apache-2.0 | 807 |
package sampler.r
import java.nio.file.{Paths, Files}
import collection.JavaConversions.asScalaBuffer
import java.nio.file.Path
import org.scalatest.BeforeAndAfter
import org.scalatest.FreeSpec
class ScriptRunnerTest extends FreeSpec with BeforeAndAfter {
val workingDir = Paths.get(getClass.getClassLoader.getResou... | tsaratoon/Sampler | sampler-core/src/test/scala/sampler/r/ScriptRunnerTest.scala | Scala | apache-2.0 | 1,362 |
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => m}
import scala.reflect.runtime.{universe => u}
object Test extends App {
locally {
try {
case class Test(a:String,b:List[Int])
val lookAtMe = m.reflect(Test("a",List(5)))
val value = u.weakTypeOf[Test]
... | felixmulder/scala | test/files/run/t6323b.scala | Scala | bsd-3-clause | 649 |
package demo.components
import chandu0101.macros.tojs.GhPagesMacros
import chandu0101.scalajs.react.components.{IconName, ReactGeomIcon}
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.html_<^._
object ReactGeomIconDemo {
val code = GhPagesMacros.exampleSource
// EXAMPLE:START
case class S... | rleibman/scalajs-react-components | demo/src/main/scala/demo/components/ReactGeomIconDemo.scala | Scala | apache-2.0 | 1,220 |
package org.jetbrains.plugins.scala.lang.parser.parsing.xml.pattern
import com.intellij.psi.xml.XmlTokenType
import org.jetbrains.plugins.scala.lang.lexer.ScalaXmlTokenTypes
import org.jetbrains.plugins.scala.lang.parser.{ErrMsg, ScalaElementTypes}
import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPs... | gtache/intellij-lsp | intellij-lsp-dotty/src/org/jetbrains/plugins/scala/lang/parser/parsing/xml/pattern/EmptyElemTagP.scala | Scala | apache-2.0 | 1,281 |
/*
* Copyright 2020 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 i... | spotify/scio | scio-core/src/main/scala/com/spotify/scio/transforms/syntax/SCollectionWithResourceSyntax.scala | Scala | apache-2.0 | 2,600 |
import DistributedSignal.PVarFactory
import rescala.default._
import rescala.extra.lattices.sequences.RGA.RGA
import rescala.extra.lattices.sequences.{RGA, Vertex}
/** DistributedVertexLists are LinkedLists operating on so called Vertices. Vertices store a value of type `A`.
*
* @param initial The initial value of... | guidosalva/REScala | Historical/dividiParoli/src/main/scala/PVertexList.scala | Scala | apache-2.0 | 1,455 |
package authentication.entities
sealed trait AuthState
case object Offline extends AuthState
case object Online extends AuthState
case object SigningIn extends AuthState
case object SigningOut extends AuthState
case object Updating extends AuthState
| lymr/fun-chat | fun-chat-client/src/main/scala/authentication/entities/AuthState.scala | Scala | mit | 256 |
/**
* The MIT License (MIT)
*
* Copyright (c) 2018 Israel Freitas(israel.araujo.freitas@gmail.com)
*
* 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 with... | ifreitas/AimlToXml | src/main/scala/ifreitas/scalaaiml/elements/ConditionItem.scala | Scala | mit | 1,353 |
/*
* 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 ... | ravipesala/incubator-carbondata | integration/spark-common-test/src/test/scala/org/apache/spark/sql/execution/command/CarbonTableSchemaCommonSuite.scala | Scala | apache-2.0 | 2,277 |
/*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package play.it.test
import java.security.KeyStore
import javax.net.ssl._
import play.api.test.PlayRunners
import play.api.{ Application, Configuration, Mode }
import play.core.ApplicationProvider
import play.core.server.ssl.FakeKeyStore
imp... | Shruti9520/playframework | framework/src/play-integration-test/src/test/scala/play/it/test/ServerEndpoints.scala | Scala | apache-2.0 | 8,001 |
/* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\\___/_/... | cran/rkafkajars | java/scala/testing/Benchmark.scala | Scala | apache-2.0 | 3,072 |
package com.twitter.finagle.buoyant
import com.twitter.finagle._
import com.twitter.finagle.Stack.Params
import com.twitter.finagle.client.{StackClient, StdStackClient, Transporter}
import com.twitter.finagle.dispatch.{SerialClientDispatcher, SerialServerDispatcher}
import com.twitter.finagle.netty3.{Netty3Listener, N... | denverwilliams/linkerd | router/core/src/e2e/scala/com/twitter/finagle/buoyant/Echo.scala | Scala | apache-2.0 | 4,115 |
/*
* Copyright (C) 2014 - 2017 Contributors as noted in the AUTHORS.md file
*
* 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)... | Tensei-Data/tensei-agent | benchmarks/src/jmh/scala/com/wegtam/tensei/agent/DataTreeNodeCreationBenchmark.scala | Scala | agpl-3.0 | 1,451 |
package com.twitter.finagle.http
/**
* This puts it all together: The HTTP codec itself.
*/
import com.twitter.conversions.storage._
import com.twitter.finagle._
import com.twitter.finagle.transport.Transport
import com.twitter.finagle.http.codec._
import com.twitter.finagle.http.filter.{HttpNackFilter, DtabFilter}... | suls/finagle | finagle-http/src/main/scala/com/twitter/finagle/http/Codec.scala | Scala | apache-2.0 | 15,211 |
/*
* 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
* distribute... | wvlet/airframe | airframe-codec/src/main/scala/wvlet/airframe/codec/PrimitiveCodec.scala | Scala | apache-2.0 | 30,837 |
/*
Copyright 2011 Andrew Fowler <andrew.fowler@devframe.com>
This file is part of Terinology2ODM Terminology2ODMConverter.
Terminology2ODMConverter 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 v... | rwynne/ops-data-conversion | ODM_Converter/src/model/IGroupDef.scala | Scala | bsd-3-clause | 1,132 |
package fpinscala.errorhandling
import scala.{Option => _, Some => _, Either => _, _} // hide std library `Option`, `Some` and `Either`, since we are writing our own in this chapter
sealed trait Option[+A] {
def map[B](f: A => B): Option[B] = this match {
case None => None
case Some(a) => Some(f(a))
}
... | Errorific/fpinscala | exercises/src/main/scala/fpinscala/errorhandling/Option.scala | Scala | mit | 2,526 |
package org.wartremover
package contrib.test
import org.scalatest.Assertions
import org.wartremover.test.WartTestTraverser
trait ResultAssertions extends Assertions {
def assertEmpty(result: WartTestTraverser.Result) = {
assertResult(List.empty, "result.errors")(result.errors)
assertResult(List.empty, "re... | wartremover/wartremover-contrib | core/src/test/scala/wartremover/contrib/ResultAssertions.scala | Scala | apache-2.0 | 1,218 |
package org.apache.spark.storage.pmof
import org.apache.spark.storage._
import org.apache.spark.serializer._
import org.apache.spark.executor.TaskMetrics
import org.apache.spark.internal.Logging
import org.apache.spark.{SparkConf, SparkEnv}
import org.apache.spark.util.Utils
import java.io.{File, OutputStream}
import... | Intel-bigdata/OAP | oap-shuffle/RPMem-shuffle/core/src/main/scala/org/apache/spark/storage/pmof/PmemBlockOutputStream.scala | Scala | apache-2.0 | 4,050 |
package demo
package components
package reacttable
import chandu0101.macros.tojs.GhPagesMacros
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.html_<^._
object ReactTableInfo {
val code = GhPagesMacros.exampleSource
// EXAMPLE:START
case class Backend($ : BackendScope[Unit, Unit]) {
def... | chandu0101/scalajs-react-components | demo/src/main/scala/demo/components/reacttable/ReactTableInfo.scala | Scala | apache-2.0 | 1,017 |
// 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/main/scala/org/scalastyle/scalariform/BlockImportChecker.scala | Scala | apache-2.0 | 2,430 |
/**
* Created by Variant on 16/3/22.
*/
object List_Fold_Sort {
def main(args: Array[String]) {
//0 + 1 + 2 + 3..100 从1到100
println((1 to 100).foldLeft(0)(_+_))
println((1 /: (1 to 100))(_ + _))
//1...3-(4-(5-100))从5到1
println((1 to 5).foldRight(100)(_ - _))
println(((1 to 5) :\\ 100)(_ - _)... | sparkLiwei/ProgrammingNote | scalaLearning/scalaDataStructure/List_Fold_Sort.scala | Scala | cc0-1.0 | 965 |
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.runtime
import ... | scala/scala | src/library/scala/runtime/StructuralCallSite.scala | Scala | apache-2.0 | 1,332 |
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.