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 com.github.tanacasino.sample2
// private をつけるとコンストラクタが他のクラスから呼べないやつになりますJavaでもやりますよね!Singleton パターンなどで。
class CompanionA private (name: String, age: Int) {
// お互いにprivateメンバーにアクセス可能です
def say = CompanionA.PrivateValue
def fire = {
CompanionA.staticMethod
}
}
object CompanionA {
private val ... | tanacasino/learning-scala | src/main/scala/com/github/tanacasino/sample2/CompanionA.scala | Scala | mit | 648 |
package io.citrine.lolo.validation
import io.citrine.lolo.{Learner, PredictionResult}
import scala.util.Random
/**
* Methods tha use cross-validation to calculate predicted-vs-actual data and metric estimates
*/
case object CrossValidation {
/**
* Driver to apply named metrics to k-fold cross-validated pr... | CitrineInformatics/lolo | src/main/scala/io/citrine/lolo/validation/CrossValidation.scala | Scala | apache-2.0 | 2,536 |
package at.ac.tuwien.ifs.ir.evaluation.pool
import at.ac.tuwien.ifs.ir.model._
import org.apache.commons.math3.distribution.BetaDistribution
import scala.annotation.tailrec
import scala.util.Random
/**
* Multi-Armed Bandits Based Pool
* Created by aldo on 25/07/16.
*/
class MABBasedPool(m: String, c1: Double, ... | aldolipani/PoolBiasEstimators | src/main/scala/at/ac/tuwien/ifs/ir/evaluation/pool/MABBasedPool.scala | Scala | apache-2.0 | 7,626 |
package org.jetbrains.plugins.scala.codeInsight.intention.comprehension
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.{PsiElement, TokenType}
import org.jetbrains.plugins.scala.extens... | whorbowicz/intellij-scala | src/org/jetbrains/plugins/scala/codeInsight/intention/comprehension/ConvertToParenthesesIntention.scala | Scala | apache-2.0 | 1,996 |
package org.openapitools.client.model
case class ComputerSet (
_class: Option[String],
_busyExecutors: Option[Integer],
_computer: Option[List[HudsonMasterComputer]],
_displayName: Option[String],
_totalExecutors: Option[Integer]
)
object ComputerSet {
def toStringBody(var_class: Object, var_... | cliffano/swaggy-jenkins | clients/scala-gatling/generated/src/gatling/scala/org/openapitools/client/model/ComputerSet.scala | Scala | mit | 640 |
/*
* Copyright 2022 Typelevel
*
* 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... | typelevel/sbt-typelevel | mergify/src/main/scala/org/typelevel/sbt/mergify/MergifyPlugin.scala | Scala | apache-2.0 | 7,260 |
package org.joda.time.chrono
import java.util.HashMap
import java.util.Locale
import org.joda.time.Chronology
import org.joda.time.DateTimeConstants
import org.joda.time.DateTimeField
import org.joda.time.DateTimeZone
import org.joda.time.DurationField
import org.joda.time.IllegalFieldValueException
import org.joda.ti... | mdedetrich/soda-time | jvm/src/main/scala/org/joda/time/chrono/ZonedChronology.scala | Scala | bsd-2-clause | 19,234 |
package laws
import java.time.OffsetDateTime
import Money._
import cats._
import cats.data._
import cats.implicits._
object Payments extends Utils {
case class Account(no: String, name: String, openDate: OffsetDateTime, closeDate: Option[OffsetDateTime] = None)
case class Payment(account: Account, amount: Money,... | debasishg/pigeon | laws-tango/src/main/scala/laws/Payments.scala | Scala | apache-2.0 | 926 |
/**
* Copyright (C) 2015 Stratio (http://stratio.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 ap... | luismcl/crossdata | driver/src/main/scala/com/stratio/crossdata/driver/querybuilder/dslentities/joins.scala | Scala | apache-2.0 | 1,723 |
/*
* 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/json/JsonInferSchema.scala | Scala | apache-2.0 | 15,223 |
/*
* 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 ... | WindCanDie/spark | sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/continuous/ContinuousWriteRDD.scala | Scala | apache-2.0 | 3,915 |
package scala.slick.lifted
import annotation.implicitNotFound
import scala.slick.ast.BaseTypedType
@implicitNotFound("Cannot perform option-mapped operation\\n with type: (${P1}, ${P2}) => ${R}\\n for base type: (${B1}, ${B2}) => ${BR}")
sealed trait OptionMapper2[B1, B2, BR, P1, P2, R] extends (Column[BR] => C... | boldradius/slick | src/main/scala/scala/slick/lifted/OptionMapper.scala | Scala | bsd-2-clause | 3,781 |
package com.weez.mercury
object App {
import akka.actor._
import common._
def main(args: Array[String]): Unit = {
start(args)
}
def start(args: Array[String]) = {
val system = ActorSystem("mercury")
// use 'kill -15' (SIGTERM) or 'kill -2' (SIGINT) to terminate this application.
// do NOT u... | weeztech/weez-mercury | main/src/main/scala/com/weez/mercury/App.scala | Scala | apache-2.0 | 1,040 |
package lila.pref
import play.api.mvc.Request
// because the form structure has changed
// and the mobile app keeps sending the old format
object FormCompatLayer {
private type FormData = Map[String, Seq[String]]
def apply(req: Request[_]): FormData =
moveTo("display", List(
"animation",
"captur... | clarkerubber/lila | modules/pref/src/main/FormCompatLayer.scala | Scala | agpl-3.0 | 1,340 |
@main def Test = {
println(test(identity))
println(test(x => x))
println(test(x => { println(x); x }))
}
| som-snytt/dotty | tests/run-macros/lambda-extractor-1/Test_2.scala | Scala | apache-2.0 | 112 |
/*
* 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 ... | ArvinDevel/onlineAggregationOnSparkV2 | core/src/test/scala/org/apache/spark/shuffle/unsafe/UnsafeShuffleSuite.scala | Scala | apache-2.0 | 4,840 |
package com.kakao.cuesheet
import java.text.SimpleDateFormat
import java.util.Date
import com.kakao.cuesheet.launcher.YarnConnector
import org.apache.spark.SparkContext
import org.apache.spark.deploy.SparkHadoopUtil
import org.apache.spark.deploy.yarn.CueSheetYarnClient
import org.apache.spark.launcher.SparkLauncherH... | kakao/cuesheet | src/main/scala/com/kakao/cuesheet/CueSheet.scala | Scala | apache-2.0 | 7,064 |
/*
* Copyright (C) 2015 Stratio (http://stratio.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 app... | fjsc/sparta | sdk/src/main/scala/com/stratio/sparta/sdk/pipeline/aggregation/cube/ExpiringData.scala | Scala | apache-2.0 | 771 |
package blog.debug
import java.util.Properties
import scala.collection.JavaConversions._
import scala.collection.mutable.ListBuffer
import blog.Main
import blog.common.Util
import blog.io.TableWriter
import blog.model.Evidence
import blog.model.Model
import blog.model.Queries
import blog.sample.LWSampler
class LWDeb... | BayesianLogic/blog | src/main/scala/blog/debug/LWDebugger.scala | Scala | bsd-3-clause | 1,285 |
package fpinscala.errorhandling
sealed trait Option[+A] {
def map[B](f: A => B): Option[B] = this match {
case None => None
case Some(a) => Some(f(a))
}
def getOrElse[B>:A](default: => B): B = this match {
case None => default
case Some(a) => a
}
def flatMap[B](f: A => Option[B]): Optio... | ryo-murai/fpinscala-exercises | answers/src/main/scala/fpinscala/errorhandling/Option.scala | Scala | mit | 3,590 |
/**
* 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"... | uncleGen/aliyun-emapreduce-sdk | examples/src/main/scala/com/aliyun/emr/examples/TestOss.scala | Scala | artistic-2.0 | 1,668 |
package reductions
import scala.annotation._
import org.scalameter._
import common._
object ParallelParenthesesBalancingRunner {
@volatile var seqResult = false
@volatile var parResult = false
val standardConfig = config(
Key.exec.minWarmupRuns -> 40,
Key.exec.maxWarmupRuns -> 80,
Key.exec.benchR... | jeffreylloydbrown/classwork | ParallelProgrammingInScala/reductions/src/main/scala/reductions/ParallelParenthesesBalancing.scala | Scala | unlicense | 6,029 |
// 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... | InspurUSA/kudu | java/kudu-spark-tools/src/test/scala/org/apache/kudu/spark/tools/DistributedDataGeneratorTest.scala | Scala | apache-2.0 | 5,059 |
package edu.cmu.lti.oaqa.bagpipes.executor.uima
import org.apache.uima.UIMAFramework
import org.apache.uima.jcas.JCas
import org.apache.uima.util.CasCopier
import org.apache.uima.fit.factory.AnalysisEngineFactory
import org.apache.uima.fit.factory.JCasFactory
import edu.cmu.lti.oaqa.bagpipes.configuration.AbstractDescr... | oaqa/bagpipes | src/main/scala/edu/cmu/lti/oaqa/bagpipes/executor/uima/UimaAnnotator.scala | Scala | apache-2.0 | 1,870 |
/*
* 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 | core/src/main/scala/org/apache/spark/SparkEnv.scala | Scala | apache-2.0 | 15,952 |
package de.fosd.typechef.lexer
import java.io._
import de.fosd.typechef.conditional.{Conditional, One}
import de.fosd.typechef.featureexpr.{FeatureExprFactory, SingleFeatureExpr}
import de.fosd.typechef.lexer.LexerFrontend.{LexerError, LexerResult, LexerSuccess}
import de.fosd.typechef.{LexerToken, VALexer}
/**
* d... | mbeddr/TypeChef | PartialPreprocessor/src/test/scala/de/fosd/typechef/lexer/DifferentialTestingFramework.scala | Scala | lgpl-3.0 | 8,452 |
package nodes.util
import breeze.linalg.{DenseVector, argmax}
import workflow.Transformer
/**
* Transformer that returns the index of the largest value in the vector
*/
object MaxClassifier extends Transformer[DenseVector[Double], Int] {
override def apply(in: DenseVector[Double]): Int = argmax(in)
}
| o0neup/keystone | src/main/scala/nodes/util/MaxClassifier.scala | Scala | apache-2.0 | 308 |
package org.scalawiki.bots
import java.net.URLDecoder
import org.scalawiki.MwBot
import org.scalawiki.dto.cmd.Action
import org.scalawiki.dto.cmd.query.prop.rvprop.{Content, RvProp}
import org.scalawiki.dto.cmd.query.prop.{Prop, Revisions}
import org.scalawiki.dto.cmd.query.{Query, TitlesParam}
import org.scalawiki.d... | intracer/scalawiki | scalawiki-bots/src/main/scala/org/scalawiki/bots/ShortLinksBot.scala | Scala | apache-2.0 | 2,977 |
package org.elasticmq.persistence.sql
import org.elasticmq.persistence.CreateQueueMetadata
import org.elasticmq.util.Logging
class QueueRepository(db: DB) extends Logging {
import scalikejdbc._
implicit val session: AutoSession = AutoSession
private val tableName = SQLSyntax.createUnsafely("queue")
if (db.... | adamw/elasticmq | persistence/persistence-sql/src/main/scala/org/elasticmq/persistence/sql/QueueRepository.scala | Scala | apache-2.0 | 1,421 |
object Test extends App {
val result = "börk börk" flatMap (ch ⇒ if (ch > 127) f"&#x${ch}%04x;" else "" + ch)
println(result)
}
| som-snytt/dotty | tests/pending/run/t8091.scala | Scala | apache-2.0 | 136 |
package io.buoyant.router
import com.twitter.finagle.{Path, Service, ServiceFactory, SimpleFilter, Stack}
import com.twitter.finagle.buoyant.{Dst, EncodeResidual}
import com.twitter.finagle.mux.{Request, Response}
import com.twitter.util._
object MuxEncodeResidual extends Stack.Module1[Dst.Bound, ServiceFactory[Reque... | denverwilliams/linkerd | router/mux/src/main/scala/io/buoyant/router/MuxEncodeResidual.scala | Scala | apache-2.0 | 733 |
package scalariform.parser
import scalariform.utils.CaseClassReflector
import scalariform.utils.Range
import scalariform.lexer.Token
sealed trait AstNode extends CaseClassReflector {
def tokens: List[Token]
def firstTokenOption: Option[Token] = tokens.headOption
lazy val lastTokenOption: Option[Token] = toke... | triggerNZ/scalariform | scalariform/src/main/scala/com/danieltrinh/scalariform/parser/AstNodes.scala | Scala | mit | 18,408 |
package at.ac.tuwien.ifs.utils
/**
* Created by aldo on 31/08/16.
*/
object Profiler {
def time[T](a:() => (T)): T = {
print("Profiler: ")
val t0 = System.currentTimeMillis()
val r = a()
val t1 = System.currentTimeMillis()
println("completed in " + (t1 - t0) / 1000f + "s")
r
}
}
| aldolipani/PoolBiasEstimators | src/main/scala/at/ac/tuwien/ifs/utils/Profiler.scala | Scala | apache-2.0 | 315 |
package scorex.account
import scorex.crypto.SigningFunctionsImpl
case class PrivateKeyAccount(seed: Array[Byte], privateKey: Array[Byte], override val publicKey: Array[Byte])
extends PublicKeyAccount(publicKey) {
require(seed != null)
require(privateKey != null)
require(publicKey != null)
override val add... | beni55/Scorex-Lagonaki | scorex-basics/src/main/scala/scorex/account/PrivateKeyAccount.scala | Scala | cc0-1.0 | 549 |
import lolchat._
import lolchat.data._
import lolchat.model._
import org.scalatest.concurrent.AsyncAssertions.{Dismissals, Waiter}
import org.scalatest.concurrent.PatienceConfiguration.Timeout
import cats.syntax.all._
import scala.collection.mutable
import scala.concurrent.duration._
import scala.util.Random
class Fr... | Thangiee/League-of-Legend-Chat-Lib-Scala | lib/src/it/scala/FriendMgmtSpec.scala | Scala | mit | 2,584 |
/*
* 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/test/scala/uk/gov/hmrc/ct/accounts/frs105/boxes/AC58Spec.scala | Scala | apache-2.0 | 1,006 |
/*
* 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-http/src/main/scala/io/gatling/http/action/sse/SseConnect.scala | Scala | apache-2.0 | 2,684 |
import sbt._
object Dependencies {
val resolutionRepos = Seq(
"Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
"spray" at "http://repo.spray.io",
"spray nightly" at "http://nightlies.spray.io/"
)
val akkaVersion = "2.3.6"
val sprayVersion = "1.3.1"
val scalaVersion = "2... | hamiltont/clasp | project/Dependencies.scala | Scala | mit | 1,539 |
package com.naokia.groonga4s
package object request {
trait Request{
def toQuery: String
}
trait RequestWithBody extends Request{
def getBody: String
}
}
| naokia/groonga4s | src/main/scala/com/naokia/groonga4s/request/package.scala | Scala | apache-2.0 | 172 |
package almhirt.akkax
import akka.actor.{ Props, ActorRef, ActorPath, ActorSelection }
import almhirt.common._
import almhirt.tracking.CorrelationId
object ActorMessages {
final case class CreateChildActors(factories: Seq[ComponentFactory], returnActorRefs: Boolean, correlationId: Option[CorrelationId])
final cas... | chridou/almhirt | almhirt-core/src/main/scala/almhirt/akkax/ActorMessages.scala | Scala | apache-2.0 | 4,110 |
package com.ornithoptergames.psav
import java.io.File
import scala.util.Failure
import scala.util.Try
import scala.util.matching.Regex
import FrameInfoLoader._
import akka.actor.Actor
trait FileLoader {
def load(file: File): Try[FrameInfo]
}
object FrameInfoLoader {
val actorName = "frame-info-... | JavadocMD/anim-view | src/main/scala/com/ornithoptergames/psav/FrameInfoLoader.scala | Scala | apache-2.0 | 1,392 |
package org.fusesource.cloudmix.controller.resources
import org.fusesource.scalate.servlet.ServletRenderContext
import org.fusesource.cloudmix.common.dto.{AgentDetails, DependencyStatus, FeatureDetails, ProfileDetails}
import org.fusesource.cloudmix.common.URIs
class ViewHelper(implicit context: ServletRenderContext)... | chirino/cloudmix | org.fusesource.cloudmix.controller.webapp/src/main/scala/org/fusesource/cloudmix/controller/resources/ViewHelper.scala | Scala | agpl-3.0 | 1,614 |
/*
* 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.
*/
import scala.util.parsing.inpu... | scala/scala-parser-combinators | shared/src/test/scala/scala/util/parsing/combinator/t8879.scala | Scala | apache-2.0 | 1,188 |
package scalan.compilation.lms.cxx.sharedptr
import java.io.File
import scalan.compilation.lms.linalgebra.{LinAlgLmsBridge, LinAlgCxxShptrLmsBackend}
import scalan.{JNIExtractorOps, JNIExtractorOpsExp}
import scalan.compilation.GraphVizConfig
import scalan.compilation.lms.JNILmsBridge
import scalan.compilation.lms.cx... | scalan/scalan | lms-backend/linear-algebra/src/it/scala/scalan/compilation/lms/cxx/sharedptr/JNILinAlgItTests.scala | Scala | apache-2.0 | 1,907 |
/**
* Copyright 2012 Foursquare Labs, 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 appli... | non/linter | src/main/scala/LinterPlugin.scala | Scala | apache-2.0 | 3,909 |
/*
* Copyright (C) 2005, The Beangle Software.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This... | beangle/data | jdbc/src/main/scala/org/beangle/data/jdbc/query/JdbcExecutor.scala | Scala | lgpl-3.0 | 6,704 |
/*
* 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... | MLnick/spark | sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala | Scala | apache-2.0 | 28,505 |
/*
* 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.collection.mutab... | scala/scala | src/library/scala/collection/mutable/Seq.scala | Scala | apache-2.0 | 1,739 |
object Test {
def main(args: Array[String]): Unit = {
class Foo(val a: Int, val b: Int, val c: Int)
import scala.reflect.runtime.{currentMirror => cm}
val decls = cm.classSymbol(classOf[Foo]).info.decls
decls.sorted.toList.filter(!_.isMethod) foreach System.out.println
}
}
| folone/dotty | tests/pending/run/reflection-sorted-decls.scala | Scala | bsd-3-clause | 295 |
package com.blinkbox.books.purchasetransformer
import com.blinkbox.books.messaging.Xml._
import com.blinkbox.books.messaging.EventHeader
import java.io.ByteArrayInputStream
import scala.util.{ Try, Success, Failure }
import scala.xml.{ XML, Node }
import scala.xml.NodeSeq
// Code to convert incoming message to case c... | blinkboxbooks/purchase-transformer.scala | src/main/scala/com/blinkbox/books/purchasetransformer/Purchase.scala | Scala | mit | 2,224 |
/*
* Copyright (c) 2016, Innoave.com
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN... | haraldmaida/ScalaTestFX | scalatestfx/src/main/scala/io/scalatestfx/framework/scalatest/ApplicationAdapter.scala | Scala | apache-2.0 | 1,240 |
package cogdebugger.coggui3ports
import org.interactivemesh.scala.swing.InternalFrame
/**
* This event is used to signal that a ProbeFrame has sized itself and is
* ready for display. This is important for the probe desktop's window tiler,
* as it can't know where to place a ProbeFrame until the frame's final siz... | hpe-cct/cct-core | src/main/scala/cogdebugger/coggui3ports/FramePackedEvent.scala | Scala | apache-2.0 | 430 |
/*
* Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.sbt.run
import com.lightbend.lagom.dev.Reloader
import com.lightbend.lagom.dev.Reloader.{ CompileFailure, CompileResult, CompileSuccess, Source }
import com.lightbend.lagom.sbt.Internal
import com.lightbend.lagom.s... | edouardKaiser/lagom | dev/sbt-plugin/src/main/scala/com/lightbend/lagom/sbt/run/RunSupport.scala | Scala | apache-2.0 | 6,516 |
case class HasSingleField(f: HasSingleField)
object Test {
def main(args: Array[String]) = {
val s: Object = HasSingleField(null)
s match {
case Matcher(self) =>
assert(self ne null)
}
}
}
object Matcher {
def unapply(x: Object): Option[HasSingleField] = {
if (x.isInstanceOf[HasSin... | densh/dotty | tests/run/patmat-option-named.scala | Scala | bsd-3-clause | 401 |
package pkg
import scala.collection.mutable
import scala.collection.mutable.ListBuffer
object Test {
// imports need special handling
val lb1: ListBuffer[Int] = null
val lb2: mutable.ListBuffer[Int] = null
def main(args: Array[String]): Unit = {
val world = Hello("World")
println(s"Hello ${world.name... | sschaef/tooling-research | sbt-plugin/src/sbt-test/sbt-amora/scala_2_11_8/src/main/scala/pkg/Test.scala | Scala | mit | 539 |
package gitbucket.core.view
import gitbucket.core.controller.Context
import gitbucket.core.service.RepositoryService.RepositoryInfo
import org.scalatest.FunSpec
import org.scalatest.mockito.MockitoSugar
class HelpersSpec extends FunSpec with MockitoSugar {
private implicit val context = mock[Context]
private val... | nobusugi246/gitbucket | src/test/scala/gitbucket/core/view/HelpersSpec.scala | Scala | apache-2.0 | 2,471 |
package com.shekhargulati.medium
import com.shekhargulati.medium.MediumApiProtocol._
import com.shekhargulati.medium.domainObjects._
import okhttp3.FormBody.Builder
import okhttp3._
import spray.json._
class MediumClient(clientId: String, clientSecret: String, var accessToken: Option[String] = None) {
val client =... | shekhargulati/medium-scala-sdk | src/main/scala/com/shekhargulati/medium/MediumClient.scala | Scala | apache-2.0 | 6,846 |
import scala.math.{ pow, sqrt, log10 }
val phi: Double = 1.61803398874989484820458683436563811772030917980576
def digitsInFib(n: Int): Int = {
(n * log10(phi) - log10(sqrt(5)) + 1.0).toInt
}
val q = Iterator.from(1).collectFirst { case n if digitsInFib(n) >= 1000 => n }
println(q.get)
| natw/project-euler | 25.scala | Scala | apache-2.0 | 292 |
package org.opencommercesearch.api.common
/*
* Licensed to OpenCommerceSearch under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. OpenCommerceSearch licenses this
* file to you under the Apache License, Version... | madickson/opencommercesearch | opencommercesearch-api/app/org/opencommercesearch/api/common/FieldList.scala | Scala | apache-2.0 | 2,346 |
/******************************************************************************
Copyright (c) 2012-2014, KAIST, S-Core.
All rights reserved.
Use is subject to license terms.
This distribution may include materials developed by third parties.
**********************************************************... | darkrsw/safe | src/main/scala/kr/ac/kaist/jsaf/bug_detector/CommonDetect.scala | Scala | bsd-3-clause | 7,917 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | pgandhi999/spark | sql/catalyst/src/test/scala/org/apache/spark/sql/types/TestUDT.scala | Scala | apache-2.0 | 2,211 |
package parsec
trait HListParsers
extends HListParsable
with HListProjectable
with HListBoolean
with Parsers
with RepetitionParsers
| manojo/parsequery | macros/src/main/scala/parsec/HListParsers.scala | Scala | mit | 156 |
package org.jetbrains.plugins.scala
import com.intellij.openapi.application.WriteAction
import com.intellij.openapi.module.Module
import com.intellij.openapi.project.Project
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.util.ThrowableRunnable
/**
* Nikolay.Tropin
* 22-Sep-17
*/
ab... | jastice/intellij-scala | scala/scala-impl/test/org/jetbrains/plugins/scala/DelegatingProjectDescriptor.scala | Scala | apache-2.0 | 1,269 |
/*
* Copyright 2015 Marconi Lanna
*
* 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... | MaxWorgan/talk | src/main/scala/REPLesent.scala | Scala | apache-2.0 | 16,552 |
package org.scalaide.extensions
package autoedits
import org.eclipse.jface.text.IRegion
import org.scalaide.core.text.Add
import org.scalaide.core.text.Replace
import org.scalaide.util.eclipse.RegionUtils._
import scalariform.lexer._
object SurroundBlockSetting extends AutoEditSetting(
id = ExtensionSetting.fullyQ... | aleksi-lukkarinen/scala-ide | org.scala-ide.sdt.core/src/org/scalaide/extensions/autoedits/SurroundBlock.scala | Scala | bsd-3-clause | 4,213 |
package com.twitter.finagle.netty4.channel
import com.twitter.finagle.stats.InMemoryStatsReceiver
import io.netty.channel._
import io.netty.util.{AttributeKey, Attribute}
import java.util.concurrent.atomic.AtomicInteger
import org.junit.runner.RunWith
import org.mockito.Mockito.when
import org.scalatest.FunSuite
impor... | adriancole/finagle | finagle-netty4/src/test/scala/com/twitter/finagle/netty4/channel/ChannelRequestStatsHandlerTest.scala | Scala | apache-2.0 | 2,064 |
package controllers
import akka.actor.ActorSystem
import akka.stream.Materializer
import com.google.inject.Inject
import play.api.mvc._
import shared.SharedMessages
import play.api.libs.streams.ActorFlow
import sparkConn.{SparkCommon, TwitterStreamer}
import sparkStream._
class Application @Inject() (implicit system:... | gvatn/play-scalajs-webgl-spark | server/app/controllers/Application.scala | Scala | mit | 1,605 |
package com.yuzhouwan.bigdata.spark.streaming
import breeze.linalg.DenseVector
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.mllib.regression.{LabeledPoint, StreamingLinearRegressionWithSGD}
import org.apache.spark.storage.StorageLevel
import org.apache.spark.streaming._
/**
* Copyright @ 201... | asdf2014/yuzhouwan | yuzhouwan-bigdata/yuzhouwan-bigdata-spark/src/main/scala/com/yuzhouwan/bigdata/spark/streaming/MLAnalysis.scala | Scala | apache-2.0 | 2,166 |
/*
* 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 ... | xieguobin/Spark_2.0.0_cn1 | mllib/linalg/distributed/CoordinateMatrix.scala | Scala | apache-2.0 | 6,257 |
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/*
*/
abstract class Node
case class LeafNode(data: String, counter: Int) exten... | jaimeguzman/learning | lala.scala | Scala | apache-2.0 | 3,948 |
package controllers.authentication
import akka.util.Timeout
import scala.concurrent.Await
import scala.concurrent.duration._
import org.scalatest._
import org.scalatest.mock.MockitoSugar
import org.specs2.time.DurationConversions
import play.api.Logger
import play.api.libs.json._
import play.api.test._
import play.... | Braffa/sellem-mongodb | test/controllers/authentication/RegisteredUserControllerSpec.scala | Scala | mit | 1,580 |
package org.jetbrains.plugins.scala.refactoring.extractMethod
package generated
class ScalaExtractMethodSimpleTest extends ScalaExtractMethodTestBase {
//This class was generated by build script, please don't change this
override def folderPath: String = super.folderPath + "simple/"
def testElementCreatedInside... | igrocki/intellij-scala | test/org/jetbrains/plugins/scala/refactoring/extractMethod/generated/ScalaExtractMethodSimpleTest.scala | Scala | apache-2.0 | 537 |
package org.jetbrains.plugins.scala.debugger.evaluation.evaluator
import com.intellij.debugger.JavaDebuggerBundle
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl
import com.intellij.debugger.engine.evaluation.expression.Evaluator
import com.intellij.debugger.impl.DebuggerUtilsImpl
import com.sun.j... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/debugger/evaluation/evaluator/AsInstanceOfEvaluator.scala | Scala | apache-2.0 | 3,690 |
package org.scaladebugger.test.invalid
/**
* Represents a scenario where the package and class names do not match the
* source path.
*/
object InvalidSourcePath {
def main(args: Array[String]): Unit = {
val c = new InvalidSourcePathClass
val x = 1 + 1
val y = c.getClass.getName
x + y
}
}
clas... | ensime/scala-debugger | scala-debugger-test/src/main/scala/org/scaladebugger/test/misc/InvalidSourcePath.scala | Scala | apache-2.0 | 345 |
/*
* Copyright 2021 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/gmp-frontend | app/models/CalculationRequest.scala | Scala | apache-2.0 | 1,337 |
/*
* 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 ... | dotunolafunmiloye/spark | core/src/main/scala/org/apache/spark/broadcast/TorrentBroadcast.scala | Scala | apache-2.0 | 7,869 |
package com.rasterfoundry.datamodel
import io.circe.generic.JsonCodec
@JsonCodec
final case class ActiveStatus(isActive: Boolean)
| azavea/raster-foundry | app-backend/datamodel/src/main/scala/ActiveStatus.scala | Scala | apache-2.0 | 132 |
package com.yukihirai0505.sInstagram.responses.auth
import com.yukihirai0505.sInstagram.utils.Configurations.clientSecret
sealed trait Auth
case class AccessToken(token: String) extends Auth
case class SignedAccessToken(token: String, clientSecret: String = clientSecret) extends Auth
| yukihirai0505/sInstagram | src/main/scala/com/yukihirai0505/sInstagram/responses/auth/Auth.scala | Scala | mit | 289 |
object Foo {
object Values {
implicit def fromInt(x: Int): Values = ???
}
trait Values
}
final class Foo(name: String) {
def bar(values: Foo.Values): Bar = ???
}
trait Bar
| yusuke2255/dotty | tests/untried/pos/t7264/A_1.scala | Scala | bsd-3-clause | 185 |
/*
* Copyright (c) 2015-2017 Toby Weston
*
* 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... | tobyweston/learn-scala-java-devs | src/main/scala/s4j/scala/chapter17/ThreadExample.scala | Scala | apache-2.0 | 3,502 |
package org.akka.essentials.dispatcher
import akka.actor.Actor
class MsgEchoActor extends Actor {
var messageProcessed:Int = 0
def receive: Receive = {
case message =>
messageProcessed = messageProcessed + 1
println(
"Received Message %s in Actor %s using Thread %s, total message processed %s".format( m... | rokumar7/trial | AkkaDispatcherExample/src/main/scala/org/akka/essentials/dispatcher/MsgEchoActor.scala | Scala | unlicense | 405 |
package services
import java.nio.charset.StandardCharsets
import java.util.Base64
object StringService {
def base64Encode(string: String): String = {
Base64.getEncoder.encodeToString(string.getBytes(StandardCharsets.UTF_8))
}
}
| PanzerKunst/redesigned-cruited.com-frontend | document-web-service/app/services/StringService.scala | Scala | gpl-3.0 | 242 |
package controllers
/**
* Created by Ravis on 06/04/15.
*/
import play.api.mvc._
import models.db.{SearchQueries, SearchResult}
object SearchController extends Controller {
def search(title: Option[String], disc: Option[String], fio: Option[String]) = Action {
val result: List[SearchResult] = SearchQueries.q... | RavisMsk/Design-Tech-Home-Task | app/controllers/SearchController.scala | Scala | mit | 460 |
package com.arcusys.valamis.lesson.model
object PackageActivityType extends Enumeration{
val Published, Shared, Completed = Value
}
| igor-borisov/valamis | valamis-lesson/src/main/scala/com/arcusys/valamis/lesson/model/PackageActivityType.scala | Scala | gpl-3.0 | 135 |
package com.github.chawasit.smc.simulator
import java.io.{File, PrintWriter}
import scala.io.Source
object Main extends App {
override def main(args: Array[String]): Unit = {
val arguments = new ArgumentConfiguration(args)
try {
val instructions = readFile(arguments.input())
val tu... | chawasit/Scala-SMC-Simulator | src/main/scala/com/github/chawasit/smc/simulator/Main.scala | Scala | unlicense | 1,009 |
def upCase: String => Writer[String, String] =
s => Writer(s.toUpperCase, "upCase ") | hmemcpy/milewski-ctfp-pdf | src/content/3.4/code/scala/snippet19.scala | Scala | gpl-3.0 | 86 |
package cgta.oscala
package util
import scala.collection.mutable.ListBuffer
import scala.annotation.tailrec
import scala.util.control.NonFatal
//////////////////////////////////////////////////////////////
// Copyright (c) 2014 Ben Jackman
// All Rights Reserved
// please contact ben@jackman.biz
// for licensing inq... | cgta/open | oscala/shared/src/main/scala/cgta/oscala/util/StackTracer.scala | Scala | mit | 1,275 |
package algebra
package ring
import scala.{specialized => sp}
/**
* Rig consists of:
*
* - a commutative monoid for addition (+)
* - a monoid for multiplication (*)
*
* Alternately, a Rig can be thought of as a ring without
* multiplicative or additive inverses (or as a semiring with a
* multiplicative iden... | tixxit/algebra | core/src/main/scala/algebra/ring/Rig.scala | Scala | mit | 638 |
import scala.collection.mutable.WeakHashMap
import scala.collection.JavaConversions.*
class bar { }
class foo {
val map = WeakHashMap[AnyRef, collection.mutable.Map[bar, collection.mutable.Set[bar]]]()
def test={
val tmp:bar=null
if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set())
}
}
| dotty-staging/dotty | tests/untried/neg/t5580b.scala | Scala | apache-2.0 | 315 |
package com.sorrentocorp.akka.stream
import akka.util.ByteString
import scala.util._
/** Tries to match a ByteString literal. */
class Expect(val prefix: ByteString) {
require(!prefix.isEmpty)
val prefixLen = prefix.size
private var buffer: ByteString = ByteString.empty
def offer(input: ByteString): Unit = b... | Kai-Chen/streaming-json-parser | src/main/scala/com/sorrentocorp/akka/stream/Expect.scala | Scala | mit | 724 |
/*
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... | oeddyo/scalding | scalding-core/src/main/scala/com/twitter/scalding/RichFlowDef.scala | Scala | apache-2.0 | 4,403 |
package net.sansa_stack.rdf.common.partition.core
import net.sansa_stack.rdf.common.partition.layout.{TripleLayout, TripleLayoutDouble, TripleLayoutLong, TripleLayoutString, TripleLayoutStringDate, TripleLayoutStringLang}
import org.apache.jena.datatypes.TypeMapper
import org.apache.jena.datatypes.xsd.XSDDatatype
impo... | SANSA-Stack/Spark-RDF | sansa-rdf-common/src/main/scala/net/sansa_stack/rdf/common/partition/core/RdfPartitionerDefault.scala | Scala | gpl-3.0 | 4,179 |
package relationshipextractor
import org.easyrules.api._
import org.easyrules.core._
class MyListener extends RuleListener {
override def beforeExecute(rule: Rule) {
println("beforeExecute")
}
override def onSuccess(rule: Rule) {
println("onSuccess")
}
override def onFailure(rule: Rule, exception:... | ErikGartner/relationship-extractor | src/main/scala/relationshipextractor/RuleLauncher.scala | Scala | apache-2.0 | 901 |
package org.apache.spark.ml.mleap.feature
import ml.combust.mleap.core.feature.MultinomialLabelerModel
import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.ml.Transformer
import org.apache.spark.ml.linalg.{Vector, VectorUDT}
import org.apache.spark.ml.mleap.param.{HasLabelsCol, HasProbabilitiesCol}
... | combust/mleap | mleap-spark-extension/src/main/scala/org/apache/spark/ml/mleap/feature/MultinomialLabeler.scala | Scala | apache-2.0 | 2,414 |
package org.scurator
import java.util.concurrent.TimeUnit
import org.apache.curator.framework.CuratorFramework
import org.apache.curator.framework.imps.CuratorFrameworkState
import org.apache.zookeeper.KeeperException.NoNodeException
import org.apache.zookeeper.data.Stat
import org.scurator.components._
import scala... | granthenke/scurator | src/main/scala/org/scurator/SCuratorClient.scala | Scala | apache-2.0 | 12,074 |
package model.dtos
case class ConsultationsPerMonth (date:String, numberOfConsultations: Int, cons_ids:String)
| scify/DemocracIT-Web | app/model/dtos/ConsultationsPerMonth.scala | Scala | apache-2.0 | 112 |
package dit4c.scheduler.domain
import akka.actor._
object Cluster {
def props(clusterInfo: Option[ClusterInfo], defaultConfigProvider: ConfigProvider): Props =
Props(classOf[Cluster], clusterInfo, defaultConfigProvider)
trait Command extends BaseCommand
case object GetState extends Command
trait Respon... | dit4c/dit4c | dit4c-scheduler/src/main/scala/dit4c/scheduler/domain/Cluster.scala | Scala | mit | 1,862 |
/* sbt -- Simple Build Tool
* Copyright 2010 Mark Harrah
*/
package sbt
import std._
import xsbt.api.{Discovered,Discovery}
import inc.Analysis
import TaskExtra._
import Types._
import xsbti.api.Definition
import ConcurrentRestrictions.Tag
import org.scalatools.testing.{AnnotatedFingerprint, Fingerprint, F... | kuochaoyi/xsbt | main/actions/Tests.scala | Scala | bsd-3-clause | 8,679 |
package scala.tools.nsc
package interactive
package tests.core
import scala.reflect.internal.util.Position
/** Set of core test definitions that are executed for each test run. */
private[tests] trait CoreTestDefs
extends PresentationCompilerRequestsWorkingMode {
import scala.tools.nsc.interactive.Global
/** A... | felixmulder/scala | src/interactive/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala | Scala | bsd-3-clause | 5,109 |
package napplelabs.swish.example
import napplelabs.swish._
object Simple {
def main(args: Array[String]) = {
val sc = new ServerConfig(user = "zkim")
Swish.withServer(sc) {
conn =>
val commandResponse = conn.exec("ls -aul")
println("Exit Value: " + commandResp... | zk/swish-scala | src/test/scala/napplelabs/swish/example/Simple.scala | Scala | mit | 412 |
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.