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.tribbloids.spookystuff.session
import com.tribbloids.spookystuff.utils.lifespan.Cleanable
import com.tribbloids.spookystuff.utils.{CommonUtils, TreeThrowable}
import scala.util.Try
/**
* Created by peng on 14/01/17.
*/
trait ConflictDetection extends Cleanable {
def _resourceIDs: Map[String, Set[_... | tribbloid/spookystuff | core/src/main/scala/com/tribbloids/spookystuff/session/ConflictDetection.scala | Scala | apache-2.0 | 2,076 |
package play.api.data
import scala.language.existentials
import format._
import validation._
/**
* Helper to manage HTML form description, submission and validation.
*
* For example, a form handling a `User` case class submission:
* {{{
* import play.api.data._
* import play.api.data.Forms._
* import play.api... | vangav/vos_backend | play-2.2.6/framework/src/play/src/main/scala/play/api/data/Form.scala | Scala | mit | 28,025 |
/***********************************************************************
* Copyright (c) 2013-2017 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... | ronq/geomesa | geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/data/TableSharingTest.scala | Scala | apache-2.0 | 6,253 |
package utils.testhelpers
import models.storage.event.EventType
import models.storage.event.EventTypeRegistry.TopLevelEvents._
import models.storage.event.control.Control
import models.storage.event.control.ControlAttributes.{
ControlAlcohol,
ControlCleaning,
ControlPest,
ControlTemperature
}
import models.sto... | kpmeen/musit | service_storagefacility/test/utils/testhelpers/EventGenerators.scala | Scala | gpl-2.0 | 7,759 |
package breeze
/**
*
* @author dlwh
*/
package object optimize {
def minimize[Objective, Vector](fn: Objective,
init: Vector,
options: OptimizationOption*)(implicit optimization: OptimizationPackage[Objective,Vector]) = {
optimization.minimize(... | wavelets/breeze | src/main/scala/breeze/optimize/package.scala | Scala | apache-2.0 | 348 |
package $package$
import android.os.Bundle
import android.app.Activity
import android.widget.TextView
class MainActivity extends Activity with TypedActivity {
override def onCreate(bundle: Bundle) {
super.onCreate(bundle)
setContentView(R.layout.main)
findView(TR.textview).setText("hello, world!")
}
}... | ikuo/android-app-scala.g8 | src/main/g8/src/main/scala/$package$/$mainActivity$.scala | Scala | mit | 321 |
/**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... | VinACE/adam | adam-core/src/test/scala/org/bdgenomics/adam/io/InterleavedFastqInputFormatSuite.scala | Scala | apache-2.0 | 2,080 |
/*
* 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 ... | jatin9896/incubator-carbondata | integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CarbonScalaUtil.scala | Scala | apache-2.0 | 26,094 |
/**
* Copyright (C) 2012 Typesafe, Inc. <http://www.typesafe.com>
*/
package org.pantsbuild.zinc.options
import java.io.File
import scala.annotation.tailrec
/**
* Parsing command-line options, immutably.
*/
object Options {
def parse[Context](context: Context, options: Set[OptionDef[Context]], args: Seq[String... | fkorotkov/pants | src/scala/org/pantsbuild/zinc/options/Options.scala | Scala | apache-2.0 | 8,289 |
package composition.webserviceclients.audit2
import com.tzavellas.sse.guice.ScalaModule
import org.mockito.Matchers.any
import org.mockito.Mockito.when
import org.scalatest.mock.MockitoSugar
import scala.concurrent.Future
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.TrackingId
import webservicecli... | dvla/vrm-assign-online | test/composition/webserviceclients/audit2/AuditMicroServiceCallFails.scala | Scala | mit | 898 |
/*
* Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.api.tools.tests.scaladsl
import akka.NotUsed
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.Descriptor
import com.lightbend.lagom.scaladsl.api.Service
import com.l... | rcavalcanti/lagom | api-tools/src/test/scala/com/lightbend/lagom/api/tools/tests/scaladsl/UndescribedService.scala | Scala | apache-2.0 | 816 |
/*
* 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/rdd/PipedRDDSuite.scala | Scala | apache-2.0 | 8,086 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | tophua/spark1.52 | core/src/main/scala/org/apache/spark/deploy/DriverDescription.scala | Scala | apache-2.0 | 1,465 |
package io.netflow.storage.redis
import io.netflow.flows.cflow._
import io.netflow.lib._
private[netflow] object NetFlowV7Packet extends FlowPacketMeta[NetFlowV7Packet] {
def persist(fp: NetFlowV7Packet): Unit = ()
} | ayscb/netflow | netflow1/netflow-master/src/main/scala/io/netflow/storage/redis/NetFlowV7Packet.scala | Scala | apache-2.0 | 220 |
/*
* Copyright (c) 2014 Paul Bernard
*
* 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... | quantintel/spectrum | financial/src/main/scala/org/quantintel/ql/time/calendars/Target.scala | Scala | apache-2.0 | 3,050 |
package com.github.tonivade.buildtiful
import Config._
trait Downloader {
def download(build: Build) : Unit
}
class IvyDownloader extends Downloader {
import IvyTasks._
def download(build: Build) {
println("download")
if (!libs.exists()) libs.mkdirs()
ivyDownload(build).execute()
}
} | tonivade/buildtiful | src/main/scala/Downloader.scala | Scala | mit | 316 |
package gitbucket.core.controller
import gitbucket.core.admin.html
import gitbucket.core.service.{AccountService, SystemSettingsService}
import gitbucket.core.util.AdminAuthenticator
import gitbucket.core.ssh.SshServer
import SystemSettingsService._
import jp.sf.amateras.scalatra.forms._
class SystemSettingsControlle... | intermezzo-fr/gitbucket | src/main/scala/gitbucket/core/controller/SystemSettingsController.scala | Scala | apache-2.0 | 4,228 |
/**
* Copyright (C) 2017 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This program i... | orbeon/orbeon-forms | common/shared/src/test/scala/org/orbeon/oxf/util/ContentTypesTest.scala | Scala | lgpl-2.1 | 2,120 |
/*
* The MIT License
*
* Copyright (c) 2019 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/fgbio | src/test/scala/com/fulcrumgenomics/cmdline/IntelCompressionTest.scala | Scala | mit | 5,207 |
package se.apogo.kdom.api.model
import org.json4s.NoTypeHints
import org.json4s.jackson.Serialization
trait JsonSerializable {
import org.json4s.native.JsonMethods._
implicit val formats = Serialization.formats(NoTypeHints)
def toJson: String = {
val json = Serialization.writePretty(this)
pretty(render(... | mratin/kdom | src/main/scala/se/apogo/kdom/api/model/JsonSerializable.scala | Scala | mit | 447 |
/* Copyright 2014 UniCredit S.p.A.
*
* 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... | unicredit/hippodb | http/src/main/scala/unicredit/hippo/Main.scala | Scala | apache-2.0 | 1,354 |
package com.sothr.imagetools.engine.util
import java.io.{File, FileOutputStream, PrintStream}
import java.util.Properties
import com.typesafe.config.{Config, ConfigFactory, ConfigRenderOptions}
import grizzled.slf4j.Logging
/*
* Service for loading and interacting with the properties file
*/
object PropertiesServi... | warricksothr/ImageTools | engine/src/main/scala/com/sothr/imagetools/engine/util/PropertiesService.scala | Scala | mit | 4,359 |
package scalaxy.evidence
package test
import org.scalamock.scalatest.MockFactory
import org.scalatest.{ FlatSpecLike, Matchers }
import scala.reflect.runtime.universe._
import scala.tools.reflect.ToolBoxError
class PersistenceExampleTest extends FlatSpecLike with Matchers with MockFactory {
behavior of "scalaxy.e... | nativelibs4java/scalaxy-evidence | src/test/scala/PersistenceExampleTest.scala | Scala | bsd-3-clause | 1,297 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | dotunolafunmiloye/spark | yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala | Scala | apache-2.0 | 16,647 |
import java.util.{Calendar, GregorianCalendar}
import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}
import scala.collection.mutable.ArrayBuffer
import scala.util.Random
import scala.collection.JavaConverters._
/**
* Created by ylu on 9/26/16.
*/
object spark_join {
var lineitem = "... | mitdbg/AdaptDB | spark-partitioner/src/main/scala/spark_join.scala | Scala | mit | 2,027 |
package controllers
import java.util.UUID
import com.google.inject.AbstractModule
import com.mohiva.play.silhouette.api.{ Environment, LoginInfo }
import com.mohiva.play.silhouette.impl.authenticators.CookieAuthenticator
import com.mohiva.play.silhouette.test._
import models.User
import net.codingwell.scalaguice.Scal... | renexdev/Silhouette-Slick-Seed-pg-jwt | test/controllers/ApplicationControllerSpec.scala | Scala | apache-2.0 | 2,806 |
package org.jetbrains.plugins.scala.lang.psi.api.base
import org.jetbrains.plugins.scala.lang.psi.api.ScalaPsiElement
import org.jetbrains.plugins.scala.lang.refactoring.util.ScalaNamesUtil
/** Generic infix operation, covers infix types, patterns, and expressions.
*
* @author Clément Fournier
*/
trait ScInfixE... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/lang/psi/api/base/ScInfixElement.scala | Scala | apache-2.0 | 839 |
package com.alanjz.microstrike
import java.awt.Point
import java.awt.geom.Point2D
import com.alanjz.microstrike.team.Team
class Player(val name : String, val team : Team) {
private val _point = new Point2D.Double()
private var _health = 0
private var _armor = 0
def point = new Point(x,y)
def health = _he... | spacenut/microstrike | src/com/alanjz/microstrike/Player.scala | Scala | gpl-2.0 | 972 |
package edu.mit.cryptdb
import java.io.{ File, PrintWriter }
import scala.collection.mutable.{ ArrayBuffer, HashSet, HashMap, Seq => MutSeq }
// these are the onions which a plan cost has to
// be concerned about (b/c it does seq scans over these relations),
// except it does NOT use these onions (so it is the non-co... | tristartom/monomi-optimizer | src/main/scala/formulator.scala | Scala | mit | 37,781 |
package io.cumulus.utils
import scala.util.Try
import akka.util.ByteString
import com.google.common.io.BaseEncoding
object Base16 {
/**
* Encode in base 16 the provided bytes.
*
* @param bytes The bytes to encode.
* @return The encoded bytes.
*/
def encode(bytes: ByteString): String =
B... | Cumulus-Cloud/cumulus | server/cumulus-core/src/main/scala/io/cumulus/utils/Base64.scala | Scala | mit | 1,613 |
/**
* Copyright 2014 André Rouél
*
* 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... | before/uadetector-scala | src/main/scala/com/github/before/uadetector/UserAgent.scala | Scala | apache-2.0 | 967 |
package apps
/** The `state` package contains example applications for state oriented
* simulation models.
*/
package object state { }
| NBKlepp/fda | scalation_1.3/scalation_models/src/main/scala/apps/state/package.scala | Scala | mit | 142 |
/**
* 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... | sslavic/kafka | core/src/main/scala/kafka/server/MetadataCache.scala | Scala | apache-2.0 | 18,603 |
package com.artclod.mathml.scalar.apply
import com.artclod.mathml._
import com.artclod.mathml.scalar._
import com.artclod.mathml.scalar.concept.Constant
import scala.util._
case class ApplyDivide(val numerator: MathMLElem, val denominator: MathMLElem)
extends MathMLElem(MathML.h.prefix, "apply", MathML.h.attributes... | kristiankime/web-education-games | app/com/artclod/mathml/scalar/apply/ApplyDivide.scala | Scala | mit | 1,693 |
object Test {
def main(args: Array[String]) {
val y: AA[Int] = C(2)
val c: Int = y.x.y
assert(c == 2)
}
}
trait AA[T] extends Any {
def x: C[T]
}
case class C[T](val y: T) extends AnyVal with AA[T] {
def x = this
}
| felixmulder/scala | test/files/run/t6385.scala | Scala | bsd-3-clause | 245 |
package io.finch.refined
import eu.timepit.refined.api.Refined
import eu.timepit.refined.cats._
import eu.timepit.refined.collection.NonEmpty
import eu.timepit.refined.numeric.Positive
import eu.timepit.refined.scalacheck.all._
import io.finch.{DecodeEntityLaws, FinchSpec}
class DecodeEntityRefinedSpec extends FinchS... | finagle/finch | refined/src/test/scala/io/finch/refined/DecodeEntityRefinedSpec.scala | Scala | apache-2.0 | 522 |
/*
* SimpleGUI.scala
* (FScape)
*
* Copyright (c) 2001-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* contact@sciss.de
*/
package de.sciss.fscape.gui
impor... | Sciss/FScape-next | core/jvm/src/main/scala/de/sciss/fscape/gui/SimpleGUI.scala | Scala | agpl-3.0 | 2,397 |
import scala.concurrent._
import scala.util._
import ExecutionContext.Implicits.global
object Main extends App {
def getData1() = {
for (i <- 1 to 10) {
Thread.sleep(100);
print("1...")
}
val result = Random.nextInt(10)
println(result)
result
}
def getData2() = {
for (i <- 1 ... | yeahnoob/scala-impatient-2e-code | src/ch17/sec08/sec07/Promises.scala | Scala | gpl-3.0 | 1,578 |
package fpinscala.iomonad
/**
* A trampolined computation producing an `A` that may include
* asynchronous steps. See constructors in companion object.
*/
trait Future[+A] {
import Future._
/*
Exercise 11: Implement `Monad[Future]`. We will need it to implement
our nonblocking ... | fpinscala-muc/fpinscala-ivpdev | answers/src/main/scala/fpinscala/iomonad/Future.scala | Scala | mit | 4,628 |
/*
* Copyright (C) 2016 Nikos Katzouris
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is d... | nkatzz/OLED | src/main/scala/oled/weightlearn/MAPInference.scala | Scala | gpl-3.0 | 5,163 |
package unfiltered.response.link
object Param {
/** Predefined parameter types as specified in
[[http://tools.ietf.org/html/rfc5988#section-5 section-5]]. Note that
`rev` is omitted as it has been deprecated by the specification. */
sealed abstract class Type(val name: String)
case object Rel extends... | beni55/unfiltered | library/src/main/scala/response/link/Param.scala | Scala | mit | 7,787 |
package com.yetu.oauth2provider.browser
import com.yetu.oauth2provider.controllers.setup.SetupController._
class SetupRegistrationBrowserSpec extends BaseBrowserSpec {
val fullSetupRegistrationUrl = s"http://localhost:$port$setupRegistrationUrl"
val fullSetupConfirmMailUrl = s"http://localhost:$port$setupConfirm... | yetu/oauth2-provider | test/com/yetu/oauth2provider/browser/SetupRegistrationBrowserSpec.scala | Scala | mit | 3,697 |
/*
* Copyright (c) 2014-2015 by its authors. Some rights reserved.
* See the project homepage at: http://www.monifu.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://... | sergius/monifu | monifu/shared/src/test/scala/monifu/reactive/channels/AsyncChannelSuite.scala | Scala | apache-2.0 | 3,930 |
package scavlink.coord
/**
* Base trait for 3D coordinates.
*/
trait XYZ[T] {
def x: T
def y: T
def z: T
def toVector = Vector(x, y, z)
override def toString = s"($x,$y,$z)"
}
| nickolasrossi/scavlink | src/main/scala/scavlink/coord/XYZ.scala | Scala | mit | 189 |
package ems.storage
import scala.util.control.Exception.nonFatalCatch
import com.mongodb.casbah.Imports._
import ems._
import security.User
import java.util
import util.UUID
import model._
import org.joda.time.DateTime
import com.mongodb.casbah.commons.MongoDBObject
trait MongoDBStorage {
import com.mongodb.casbah... | chrissearle/ems-redux | src/main/scala/ems/storage/MongoDBStorage.scala | Scala | apache-2.0 | 9,655 |
/*
* @author Flavio Keller
*
* Copyright 2014 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
*
* ... | fkzrh/signal-collect-sna | src/main/scala/com/signalcollect/sna/metrics/PageRank.scala | Scala | apache-2.0 | 6,150 |
package me.reminisce.testutils
import java.util.concurrent.TimeUnit
import reactivemongo.api.Cursor
import reactivemongo.api.collections.bson.BSONCollection
import reactivemongo.bson.{BSONDocument, BSONDocumentReader}
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scal... | reminisceme/stats | src/test/scala/me/reminisce/testutils/Retry.scala | Scala | apache-2.0 | 2,163 |
package chandu0101.scalajs.react.components
package semanticui
import chandu0101.macros.tojs.JSMacro
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.VdomElement
import scala.scalajs.js
import scala.scalajs.js.`|`
/**
* This file is generated - submit issues instead of PR against it
*/
case clas... | rleibman/scalajs-react-components | core/src/main/scala/chandu0101/scalajs/react/components/semanticui/SuiFormCheckbox.scala | Scala | apache-2.0 | 989 |
package com.twitter.finagle.stats
import com.twitter.common.metrics.Metrics
import org.jboss.netty.handler.codec.http.HttpHeaders
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.FunSuite
import scala.util.matching.Regex
import com.twitter.finagle.http.{MediaType, Response, R... | LithiumTD/finagle | finagle-stats/src/test/scala/com/twitter/finagle/stats/JsonExporterTest.scala | Scala | apache-2.0 | 2,648 |
package notebook.util
import java.io.File
class ZipFileWriter(val name: String,
val tmpDir: File = { new File(sys.props("java.io.tmpdir"), "zipfile-"+System.nanoTime) }) {
val zipFile = new File(tmpDir, name)
zipFile.createNewFile
protected val baos = new java.io.FileOutputStream(zipFile)
... | andypetrella/spark-notebook | modules/common/src/main/scala/notebook/util/ZipFileWriter.scala | Scala | apache-2.0 | 898 |
package mlib.impl.protocol
import mlib.api.Message
import play.api.libs.json._
import mlib.api.{SystemChannels => Chan}
import mlib.impl.protocol.MessageFields._
object ApplicationMessage {
import java.util.UUID
abstract class Bridge(val channel: Message.ChannelType, val content: JsValue, val msgId: String = UUID... | InnovaCo/mlib | src/main/scala/mlib/impl/protocol/ApplicationMessage.scala | Scala | mit | 1,437 |
/*
* Copyright 2014–2018 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... | jedesah/Quasar | connector/src/main/scala/quasar/connector/PhysicalPlan.scala | Scala | apache-2.0 | 749 |
package scala.idx.Genesys.Domain
import scala.idx.Genesys._
import scala.xml._
import scala.io._
import java.io.File
import scala.io.Source
import java.io.FileReader
import java.sql.{DriverManager,DatabaseMetaData}
abstract class ObjDef(val name: String)
class FieldDef(override val name: String, val typeValue: Strin... | serdna27/Genesys | src/main/scala/scala/idx/Genesys/Domain/ObjDef.scala | Scala | mit | 5,516 |
package controllers
/**
* Created by hadoop on 16-7-24.
*/
import play.api.mvc._
import javax.inject._
import play.api._
import play.api.data._
import play.api.data.Forms._
import dao.DAO
import model.RegistrationInfo
@Singleton
class RegistrationController @Inject() (implicit dao:DAO) extends Controller{
val s... | GreenHunan/aircheck-server | app/controllers/RegistrationController.scala | Scala | gpl-2.0 | 853 |
/*
Copyright 2009 David Hall, Daniel Ramage
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 writi... | followyourheart/epic | src/main/scala/epic/preprocess/WhitespaceTokenizer.scala | Scala | apache-2.0 | 972 |
object X {
class CA[A]
type C = CA[_]
val c: C = ???
def f[A](r: CA[A]) = ()
def g(): CA[_] = CA()
def h(): C = ???
// works
f(c)
// works
val x = c.asInstanceOf[C]
f(x)
// was: error
f(c.asInstanceOf[C])
// works, error in Scala 2
f(c.asInstanceOf[c.type])
f(c.asInstanceOf[CA[_]])... | dotty-staging/dotty | tests/pos/i12739.scala | Scala | apache-2.0 | 341 |
import java.util.concurrent._
import java.util.concurrent.atomic._
object Test { def main(args: Array[String]) {
val n = 10000
val i = new AtomicInteger(n)
val j = new AtomicInteger(n)
val sum = new AtomicInteger
val q = new scala.concurrent.SyncVar[Int]
val producers = (1 to 3) map { z => new Thread {
override d... | felixmulder/scala | test/files/jvm/sync-var.scala | Scala | bsd-3-clause | 975 |
package system.master.core
import akka.actor.{ActorRef, ActorSystem, Props}
import akka.testkit.{ImplicitSender, TestActorRef, TestKit, TestProbe}
import com.actors.CustomActor
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}
import system.names.NamingSystem
import system.ontologies.messages.Location._... | albertogiunta/arianna | src/test/scala/system/master/core/DataStreamerTest.scala | Scala | gpl-3.0 | 2,332 |
package org.cloudfun.util
import javax.swing.{JTextField, JTextArea, JFrame}
import javax.swing.text.{SimpleAttributeSet, Document}
import java.awt.event.{ActionEvent, ActionListener}
import java.awt.{Dimension, BorderLayout}
/**
* Simple console with output lines and an input line.
*/
class SimpleConsole(name: Str... | zzorn/cloudfun | src/main/scala/org/cloudfun/util/SimpleConsole.scala | Scala | lgpl-3.0 | 1,173 |
package io.udash.bootstrap.modal
import io.udash._
import io.udash.bindings.modifiers.Binding
import io.udash.bootstrap.utils.BootstrapStyles
import io.udash.testing.UdashCoreFrontendTest
import io.udash.wrappers.jquery._
import scalatags.JsDom.all._
class UdashModalTest extends UdashCoreFrontendTest {
"UdashModal... | UdashFramework/udash-core | bootstrap4/.js/src/test/scala/io/udash/bootstrap/modal/UdashModalTest.scala | Scala | apache-2.0 | 3,793 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | sh-cho/cshSpark | memory/MemoryManager.scala | Scala | apache-2.0 | 9,476 |
package com.github.ldaniels528.broadway.app.config
/**
* Represents a processing Story
*/
case class Story() {
}
| ldaniels528/broadway | app-play/app/com/github/ldaniels528/broadway/app/config/Story.scala | Scala | apache-2.0 | 119 |
package mesosphere.marathon
package stream
import scala.reflect.ClassTag
/**
* Extends traversable with a few helper methods.
*/
class RichIterable[+A](to: Iterable[A]) {
/**
* Works like `exists` but searches for an element of a given type.
*/
def existsAn[E](implicit tag: ClassTag[E]): Boolean = to... | mesosphere/marathon | src/main/scala/mesosphere/marathon/stream/RichIterable.scala | Scala | apache-2.0 | 359 |
/*
* 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/core/src/test/scala/org/apache/spark/sql/util/ExecutionListenerManagerSuite.scala | Scala | apache-2.0 | 2,446 |
/**
* © 2014 Evan Bennett
* All rights reserved.
*/
package com.github.evanbennett.sbt_play_messages
import PlayMessagesPlugin.autoImport._
import PlayMessagesPlugin.Statuses._
import sbt._
/**
* PlayMessages
*/
object PlayMessages {
val MESSAGES_FILENAME = "messages"
val APPLICATION_LANGS_CONFIGURATION_KEY ... | evanbennett/play-messages | sbt-play-messages/src/main/scala/com/github/evanbennett/sbt_play_messages/PlayMessages.scala | Scala | bsd-3-clause | 16,970 |
/***********************************************************************
* Copyright (c) 2013-2016 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and is ... | mdzimmerman/geomesa | geomesa-jobs/src/main/scala/org/locationtech/geomesa/jobs/mapred/InputFormatBaseAdapter.scala | Scala | apache-2.0 | 4,219 |
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright © 2012 Christian Krause *
* ... | wookietreiber/ckit | client/swing/main/scala/SwingClient.scala | Scala | gpl-3.0 | 4,879 |
/*
* Copyright (c) 2017 Lucas Satabin
*
* 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 writi... | satabin/toolxit-ng | fonts/src/main/scala/toolxit/font/tfm/TfmCodec.scala | Scala | apache-2.0 | 3,651 |
package com.blogspot.ramannanda.scala.algorithms.cp3.adhoc.rl
import scala.io.StdIn
object SuperBowlSunday {
def printNumbersIfPossible(sum: Int, diff: Int): Unit = {
if ((sum + diff) % 2 == 0 && (sum - diff) % 2 == 0) {
val a = (sum + diff) / 2
val b = (sum - diff) / 2
if (a > 0 && b > 0) {
... | ramannanda9/algorithms-in-scala | src/main/scala/com/blogspot/ramannanda/scala/algorithms/cp3/adhoc/rl/SuperBowlSunday.scala | Scala | gpl-3.0 | 647 |
package io.continuum.bokeh
object Json extends Json
trait Json extends upickle.AttributeTagged with JsonSyntax {
implicit def JsWriter[T <: Js.Value] = Writer[T] {
case value => value
}
override implicit def OptionW[T:Writer] = Writer[Option[T]] {
case Some(value) => writeJs(value)
... | bokeh/bokeh-scala | bokeh/src/main/scala/Json.scala | Scala | mit | 2,467 |
package ch.wsl.box.client.forms
import ch.wsl.box.client.utils.TestHooks
import ch.wsl.box.client.{Context, EntityFormState, Main, TestBase}
import ch.wsl.box.model.shared.{EntityKind, JSONID, JSONKeyValue}
import org.scalajs.dom.document
import org.scalajs.dom.raw.HTMLElement
import scala.concurrent.Future
class Re... | Insubric/box | client/src/test/scala/ch/wsl/box/client/forms/ReadOnlyTest.scala | Scala | apache-2.0 | 1,598 |
package org.openapitools.client.api
import argonaut._
import argonaut.EncodeJson._
import argonaut.DecodeJson._
import org.http4s.{EntityDecoder, EntityEncoder}
import org.http4s.argonaut._
import org.joda.time.DateTime
import InputStepImpllinks._
case class InputStepImpllinks (
self: Option[Link],
`class`: Opti... | cliffano/swaggy-jenkins | clients/scalaz/generated/src/main/scala/org/openapitools/client/api/InputStepImpllinks.scala | Scala | mit | 720 |
package blended.prickle.akka.http
import scala.util.Success
import akka.http.scaladsl.model.HttpEntity
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.testkit.ScalatestRouteTest
import blended.util.logging.Logger
import microjson.JsValue
import org.scalatest.FreeSpec
import prickle.JsConfig
im... | lefou/blended | blended.prickle.akka.http/src/test/scala/blended/prickle/akka/http/PrickleSupportSpec.scala | Scala | apache-2.0 | 1,736 |
/*
* Copyright (c) 2018. Yuriy Stul
*/
package com.stulsoft.queues
/**
* @author Yuriy Stul
*/
case class SomeObject(id:Int,text:String)
| ysden123/poc | queues/src/main/scala/com/stulsoft/queues/SomeObject.scala | Scala | mit | 145 |
/*
* 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/ct-calculations | src/test/scala/uk/gov/hmrc/ct/computations/Validators/DonationsValidationFixture.scala | Scala | apache-2.0 | 4,424 |
package tmvault.io
import tmvault.{Future, ExecutionContext}
import tmvault.util.SHA1Hash
object ObjectStore {
def apply[T](blockStore: BlockStore, serializer: BlobSerializer[T])(implicit ec: ExecutionContext): ObjectStore[T] =
SimpleObjectStore(blockStore, serializer)
private case class SimpleObjectStore[T... | rklaehn/tmvault | tmvault/src/main/scala/tmvault/io/ObjectStore.scala | Scala | apache-2.0 | 891 |
package test
import cucumber.api.scala.{ScalaDsl, EN}
import org.scalatest.matchers.ShouldMatchers
class CucumberJarStepDefinitions extends ScalaDsl with EN with ShouldMatchers {
private var givenCalled = false
private var whenCalled = false
Given("""^an SBT project$""") { () =>
givenCalled = true
}
... | gsood/xsbt-cucumber-plugin | testProjects/testProject_2.9/src/test/scala/test/CucumberJarStepDefinitions.scala | Scala | apache-2.0 | 657 |
package relational.analyzers
import relational._
import relational.attributes.AttributeLike
import relational.comparissions.{Comparission, None => NullComp, And, Equality}
import relational.joins.Join
class QueryAnalyzer(selector: Selector) {
lazy val fields = {
val grouped = selector.select.grouped(1).map(_.to... | mauricioszabo/relational-scala | src/main/scala/relational/analyzers/QueryAnalyzer.scala | Scala | artistic-2.0 | 1,216 |
package com.sksamuel.elastic4s
import org.scalatest.FlatSpec
import org.scalatest.mock.MockitoSugar
import ElasticDsl._
/** @author Stephen Samuel */
class CountDslTest extends FlatSpec with MockitoSugar with ElasticSugar {
"a count request" should "accept tuple for from" in {
val req = count from "places" -> ... | l15k4/elastic4s | elastic4s-core/src/test/scala/com/sksamuel/elastic4s/CountDslTest.scala | Scala | apache-2.0 | 2,549 |
///*
// active-learning-scala: Active Learning library for Scala
// Copyright (c) 2014 Davi Pereira dos Santos
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the... | active-learning/active-learning-scala | src/main/scala/al/strategies/GATU3b.scala | Scala | gpl-2.0 | 2,294 |
class BogoSort {
def isSorted(l:List[Int]): Boolean = l match {
case Nil => true
case x :: Nil => true
case x :: xs => x <= xs.head && isSorted(xs)
}
def bogoSortMethod(listForShuffle: List[Int]):List[Int] = {
val shuffledList = util.Random.shuffle(listForShuffle)
if(isSorted(shuffledLis... | warreee/Algorithm-Implementations | Bogosort/Scala/aayushKumarJarvis/BogoSort.scala | Scala | mit | 388 |
package no.nr.edvard.osiris.analysis
import collection.immutable
import collection.mutable
import immutable.Set
import no.nr.edvard.osiris.model.{MethodIdentifier, JavaMethod, JavaType}
// TODO! Should rename this to what it is, and extract a general interface ;-)
// Plus optimize it!
object CalleeMapBuilder {
priv... | edwkar/edwbsc | projects/Osiris/src/main/scala/no/nr/edvard/osiris/analysis/CalleeMapBuilder.scala | Scala | gpl-2.0 | 3,301 |
package scalan.primitives
import scalan._
import scalan.common._
import scala.reflect.runtime.universe._
trait StructKeys extends ViewsDsl with Entities { self: StructsDsl with Scalan =>
type SKey[S <: Struct] = Rep[StructKey[S]]
trait StructKey[Schema <: Struct] extends Def[StructKey[Schema]] {
def eSchema... | PCMNN/scalan-ce | core/src/main/scala/scalan/primitives/StructKeys.scala | Scala | apache-2.0 | 2,201 |
import language.experimental.macros
import scala.reflect.macros._
import blackbox.Context
object X {
def classTagOrNull[T](implicit t: reflect.ClassTag[T] = null) = t
// the failed search for ClassTag[T] does not issue a visible
// error as we fall back to the default argument. But, the
// macro engine things... | jvican/scala | test/files/pos/t8947/Macro_1.scala | Scala | bsd-3-clause | 1,866 |
/**
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
*/
package actorbintree
import akka.actor._
import scala.collection.immutable.Queue
import actorbintree.BinaryTreeNode.CopyFinished
object BinaryTreeSet {
trait Operation {
def requester: ActorRef
def id: Int
def elem: Int
}
t... | kailuowang/PrinciplesOfReactiveProgramming | actorbintree/src/main/scala/actorbintree/BinaryTreeSet.scala | Scala | mit | 5,444 |
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this fi... | takezoe/elasticsearch-hadoop | spark/sql-20/src/test/scala/org/elasticsearch/spark/sql/SchemaUtilsTest.scala | Scala | apache-2.0 | 7,616 |
package coder.simon.slots.common
import java.util.Random
object Spin {
type RNG = Int => Int
def randomRNG(random: Random)(max: Int) = random.nextInt(max);
def idxMatrix(reelInfos: Seq[ReelInfo]): Matrix = randomMatrix(randomRNG(new java.util.Random()))(reelInfos)
def randomMatrix(random: RNG)(reelInfos: S... | erlangxk/fpscala | src/main/scala/coder/simon/slots/common/Spin.scala | Scala | mit | 1,036 |
package com.arcusys.valamis.updaters.version330.schema3301
import com.arcusys.valamis.persistence.common.DbNameUtils._
import com.arcusys.valamis.persistence.common.{LongKeyTableComponent, SlickProfile, TypeMapper}
trait TableComponent extends LongKeyTableComponent with TypeMapper { self: SlickProfile =>
import dri... | arcusys/Valamis | valamis-updaters/src/main/scala/com/arcusys/valamis/updaters/version330/schema3301/TableComponent.scala | Scala | gpl-3.0 | 2,043 |
package notification.services
import models.GITContent
import models.Link.Internal
import notification.NotificationsFixtures
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mock.Mockito
import org.specs2.mutable.Specification
import org.specs2.specification.Scope
import scala.concurrent.Future
class Arti... | guardian/mobile-n10n | notification/test/notification/services/ArticlePurgeSpec.scala | Scala | apache-2.0 | 1,450 |
package visitor
abstract class HtmlTag extends Element {
def getTagName: String
def setStartTag(tag: String): Unit
def getStartTag: String
def setEndTag(tag: String): Unit
def getEndTag: String
def setTagBody(tagBody: String): Unit = ???
def addChildTag(htmlTag: HtmlTag): Unit = ???
def removeChildTag(... | BBK-PiJ-2015-67/sdp-portfolio | exercises/week11/src/main/scala/visitor/HtmlTag.scala | Scala | unlicense | 418 |
/*
* Copyright 2022 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/fset-faststream | test/services/application/FsbServiceSpec.scala | Scala | apache-2.0 | 22,878 |
/*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0, (the "License"); you ma... | equella/Equella | Source/Plugins/Core/com.equella.core/scalasrc/com/tle/web/workflow/notification/StandardNotifications.scala | Scala | apache-2.0 | 1,252 |
package ru.wordmetrix.arrangetext
import java.io.File
import ru.wordmetrix.features.Features
import ru.wordmetrix.features.Features.String2Word
import ru.wordmetrix.smartfile.SmartFile.fromFile
import ru.wordmetrix.utils.{CFG, debug, _}
import ru.wordmetrix.vector.Vector
import scala.Option.option2Iterable
import sc... | electricmind/treeapproximator | arrangetext/src/main/scala/ru/wordmetrix/arrangetext/ArrangeText.scala | Scala | apache-2.0 | 6,428 |
package fpinscala.gettingstarted
import scala.annotation.tailrec
// A comment!
/* Another comment */
/** A documentation comment */
object MyModule {
def abs(n: Int): Int =
if (n < 0) -n
else n
private def formatAbs(x: Int) = {
val msg = "The absolute value of %d is %d"
msg.format(x, abs(x))
}
... | benusher/fpinscala_exercises | exercises/src/main/scala/fpinscala/gettingstarted/GettingStarted.scala | Scala | mit | 5,459 |
/*
* 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/ct-calculations | src/test/scala/uk/gov/hmrc/ct/accounts/frs102/calculations/GrossProfitAndLossCalculatorSpec.scala | Scala | apache-2.0 | 2,938 |
/**
* Copyright 2013 Brian Porter (poornerd at gmail dot com) - twitter: @poornerd
*
* 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
*... | k4200/securesocial | module-code/app/securesocial/core/providers/XingProvider.scala | Scala | apache-2.0 | 2,259 |
package de.leanovate.dose.product.consul
import spray.json.{JsonFormat, DefaultJsonProtocol}
case class ServiceNode(
Node: String,
Address: String,
ServiceID: String,
ServiceName: String,
ServiceTags: Seq[String],
ServicePort: Int
)
object ServiceNode extends DefaultJsonProtocol {
implicit val servic... | leanovate/microzon-product | src/main/scala/de/leanovate/dose/product/consul/ServiceNode.scala | Scala | mit | 391 |
class A
object Impl {
def foo()(implicit x: A = null): Int = 2
def test: Int = {
foo()() // ok
foo() // did not work before, does now
}
}
// same with multiple parameters
object Impl2 {
def foo()(implicit ev: Int, x: A = null): Int = 2
def test: Int = {
implicit val ii: Int = 1
foo()
}
}... | som-snytt/dotty | tests/pos/i576.scala | Scala | apache-2.0 | 321 |
package util
import java.io.{ File, FileNotFoundException }
import java.nio.file._
import java.nio.file.attribute.BasicFileAttributes
import com.google.common.hash.Hashing
import com.google.common.io
import domain.FileChecksum
import domain.Types.FolderContent
import scala.util.Try
object FolderUtils {
def filesI... | felixbr/akka-file-sync | src/main/scala/util/FolderUtils.scala | Scala | mit | 1,632 |
package io.prediction.examples.friendrecommendation
import io.prediction.controller._
class FriendRecommendationDataSourceParams(
val itemFilePath: String,
val userKeywordFilePath: String,
val userActionFilePath: String,
val trainingRecordFilePath: String
) extends Params
| ch33hau/PredictionIO | examples/experimental/scala-local-friend-recommendation/src/main/scala/FriendRecommendationDataSourceParams.scala | Scala | apache-2.0 | 283 |
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.