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 mpff.controllers
import java.nio.charset.Charset
import mpff.resources.ServerErrorCode
import mpff.resources.UserErrorCode
import play.api.Logger
import play.api.i18n.I18nSupport
import play.api.libs.json.JsValue
import play.api.libs.json.Json
import play.api.mvc.Result
abstract class MPFFAbstractAPIControll... | mayah/mpff | app/mpff/controllers/MPFFAbstractAPIController.scala | Scala | mit | 2,661 |
package chana.serializer
import akka.actor.ExtendedActorSystem
import akka.serialization.Serializer
import akka.util.ByteString
import java.nio.ByteOrder
import org.apache.avro.Schema
final class SchemaSerializer(system: ExtendedActorSystem) extends Serializer {
implicit val byteOrder = ByteOrder.BIG_ENDIAN
over... | wandoulabs/chana | src/main/scala/chana/serializer/SchemaSerializer.scala | Scala | apache-2.0 | 1,012 |
package oriana
import akka.actor.{ActorRef, Actor}
import scala.collection.mutable
class SingleMessageCaptor extends Actor {
import oriana.SingleMessageCaptor.Read
var contents: Any = _
var waiting = mutable.Buffer[ActorRef]()
val resultReceived: Receive = {
case Read => sender() ! contents
}
val w... | Norwae/oriana | src/test/scala/oriana/SingleMessageCaptor.scala | Scala | bsd-2-clause | 594 |
package org.beaucatcher.bson
import org.beaucatcher.wire._
/** A detailed type tag for binary data in Bson. */
object BsonSubtype extends Enumeration {
type BsonSubtype = Value
val GENERAL, FUNC, BINARY, UUID, MD5, USER_DEFINED = Value
private val fromBytes =
Map(Bson.B_GENERAL -> GENERAL,
... | havocp/beaucatcher | base/src/main/scala/org/beaucatcher/bson/BsonSubtype.scala | Scala | apache-2.0 | 766 |
package io.hydrosphere.mist.master.store
import cats.implicits._
import com.zaxxer.hikari.HikariConfig
import io.hydrosphere.mist.master.{DbConfig, JobDetails, JobDetailsRequest, JobDetailsResponse}
import javax.sql.DataSource
import org.flywaydb.core.Flyway
import scala.concurrent.{ExecutionContext, Future}
trait J... | Hydrospheredata/mist | mist/master/src/main/scala/io/hydrosphere/mist/master/store/JobRepository.scala | Scala | apache-2.0 | 3,146 |
/*
* Copyright 2014 DataGenerator Contributors
*
* 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... | FINRAOS/DataGenerator | dg-common/src/main/scala/org/finra/datagenerator/common/SocialNetwork_Example/UserType.scala | Scala | apache-2.0 | 8,128 |
package com.sksamuel.elastic4s.http.search.queries.specialized
import org.elasticsearch.common.xcontent.{XContentBuilder, XContentFactory}
object WeightScoreBodyFn {
def apply(weight: Double): XContentBuilder = {
val builder = XContentFactory.jsonBuilder()
builder.startObject()
builder.field("weight", ... | aroundus-inc/elastic4s | elastic4s-http/src/main/scala/com/sksamuel/elastic4s/http/search/queries/specialized/WeightScoreBodyFn.scala | Scala | apache-2.0 | 378 |
package cwe.scala.library.runtime.exploration
import cwe.scala.library.runtime.test.ScalaTest
import cwe.scala.library.math.bignumbers.Natural
import cwe.scala.library.audit.AuditServiceProvider
class cweExplore extends ScalaTest {
def run(): Unit = {
val c = Natural.create("6543121452238632892310987678")
this.... | wwwigii-system/research | cwe-scala-library/src/cwe/scala/library/runtime/exploration/cweExplore.scala | Scala | gpl-3.0 | 1,893 |
// Classes: apply()
// A method named "apply" in Scala has
// special semantics
// Apply methods give a syntactic sugar
// for when a class has one main use.
class Bar {
def apply() = "boop!"
}
val bar = new Bar
print(bar())
// Prints "boop!"
| agconti/scala-school | 01-intro-to-scala/slides/slide023.scala | Scala | mit | 254 |
package com.twitter.finagle.kestrel.protocol
import org.jboss.netty.buffer.ChannelBuffer
import com.twitter.finagle.memcached.protocol.text.TokensWithData
import com.twitter.finagle.memcached.protocol.text.client.AbstractDecodingToResponse
private[kestrel] class DecodingToResponse extends AbstractDecodingToResponse[R... | enachb/finagle_2.9_durgh | finagle-kestrel/src/main/scala/com/twitter/finagle/kestrel/protocol/DecodingToResponse.scala | Scala | apache-2.0 | 802 |
package cinema.test.digraph
import cinema.graph.mutable.DirectedGraph
import cinema.graph.mutable.UndirectedGraph
object DiGraph {
def main(args: Array[String]) {
val G = new UndirectedGraph
G.addEdge(5, 4)
G.addEdge(4, 5)
println(G)
}
} | adelbertc/cinema | src/main/scala/TestDiGraph.scala | Scala | mit | 258 |
package scuff.concurrent
import scuff._
import scala.collection.immutable.Map
/**
* Lock-free concurrent Map.
* Wrapper-class that turns any immutable Map into a
* lock-free concurrent map.
*/
final class LockFreeConcurrentMap[A, B](initialMap: Map[A, B] = Map.empty[A, B])
extends collection.concurrent.Map... | nilskp/scuff | src/2.13/main/scala/scuff/concurrent/LockFreeConcurrentMap.scala | Scala | mit | 4,133 |
package clusterconsole.client.d3
import scala.scalajs.js
package D3 {
trait Selectors extends js.Object {
def select(selector: String): Selection = js.native
def selectAll(selector: String): Selection = js.native
}
trait Base extends Selectors {
var layout: Layout.Layout = js.native
}
trait S... | CapeSepias/cluster-console | js/src/main/scala/clusterconsole/client/d3/d3.scala | Scala | bsd-3-clause | 4,023 |
package com.softwaremill.streams.util
import scala.util.Random
object Timed {
def timed[T](b: => T): (T, Long) = {
val start = System.currentTimeMillis()
val r = b
(r, System.currentTimeMillis() - start)
}
def runTests(tests: List[(String, () => String)], repetitions: Int): Unit = {
val allTest... | ahjohannessen/streams-tests | src/main/scala/com/softwaremill/streams/util/Timed.scala | Scala | apache-2.0 | 1,365 |
package com.azavea.maml.eval.tile
import geotrellis.raster._
import java.lang.IllegalStateException
case class NeighboringTiles(
tl: Tile,
tm: Tile,
tr: Tile,
ml: Tile,
mr: Tile,
bl: Tile,
bm: Tile,
br: Tile
)
case class TileWithNeighbors(centerTile: Tile, buffers: Option[NeighboringTiles]) {
def... | geotrellis/maml | jvm/src/main/scala/eval/tile/TileWithNeighbors.scala | Scala | apache-2.0 | 1,032 |
package net.sansa_stack.rdf.spark
import net.sansa_stack.rdf.spark.utils.Logging
import org.apache.jena.graph.{Node, Triple}
import org.apache.spark.graphx._
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{DataFrame, Dataset, SaveMode, SparkSession}
/**
* Wrap up implicit classes/methods for RDF data i... | SANSA-Stack/Spark-RDF | sansa-rdf-spark/src/main/scala/net/sansa_stack/rdf/spark/model/package.scala | Scala | gpl-3.0 | 32,501 |
/***********************************************************************
* Copyright (c) 2013-2022 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... | locationtech/geomesa | geomesa-fs/geomesa-fs-storage/geomesa-fs-storage-orc/src/main/scala/org/locationtech/geomesa/fs/storage/orc/jobs/OrcSimpleFeatureActionInputFormat.scala | Scala | apache-2.0 | 2,572 |
package org.xsc.pure
import akka.actor.Actor
import concurrent.Future
object PureActor {
trait Base[Action, Effect, Response, State] {
type Propagate = PartialFunction[Effect, Future[Unit]]
val initialState: State
val handleAction: (State, Action) => (Option[Response], List[Effect])
val updat... | xsc/akka-pure-actor | src/main/scala/org/xsc/pure/PureActor.scala | Scala | mit | 1,596 |
/*
Copyright 2014 Twitter, 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 agreed to in writing, software
distr... | wanyifu/scaldingtest | scalding-core/src/main/scala/com/twitter/scalding/Execution.scala | Scala | apache-2.0 | 13,307 |
/*
* ________ ____
* / ____/ /_ ____ __________ ____ / __ )___ ___
* / / / __ \\/ __ `/ ___/ __ `/ _ \\/ __ / _ \\/ _ \\
* / /___/ / / / /_/ / / / /_/ / __/ /_/ / __/ __/
* \\____/_/ /_/\\__,_/_/ \\__, /\\___/_____/\\___/\\___/
* /____/
*
* ... | blackeye42/ChargeBeeDataSync | src/main/scala/core/DataSync.scala | Scala | lgpl-3.0 | 23,084 |
/*
* 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 ... | MLnick/spark | mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala | Scala | apache-2.0 | 109,723 |
/**
* Copyright (c) 2013-2015 Patrick Nicolas - Scala for Machine Learning - All rights reserved
*
* The source code in this file is provided by the author for the sole purpose of illustrating the
* concepts and algorithms presented in "Scala for Machine Learning". It should not be used to
* build commercial ap... | batermj/algorithm-challenger | books/cs/machine-learning/scala-for-machine-learning/1rst-edition/original-src-from-the-book/src/main/scala/org/scalaml/unsupervised/pca/PCA.scala | Scala | apache-2.0 | 4,066 |
package net.magik6k.jliblxc
import java.io.{FileOutputStream, File}
import net.magik6k.jliblxc.natives.NativeLxcContainer
private[jliblxc] object NativeLoader {
private val input = getClass.getResourceAsStream("/libjlxc.so")
private val dest = File.createTempFile("libjlxc", ".so")
private val output = new File... | magik6k/jLibLXC | src/main/scala/net/magik6k/jliblxc/NativeLoader.scala | Scala | mit | 544 |
package ch.ltouroumov.modularmachines.common.tileentity.ports
import ch.ltouroumov.modularmachines.common.tileentity.PortType
class MachinePortFluid extends MachinePortBase {
def portType = PortType.Fluid
}
| ltouroumov/modular-machines | src/main/scala/ch/ltouroumov/modularmachines/common/tileentity/ports/MachinePortFluid.scala | Scala | gpl-2.0 | 212 |
package es.weso.wiFetcher.dao
import es.weso.wiFetcher.entities.Indicator
/**
* This trait contains all method that has to have a class that load information
* about indicators
*/
trait IndicatorDAO extends DAO [Indicator] {
def getPrimaryIndicators() : List[Indicator]
def getSecondaryIndicators() : List... | weso/wiFetcher | app/es/weso/wiFetcher/dao/IndicatorDAO.scala | Scala | apache-2.0 | 334 |
/*
* 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 ... | facaiy/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JSONOptions.scala | Scala | apache-2.0 | 7,436 |
/*
* 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 ... | ZxlAaron/mypros | mllib-local/src/test/scala/org/apache/spark/ml/linalg/MatricesSuite.scala | Scala | apache-2.0 | 17,257 |
/**
* 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... | wangcy6/storm_app | frame/kafka-0.11.0/kafka-0.11.0.1-src/core/src/test/scala/unit/kafka/utils/timer/TimerTaskListTest.scala | Scala | apache-2.0 | 2,956 |
package org.jetbrains.sbt.project
import java.io.File
import java.util
import com.intellij.openapi.externalSystem.ExternalSystemAutoImportAware
import com.intellij.openapi.project.Project
import org.jetbrains.sbt._
import org.jetbrains.sbt.project.AutoImportAwareness._
import scala.collection.JavaConverters._
/**
... | jastice/intellij-scala | scala/scala-impl/src/org/jetbrains/sbt/project/AutoImportAwareness.scala | Scala | apache-2.0 | 1,517 |
/*
* 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 ... | mzl9039/spark | core/src/main/scala/org/apache/spark/internal/config/package.scala | Scala | apache-2.0 | 11,900 |
/*
* Copyright 2014 DataGenerator Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | Brijeshrpatel9/SingleThreaderProcessingDG | dg-common/src/main/code/org/finra/datagenerator/common/Helpers/BooleanHelper.scala | Scala | apache-2.0 | 1,027 |
package microtools.actions
import java.util.UUID
import microtools.models.ExtraHeaders
import play.api.mvc.RequestHeader
import scala.util.Try
object Helper {
def isBusinessDebug(rh: RequestHeader): Boolean =
rh.cookies
.get(ExtraHeaders.DEBUG_HEADER)
.flatMap(c => Try(c.value.toBoolean).toOption)... | 21re/play-micro-tools | src/main/scala/microtools/actions/Helper.scala | Scala | mit | 807 |
/*
* MUSIT is a museum database to archive natural and cultural history data.
* Copyright (C) 2016 MUSIT Norway, part of www.uio.no (University of Oslo)
*
* 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 Softw... | kpmeen/musit | musit-service/src/main/scala/no/uio/musit/service/MusitFilter.scala | Scala | gpl-2.0 | 1,095 |
package ld.query
import cmwell.fts._
import cmwell.web.ld.cmw.CMWellRDFHelper
import cmwell.web.ld.query._
import com.typesafe.scalalogging.LazyLogging
import ld.cmw.PassiveFieldTypesCache
import ld.query.JenaArqExtensionsUtils._
import logic.CRUDServiceFS
import org.apache.jena.graph.{Node, NodeFactory, Triple}
impor... | nruppin/CM-Well | server/cmwell-ws/app/ld/query/JenaArqExtensionsUtils.scala | Scala | apache-2.0 | 9,738 |
package com.twitter.scalding.parquet.tuple.scheme
import parquet.io.api.{ Binary, Converter, GroupConverter, PrimitiveConverter }
import scala.util.Try
trait TupleFieldConverter[+T] extends Converter with Serializable {
/**
* Current value read from parquet column
*/
def currentValue: T
/**
* reset th... | bendridi/scalding | scalding-parquet/src/main/scala/com/twitter/scalding/parquet/tuple/scheme/ParquetTupleConverter.scala | Scala | apache-2.0 | 9,198 |
/*
* 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 ... | ahnqirage/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoder.scala | Scala | apache-2.0 | 15,898 |
/*
* Copyright 2008-present MongoDB, 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 ag... | rozza/mongo-scala-driver | bson/src/main/scala/org/mongodb/scala/bson/BsonTransformer.scala | Scala | apache-2.0 | 6,776 |
package com.twitter.finagle.mysql.codec
import com.twitter.finagle.mysql.protocol.{Buffer, Packet}
import org.jboss.netty.channel.{Channel, ChannelHandlerContext}
import org.jboss.netty.buffer.ChannelBuffers
import org.specs.mock.Mockito
import org.specs.SpecificationWithJUnit
class PacketFrameDecoderSpec extends Spe... | foursquare/finagle | finagle-mysql/src/test/scala/com/twitter/finagle/mysql/unit/codec/PacketFrameDecoderSpec.scala | Scala | apache-2.0 | 1,218 |
package forcomp
import common._
object Anagrams {
/** A word is simply a `String`. */
type Word = String
/** A sentence is a `List` of words. */
type Sentence = List[Word]
/** `Occurrences` is a `List` of pairs of characters and positive integers saying
* how often the character appears.
* This l... | WangTaoTheTonic/Functional-Programming-Principles-in-Scala | code/forcomp/src/main/scala/forcomp/Anagrams.scala | Scala | apache-2.0 | 6,559 |
/*
* Copyright 2014-2022 Jarek Sacha (jpsacha -at- gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | jpsacha/sbt-install4j | src/main/scala/net/ij_plugins/sf/sbt/install4j/Defaults.scala | Scala | apache-2.0 | 2,420 |
/*
* Copyright 2011-2018 GatlingCorp (http://gatling.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applic... | wiacekm/gatling | gatling-commons/src/main/scala/io/gatling/commons/util/RoundRobin.scala | Scala | apache-2.0 | 1,057 |
/*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | intel-analytics/BigDL | scala/dllib/src/main/scala/com/intel/analytics/bigdl/dllib/feature/dataset/segmentation/MaskUtils.scala | Scala | apache-2.0 | 16,731 |
/*
* 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 ... | prateekm/samza | samza-core/src/test/scala/org/apache/samza/system/filereader/TestFileReaderSystemAdmin.scala | Scala | apache-2.0 | 3,521 |
/*
* Copyright 2014–2017 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | drostron/quasar | yggdrasil/src/main/scala/quasar/yggdrasil/table/cf/Math.scala | Scala | apache-2.0 | 4,096 |
/*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package org.scalajs.nscplugin.test
import org... | scala-js/scala-js | compiler/src/test/scala/org/scalajs/nscplugin/test/StaticForwardersASTTest.scala | Scala | apache-2.0 | 2,180 |
/*
* Copyright 2011-2022 GatlingCorp (https://gatling.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... | gatling/gatling | gatling-core/src/test/scala/io/gatling/core/controller/inject/closed/ClosedInjectionStepSpec.scala | Scala | apache-2.0 | 4,834 |
/**
* Copyright 2015 Thomson Reuters
*
* Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... | nruppin/CM-Well | server/cmwell-controller/src/main/scala/cmwell/ctrl/tasks/Task.scala | Scala | apache-2.0 | 1,211 |
package org.pgscala.converters
import org.joda.time.LocalDate
/** Do not edit - generated in Builder / PGLocalDateConverterBuilder.scala */
object PGLocalDateConverter extends PGConverter[LocalDate] {
val PGType = PGNullableLocalDateConverter.pgType
def toPGString(ld: LocalDate) =
PGNullableLocalDateConvert... | melezov/pgscala | converters-scala/src/generated/scala/org/pgscala/converters/core/PGLocalDateConverter.scala | Scala | bsd-3-clause | 549 |
/*
* Copyright (c) 2014-2021 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... | monixio/monix | monix-reactive/shared/src/main/scala/monix/reactive/internal/builders/EvalAlwaysObservable.scala | Scala | apache-2.0 | 1,499 |
package salgo.collection.array
trait ArrayExtension {
implicit class ArrayExt2[T](underlay: Array[Array[T]]) {
def apply(a: Int, b: Int): T = underlay(a)(b)
def update(a: Int, b: Int, value: T) = underlay(a).update(b, value)
}
implicit class ArrayExt3[T](underlay: Array[Array[Array[T]]]) {
def apply... | shivawu/salgo | collection/src/main/scala/salgo/collection/array/ArrayExtension.scala | Scala | apache-2.0 | 1,388 |
package pep_118
import common.IntOps._
object Wip {
object Attempt1 {
val digits = (1 to 9).toSet
// Set is Monadic but not a Monad :-(
val p1: Set[Int] = for {
n <- digits
if isPrime(n)
} yield n
val p2: Set[Int] = for {
a <- digits diff Set(2, 4, 5, 6, 8)
b <- digi... | filippovitale/pe | pe-solution/src/main/scala/pep_118/Wip.scala | Scala | mit | 6,735 |
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
... | deeplearning4j/deeplearning4j | scalnet/src/test/scala/org/deeplearning4j/scalnet/models/SequentialTest.scala | Scala | apache-2.0 | 3,419 |
package a65.测试5
object Runner6 {
def number1s(n: Int): Number1 = {
lazy val taZero: Number1 = Number1T(() => taZero)
n match {
case n1 if n1 > 0 => Number1S(() => number1s(n1 - 1))
case 0 => taZero
}
}
def number1t(n: Int): Number1 = {
def gen(n1: Int, zero: => Number1): N... | djx314/ubw | a66-指数对数-原型/src/main/scala/a65/测试5/Runner6.scala | Scala | bsd-3-clause | 2,607 |
/*
* 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 agr... | svn2github/scalatest | src/main/scala/org/scalatest/concurrent/ConductorFixture.scala | Scala | apache-2.0 | 3,841 |
/**********************************************************************************************************************
* This file is part of Scrupal, a Scalable Reactive Content Management System. *
* ... | scrupal/scrupal-store-reactivemongo | src/main/scala/scrupal/store/reactivemongo/VariantRegistry.scala | Scala | apache-2.0 | 3,262 |
package org.moscatocms;
import akka.actor.{ActorSystem, Props}
import akka.io.IO
import spray.can.Http
import akka.pattern.ask
import akka.util.Timeout
import scala.concurrent.duration._
import org.moscatocms.api.Api
object Boot extends App {
implicit val system = ActorSystem("moscato")
val service = system.ac... | moscatocms/moscato | src/main/scala/org/moscatocms/Boot.scala | Scala | apache-2.0 | 598 |
package algorithms
/**
* @author loustler
* @since 02/09/2017 00:33
*/
object RecursiveBinarySearchTest extends App{
val numberList = Array(1, 2, 3, 4, 5, 6, 7, 10, 15, 20)
val start = 0
val last = numberList.length - 1
val find = 15
val findIndex = 8
val result1 = RecursiveBinarySearch binarySearch... | loustler/scala | src/test/scala/algorithms/RecursiveBinarySearchTest.scala | Scala | mit | 501 |
package org.cddb.lsmt
trait Table {
}
object Table {
}
| tierex/cddb | core/src/main/scala/org/cddb/lsmt/Table.scala | Scala | apache-2.0 | 59 |
/*
* Copyright 2017 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... | liquidarmour/ct-calculations | src/main/scala/uk/gov/hmrc/ct/accounts/frs102/boxes/ACQ5032.scala | Scala | apache-2.0 | 1,092 |
/*
Copyright 2012 Twitter, 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 agreed to in writing, software
distr... | erikerlandson/algebird | algebird-test/src/test/scala/com/twitter/algebird/VectorSpaceProperties.scala | Scala | apache-2.0 | 1,353 |
/**
* Copyright 2015 Otto (GmbH & Co KG)
*
* 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... | christianrichter/schedoscope | schedoscope-core/src/main/scala/org/schedoscope/dsl/views/DateParameterization.scala | Scala | apache-2.0 | 12,698 |
package com.twitter.finagle.spdy
import com.twitter.conversions.storage._
import com.twitter.finagle._
import com.twitter.finagle.netty3.transport.ChannelTransport
import com.twitter.finagle.stats.StatsReceiver
import com.twitter.finagle.transport.Transport
import com.twitter.util.{Closable, StorageUnit}
import java.u... | sveinnfannar/finagle | finagle-spdy/src/main/scala/com/twitter/finagle/spdy/Codec.scala | Scala | apache-2.0 | 5,008 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | gioenn/xSpark | core/src/test/scala/org/apache/spark/network/netty/NettyBlockTransferSecuritySuite.scala | Scala | apache-2.0 | 5,847 |
/*
* Copyright 2017 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/api-gateway | test/uk/gov/hmrc/apigateway/util/ProxyRequestUtilsSpec.scala | Scala | apache-2.0 | 2,185 |
package io.github.finaglecircuit
import com.twitter.util.Future
trait CircuitBreaker {
val name: CircuitName
/**
* Wrap the passed call in a circuit breaking context. Possibly fails with a CircuitBroken failure in the future result.
*/
def withCircuit[T](body: => Future[T]): Future[T]
/**
* Event c... | daviddenton/finagle-circuit | src/main/scala/io/github/finaglecircuit/CircuitBreaker.scala | Scala | apache-2.0 | 567 |
/*
* 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 | external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaContinuousStream.scala | Scala | apache-2.0 | 10,146 |
/***********************************************************************
* 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 ... | drackaer/geomesa | geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/geohash/GeomDistance.scala | Scala | apache-2.0 | 5,531 |
/*
* 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/main/scala/org/knora/webapi/util/SparqlResultProtocol.scala | Scala | agpl-3.0 | 3,210 |
/*
* Copyright 2017 Shinya Mochida
*
* Licensed under the Apache License,Version2.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... | mike-neck/jvm-langs-til | scala-projects/scala-review/src/main/scala/com/example/Operation.scala | Scala | apache-2.0 | 1,423 |
package me.bowdon.ddldiff.parsers
import me.bowdon.ddldiff.ast._
class ParseError(reason: String) {
override def toString = reason
}
object DDLParsers extends ColumnConstraintParsers {
def create: Parser[String] = p"create" <~ (p"temp" | p"temporary").?
// TODO affinities
// https://sqlite.org/datatype3.ht... | cbowdon/ddl-diff | src/main/scala/me/bowdon/ddldiff/parsers/DDLParsers.scala | Scala | gpl-3.0 | 1,576 |
package water.fvec
import java.io.File
import java.net.URI
import water._
import water.parser.ParseSetup._
import water.parser.ParseSetup
import water.util.FrameUtils
import water.parser.DefaultParserProviders.GUESS_INFO
/**
* Wrapper around Java H2O Frame to provide more Scala-like API.
*
* @param frameKey refe... | mathemage/h2o-3 | h2o-scala/src/main/scala/water/fvec/H2OFrame.scala | Scala | apache-2.0 | 5,044 |
/***********************************************************************
* Copyright (c) 2013-2018 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... | jahhulbert-ccri/geomesa | geomesa-utils/src/main/scala/org/locationtech/geomesa/utils/index/SpatialIndex.scala | Scala | apache-2.0 | 1,097 |
package com.softwaremill.macwire.dependencyLookup
import com.softwaremill.macwire.Logger
import com.softwaremill.macwire.dependencyLookup.EligibleValuesFinder.Scope.LocalForward
import scala.reflect.macros.blackbox
private[macwire] class DependencyResolver[C <: blackbox.Context](val c: C, debug: Logger) {
import ... | numesmat/macwire | macros/src/main/scala/com/softwaremill/macwire/dependencyLookup/DependencyResolver.scala | Scala | apache-2.0 | 1,520 |
package satisfaction
package hadoop
package hive.ms
import org.joda.time._
/**
* DataInstance for HiveTable with no partitions
* is a non-partitioned table.
*/
case class NonPartitionedTable(
val hiveTable : HiveTable)
(implicit val ms : MetaStore) extends DataInstance with Markable {
def s... | jeromebanks/satisfaction | modules/hive-ms/src/main/scala/satisfaction/hive/ms/NonPartitionedTable.scala | Scala | apache-2.0 | 1,474 |
/**
* Copyright (c) 2013 Saddle Development Team
*
* 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 ... | saddle/saddle | saddle-core/src/main/scala/org/saddle/mat/MatImpl.scala | Scala | apache-2.0 | 2,314 |
/*
* Copyright 2013-2015 Websudos, Limited.
*
* 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 c... | dan-mi-sun/phantom | phantom-dsl/src/main/scala/com/websudos/phantom/batch/BatchQuery.scala | Scala | bsd-2-clause | 2,878 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | chenc10/Spark-PAF | sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala | Scala | apache-2.0 | 3,350 |
/**
* 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... | lindong28/kafka | core/src/main/scala/kafka/zk/AdminZkClient.scala | Scala | apache-2.0 | 24,793 |
package org.ferrit.core.filter
import org.ferrit.core.uri.CrawlUri
/**
* Strategy for deciding if the given URI can be followed by a crawler.
*
*/
trait UriFilter {
/**
* Tests if the given URI is accepted.
*/
def accept(uri: CrawlUri): Boolean
/**
* Optional method that can be overridden to expla... | reggoodwin/ferrit | src/main/scala/org/ferrit/core/filter/UriFilter.scala | Scala | mit | 760 |
/*
* #%L
* gatling-any
* %%
* Copyright (C) 2013 Thrillsoft
* %%
* 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 req... | spirylics/gatling-any | src/test/scala/com/thrillsoft/gatling/any/AnySimulation.scala | Scala | apache-2.0 | 2,210 |
val index = "/tmp/index-lm"
val CORPUS = Array(
"Alice ate an apple.",
"Mike likes an orange.",
"An apple is red."
)
def schema(): Schema = {
val builder = AnalyzerBuilder()
builder.withTokenizer("standard")
builder.addTokenFilter("lowercase")
val analyzer = builder.build
builder.addTokenFilter("shing... | NLP4L/meetups | 20150818/language_model.scala | Scala | apache-2.0 | 1,554 |
class C1(var p: Int)
class C2(var p: Int) extends C1(1) {
println(/* line: 3 */p)
} | ilinum/intellij-scala | testdata/resolve2/inheritance/override/ClassParameterVariable.scala | Scala | apache-2.0 | 86 |
package net.thereturningvoid.bladebot
import java.io.{IOException, File, UnsupportedEncodingException}
import java.net.URLDecoder
import javax.security.auth.login.LoginException
import jline.console.ConsoleReader
import jline.console.history.FileHistory
import net.dv8tion.jda.entities.{Message, TextChannel, Guild}
im... | TheReturningVoid/BladeBot | src/main/scala/net/thereturningvoid/bladebot/BladeBot.scala | Scala | mit | 7,320 |
/*
* 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/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/PythonUDF.scala | Scala | apache-2.0 | 3,771 |
package mesosphere.mesos.simulation
import java.util.UUID
import akka.actor.{Actor, ActorRef, Cancellable, Props}
import akka.event.LoggingReceive
import com.typesafe.scalalogging.StrictLogging
import mesosphere.marathon.stream.Implicits._
import mesosphere.mesos.simulation.DriverActor._
import mesosphere.mesos.simul... | gsantovena/marathon | mesos-simulation/src/main/scala/mesosphere/mesos/simulation/DriverActor.scala | Scala | apache-2.0 | 8,175 |
/*
*
* 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"); y... | gustavoanatoly/hbase | hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/ByteArrayComparable.scala | Scala | apache-2.0 | 1,602 |
/* Copyright 2009-2016 EPFL, Lausanne */
package leon
import leon.annotation._
import leon.lang._
import scala.language.implicitConversions
package object invariant {
@library
def tmpl(templateFunc: BigInt => Boolean): Boolean = true
@library
def tmpl(templateFunc: (BigInt, BigInt) => Boolean): Boolean = tru... | epfl-lara/leon | library/leon/invariant/package.scala | Scala | gpl-3.0 | 685 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | chenc10/Spark-PAF | mllib/src/main/scala/org/apache/spark/mllib/impl/PeriodicCheckpointer.scala | Scala | apache-2.0 | 5,843 |
/*
* Copyright 2012 Twitter 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 agreed t... | travisbrown/zipkin | zipkin-cassandra/src/main/scala/com/twitter/zipkin/storage/cassandra/CassieSpanStore.scala | Scala | apache-2.0 | 16,448 |
package lila.lobby
import akka.actor._
import com.typesafe.config.Config
import lila.common.PimpedConfig._
import lila.socket.History
final class Env(
config: Config,
db: lila.db.Env,
hub: lila.hub.Env,
onStart: String => Unit,
blocking: String => Fu[Set[String]],
playban: String => Fu[Option... | r0k3/lila | modules/lobby/src/main/Env.scala | Scala | mit | 2,883 |
/*
* 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 ... | esi-mineset/spark | mllib/src/main/scala/org/apache/spark/ml/feature/DCT.scala | Scala | apache-2.0 | 3,015 |
package io.hydrosphere.mist
import scala.concurrent.duration._
object Constants {
object Actors {
final val syncJobRunnerName = "SyncJobRunner"
final val asyncJobRunnerName = "AsyncJobRunner"
final val clusterManagerName = "ClusterManager"
final val mqttServiceName = "MQTTService"
final val kafk... | KineticCookie/mist | src/main/scala/io/hydrosphere/mist/Constants.scala | Scala | apache-2.0 | 1,070 |
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt
import sbt.Def.{ Initialize, ScopedKey }
import sbt.Previous._
import sbt.Scope.Global
import sbt.SlashSyntax0._
import sbt.internal.util._
import sbt.std.TaskEx... | sbt/sbt | main-settings/src/main/scala/sbt/Previous.scala | Scala | apache-2.0 | 7,529 |
package scala.scalanative
package runtime
import native._
/**
* The Boehm GC conservative garbage collector
*
* @see [[http://hboehm.info/gc/gcinterface.html C Interface]]
*/
@link("gc")
@extern
object GC {
@name("GC_malloc")
def malloc(size: CSize): Ptr[_] = extern
@name("GC_malloc_atomic")
def malloc_at... | phdoerfler/scala-native | nativelib/src/main/scala/scala/scalanative/runtime/GC.scala | Scala | bsd-3-clause | 404 |
package org.monkeynuthead.riak
object AlbumRepositoryProtocol {
case class StoreAlbum(album: Album) //response on success is the album
case class FetchAlbumByTitle(title: String) //reponse is an Option[Album]
}
| georgenicoll/monkey-barrel | old20150804/riak-scala-client-example/src/main/scala/org/monkeynuthead/riak/AlbumRepositoryProtocol.scala | Scala | gpl-2.0 | 222 |
package authentication
import models.User
import org.scalatest.{MustMatchers, WordSpec}
/**
* Tests for user profile
*/
class UserProfileTest extends WordSpec with MustMatchers {
"An unauthenticated profile" should {
"be not authenticated" in {
UnauthenticatedProfile.authenticated mustBe ... | metaxmx/FridayNightBeer | modules/datamodel/src/test/scala/authentication/UserProfileTest.scala | Scala | apache-2.0 | 3,083 |
/*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache... | alexandru/monifu | monix-reactive/jvm/src/main/scala/monix/reactive/compression/internal/operators/InflateOperator.scala | Scala | apache-2.0 | 4,536 |
package com.shrbank.bigdata.storm
import org.slf4j.LoggerFactory
/**
* Created by wushaojie on 2016/9/20.
* 查看当前SyncSpout在Zk中的配置情况
*/
object ZkConfigHelper {
private val log = LoggerFactory.getLogger(this.getClass)
def main(args: Array[String]): Unit = {
if ( args.length < 3 ){
log.error("用法:ZkCon... | shrbank/SyncSpout | core/src/main/scala/com/shrbank/bigdata/storm/ZkConfigHelper.scala | Scala | gpl-2.0 | 2,375 |
package algorithms.implementation
import org.scalatest.FunSuite
import scala.language.implicitConversions
/**
* Created by yujieshui on 2017/5/11.
*/
class BiggerIsGreaterTest extends FunSuite {
import BiggerIsGreater._
implicit def s2l(s: String): List[Char] = Predef.augmentString(s).toList
test("a") {... | 1178615156/hackerrank | src/test/scala/algorithms/implementation/BiggerIsGreaterTest.scala | Scala | apache-2.0 | 859 |
package sangria.validation.rules
import org.scalatest.WordSpec
import sangria.util.{Pos, ValidationSupport}
class FieldsOnCorrectTypeSpec extends WordSpec with ValidationSupport {
override val defaultRule = Some(new FieldsOnCorrectType)
"Validate: Fields on correct type" should {
"Object field selection" in... | narahari92/sangria | src/test/scala/sangria/validation/rules/FieldsOnCorrectTypeSpec.scala | Scala | apache-2.0 | 4,338 |
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.