code stringlengths 5 1M | repo_name stringlengths 5 109 | path stringlengths 6 208 | language stringclasses 1
value | license stringclasses 15
values | size int64 5 1M |
|---|---|---|---|---|---|
/*
* Copyright 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... | pncampbell/ct-calculations | src/test/scala/uk/gov/hmrc/ct/ct600/accounts/AC8023Spec.scala | Scala | apache-2.0 | 11,848 |
object Dna {
val RnaMap = Map("G" -> "C", "C" -> "G", "T" -> "A", "A" -> "U")
def apply() = new Dna()
}
class Dna() {
def toRna(s: String): String =
s.split("")
.map(Dna.RnaMap.getOrElse(_, ""))
.mkString("")
}
| daewon/til | exercism/scala/rna-transcription/src/main/scala/dna.scala | Scala | mpl-2.0 | 235 |
package bifrost.transaction.serialization
import bifrost.serialization.Serializer
import bifrost.transaction.bifrostTransaction.BifrostTransaction.Nonce
import bifrost.transaction.bifrostTransaction._
import bifrost.transaction.box.proposition.{Constants25519, PublicKey25519Proposition}
import bifrost.transactio... | Topl/Project-Bifrost | src/main/scala/bifrost/transaction/serialization/ProgramTransactionCompanion.scala | Scala | mpl-2.0 | 3,915 |
package autolift.scalaz
import scalaz.{Functor, Apply}
import autolift.{LiftAp, LiftApSyntax}
trait ScalazLiftAp[Obj, Fn] extends LiftAp[Obj, Fn]
object ScalazLiftAp extends LowPriorityScalazLiftAp {
def apply[Obj, Fn](implicit lift: ScalazLiftAp[Obj, Fn]): Aux[Obj, Fn, lift.Out] = lift
implicit def base[F[_], ... | wheaties/AutoLifts | autolift-scalaz/src/main/scala/autolift/scalaz/LiftAp.scala | Scala | apache-2.0 | 1,738 |
/*
* (c) Copyright 2016 Hewlett Packard Enterprise Development LP
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | hpe-cct/cct-core | src/main/scala/cogx/platform/cpumemory/readerwriter/MatrixFieldWriter.scala | Scala | apache-2.0 | 1,645 |
package org.jetbrains.plugins.scala.lang.parser.parsing.types
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes
import org.jetbrains.plugins.scala.lang.parser.{ParserNode, ScalaElementTypes}
import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder
import org.jetbrains.plugins.scala.la... | gtache/intellij-lsp | intellij-lsp-dotty/src/org/jetbrains/plugins/scala/lang/parser/parsing/types/Types.scala | Scala | apache-2.0 | 1,456 |
// 20.6: Question: instead of an abstract type member, why not just use a type parameter?
class Food
abstract class Animal[SuitableFood <: Food] {
def eat(food:SuitableFood)
}
// Cows
class Grass extends Food
class Cow extends Animal[Grass] {
override def eat(food: Grass) {
}
}
// One difference using type pa... | machristie/ProgrammingInScala | ch20/Animal.scala | Scala | unlicense | 675 |
/*
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... | benpence/scalding | scalding-parquet/src/main/scala/com/twitter/scalding/parquet/thrift/ParquetThrift.scala | Scala | apache-2.0 | 4,733 |
/**
* Illustrates a simple map partition to parse JSON data in Scala
* Loads the data into a case class with the name and a boolean flag
* if the person loves pandas.
*/
package com.oreilly.learningsparkexamples.scala
import scala.collection.JavaConversions._
import org.apache.spark._
import org.apache.hadoop.mapr... | holdenk/learning-spark-examples | src/main/scala/com/oreilly/learningsparkexamples/scala/LoadKeyValueTextInput.scala | Scala | mit | 907 |
package com.raquo.domtypes.generic.builders
import com.raquo.domtypes.generic.defs.styles.{keywords, units}
/**
* This trait contains functionality for creating CSS Styles and Style Setters.
*
* @tparam Prop Representation of a DOM CSS style property, e.g. "background"
* @tparam Setter Representation of... | raquo/scala-dom-types | shared/src/main/scala/com/raquo/domtypes/generic/builders/StylePropBuilder.scala | Scala | mit | 8,544 |
/**
* Copyright (c) 2007-2011 Eric Torreborre <etorreborre@yahoo.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to us... | stuhood/specs | src/test/scala/org/specs/specification/specificationContextSpec.scala | Scala | mit | 4,801 |
/*
* 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 ... | Panos-Bletsos/spark-cost-model-optimizer | sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala | Scala | apache-2.0 | 12,894 |
package transactional
object MegaBench extends Benchmark {
type Transactional[T] = Transaction ?=> T
def transaction[T](op: Transactional[T]): T = {
implicit val trans: Transaction = new Transaction
val res = op
trans.commit()
res
}
def thisTransaction: Transactional[Transaction] = implicitly[... | dotty-staging/dotty | tests/bench/transactional/ImplicitMega.scala | Scala | apache-2.0 | 1,412 |
/*
* Copyright (C) 2005, The OpenURP 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... | openurp/api | rd/src/main/scala/org/openurp/rd/achievement/model/TextbookEditor.scala | Scala | lgpl-3.0 | 1,174 |
/*
* Created on 2010/08/07
* Copyright (c) 2010-2014, Wei-ju Wu.
* 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, ... | weiju/zmpp2 | zmpp-zcode/src/main/scala/org/zmpp/zcode/SwingScreenModelStd.scala | Scala | bsd-3-clause | 28,574 |
package amora.backend.indexer
import org.junit.Test
import amora.converter.protocol.Artifact
import amora.converter.protocol.Project
class ScalaDeclTest extends RestApiTest {
@Test
def classes() = {
indexRegionData("""
prefix c:<http://amora.center/kb/amora/Schema/Class/>
select * where {
... | sschaef/tooling-research | backend/src/test/scala/amora/backend/indexer/ScalaDeclTest.scala | Scala | mit | 10,252 |
package io.circe.test
import io.circe.Json
import org.scalacheck.{ Arbitrary, Gen }
trait ArbitraryInstances {
private[this] def maxDepth: Int = 5
private[this] def maxSize: Int = 20
private[this] def genNull: Gen[Json] = Gen.const(Json.empty)
private[this] def genBool: Gen[Json] = Arbitrary.arbBool.arbitrar... | groz/circe | core/shared/src/test/scala/io/circe/test/ArbitraryInstances.scala | Scala | apache-2.0 | 1,418 |
package org.template.classification
import io.prediction.controller.P2LAlgorithm
import io.prediction.controller.Params
import org.apache.spark.SparkContext
import org.apache.spark.mllib.classification.NaiveBayes
import org.apache.spark.mllib.classification.NaiveBayesModel
import org.apache.spark.mllib.linalg.Vectors... | beni55/PredictionIO | examples/scala-parallel-classification/add-algorithm/src/main/scala/NaiveBayesAlgorithm.scala | Scala | apache-2.0 | 918 |
package test
import org.opencv.core.MatOfKeyPoint
import org.opencv.core.Mat
import org.opencv.features2d.FeatureDetector
import org.opencv.features2d.DescriptorExtractor
import org.opencv.highgui.Highgui
import org.opencv.features2d.DescriptorMatcher
import org.opencv.core.MatOfDMatch
import scala.collection.JavaConv... | flaviusanton/logo-detection | src/main/scala/test/BetterMatcher.scala | Scala | mit | 1,943 |
package pl.pholda.malpompaaligxilo.examples.i18n
import pl.pholda.malpompaaligxilo.Context
import pl.pholda.malpompaaligxilo.form.field._
import pl.pholda.malpompaaligxilo.form.field.calculateField.cost.CostDef.SingleCostDef
import pl.pholda.malpompaaligxilo.form.field.calculateField.cost.CostValue.{ComplexCostValue, ... | pholda/MalpompaAligxilo | examples/i18nForm/src/main/scala/pl.pholda.malpompaaligxilo.examples.i18n/I18nFormSpec.scala | Scala | gpl-3.0 | 2,776 |
package com.ibm.gpuenabler
import com.ibm.gpuenabler.CUDARDDImplicits._
import com.ibm.gpuenabler.CUDADSImplicits._
import org.apache.spark.SparkEnv
import org.apache.spark.sql.SparkSession
import org.apache.spark.SparkConf
object perfDebug {
def timeit(msg: String, code: => Any): Any ={
val now1 = System.nano... | IBMSparkGPU/GPUEnabler | examples/src/main/scala/com/ibm/gpuenabler/perfDebug.scala | Scala | apache-2.0 | 3,991 |
// We need to be quite careful not to skew the generator.
// Since `Int.Minvalue` is 1 smaller than `-(Int.MaxValue)`,
// it suffices to increment the negative numbers by 1 and make them positive.
// This maps Int.MinValue to Int.MaxValue and -1 to 0.
def nonNegativeInt(rng: RNG): (Int, RNG) = {
val (i, r) = rng.next... | ud3sh/coursework | functional-programming-in-scala-textbook/answerkey/state/01.answer.scala | Scala | unlicense | 359 |
package forms.data
/**
* Created by Matthias Braun on 11/18/2015.
*/
//case class FarmerPersonalData(name: String, postAdress: String, telefonNumber: String, emailAdress: String)
//
//case class FarmerCompanyData(companyNr: String, vatRegistrationNr: String, inspectionBody: String, memberInBioUnion:Boolean)
//
//c... | mb720/cvs | app/forms/data/HarvestGuessFromForm.scala | Scala | bsd-2-clause | 651 |
package models.db.systemmanage
import slick.lifted._
/**
* Created by hooxin on 15-1-26.
*/
object SystemManage {
val departments = TableQuery[DepartmentTable]
val users = TableQuery[UserTable]
val dicts = TableQuery[DictTable]
val dictItems = TableQuery[DictItemTable]
val functions = TableQuery[FunctionT... | firefoxmmx2/techsupport-extjs4-slick3 | app/models/db/systemmanage/SystemManage.scala | Scala | mit | 583 |
package tight
import java.util.concurrent.ConcurrentHashMap
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
object Cooking extends App {
class KVStore[K, V] {
private val s = new ConcurrentHashMap[K, V]()
def create(k: K,... | enpassant/miniatures | src/main/scala/tight/TightCoupling.scala | Scala | apache-2.0 | 2,159 |
package TAPLcomp.recon
import scala.util.parsing.combinator.{ImplicitConversions, PackratParsers}
import scala.util.parsing.combinator.syntactical.StandardTokenParsers
sealed trait Ty
case class TyVar(id: String) extends Ty
case class TyArr(t1: Ty, t2: Ty) extends Ty
case object TyBool extends Ty
case object TyNa... | hy-zhang/parser | Scala/Parser/src/TAPLcomp/recon/parser.scala | Scala | bsd-3-clause | 2,970 |
package pl.newicom.dddd.view.sql
import akka.Done
import pl.newicom.dddd.messaging.event.OfficeEventMessage
import pl.newicom.dddd.view.ViewHandler
import slick.dbio.DBIOAction.sequence
import slick.jdbc.JdbcProfile
import scala.concurrent.{ExecutionContext, Future}
class SqlViewHandler(val viewStore: SqlViewStore, ... | AndreyLadniy/akka-ddd | view-update-sql/src/main/scala/pl/newicom/dddd/view/sql/SqlViewHandler.scala | Scala | mit | 1,046 |
package controllers
import javax.inject._
import play.api._
import play.api.mvc._
import play.api.mvc.Results._
import play.api.http.HttpErrorHandler
import scala.concurrent._
class ErrorHandler extends HttpErrorHandler {
def onClientError(request: RequestHeader, statusCode: Int, message: String) = {
Future.s... | diegopacheco/scala-playground | play-2.5-scala-app-sandbox/app/controllers/ErrorHandlerController.scala | Scala | unlicense | 804 |
import akka.actor.{ActorSystem, actorRef2Scala}
import akka.testkit.{ImplicitSender, TestActors, TestKit}
import hu.bme.mit.ire.TransactionFactory
import hu.bme.mit.ire.messages.ChangeSet
import hu.bme.mit.ire.util.TestUtil._
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}
class TransactionFactoryTest... | FTSRG/ire | src/test/scala/TransactionFactoryTest.scala | Scala | epl-1.0 | 2,011 |
/*
* Copyright (C) 2016 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.persistence.cassandra.query
import java.lang.{ Long => JLong }
import java.nio.ByteBuffer
import akka.actor.{ NoSerializationVerificationNeeded, Props }
import akka.persistence.PersistentRepr
import akka.persistence.cassandra._
import a... | kpbochenek/akka-persistence-cassandra | src/main/scala/akka/persistence/cassandra/query/EventsByPersistenceIdPublisher.scala | Scala | apache-2.0 | 6,779 |
package com.expedia.gps.geo.reactive101.server
import javax.servlet.ServletContext
import _root_.akka.actor.ActorSystem
import com.expedia.gps.geo.reactive101.server.controller.{FoodController, BasicController}
import com.typesafe.scalalogging.StrictLogging
import org.scalatra._
import scala.language.postfixOps
/*... | olmartinATexpedia/reactive101 | src/main/scala/com/expedia/gps/geo/reactive101/server/ScalatraBootstrap.scala | Scala | apache-2.0 | 636 |
package rspactors.vocab
import rdftools.rdf.vocab.VocabGen
object LdnVocabGen {
def main(args:Array[String])={
VocabGen.generateVocabs
}
} | jpcik/ldn-streams | src/main/scala/rspactors/vocab/VocabGen.scala | Scala | mit | 148 |
package slamdata.engine.fs
import scalaz._
import Scalaz._
import org.specs2.mutable._
import slamdata.engine.{DisjunctionMatchers}
class PathSpecs extends Specification with DisjunctionMatchers {
"Path.apply" should {
"Parse empty string as root" in {
Path("") must_== Path.Root
}
"Parse root s... | mossprescott/quasar | src/test/scala/slamdata/engine/fs/path.scala | Scala | agpl-3.0 | 10,156 |
package org.jetbrains.plugins.scala
package finder
import com.intellij.ide.highlighter.{JavaClassFileType, JavaFileType}
import com.intellij.ide.scratch.ScratchUtil
import com.intellij.openapi.fileTypes.{FileType, FileTypeRegistry, LanguageFileType}
import com.intellij.openapi.module.Module
import com.intellij.openapi... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/finder/ScalaFilterScope.scala | Scala | apache-2.0 | 6,665 |
package oauthorize.model
import oauth2.spec.StatusCodes
import oauth2.spec.model.ErrorResponse
import types._
/**
* Validity expressed in seconds
* Created is time stamp milliseconds
*/
sealed trait Expirable {
def validity: Long
def created: Long
def isExpired = created + validity * 1000 < System.currentTi... | adaptorel/oauthorize | oauthorize-core/src/main/scala/models/model.scala | Scala | apache-2.0 | 3,758 |
package controllers
import com.google.inject.Inject
import models.AcquireCacheKeyPrefix.CookiePrefix
import models.CompleteAndConfirmFormModel.AllowGoingToCompleteAndConfirmPageCacheKey
import models.VehicleTaxOrSornFormModel.Form.{SelectId, SornFormError, SornId, SornVehicleId}
import models.{ErrorType, NoSelection, ... | dvla/vehicles-acquire-online | app/controllers/VehicleTaxOrSorn.scala | Scala | mit | 5,210 |
import sbt._
object Settings {
object Versions {
val akka = "2.5.22"
val akkaActor = "2.5.22"
val scalaTest = "3.0.0"
val akkaHttp = "10.1.8"
val kOAuth = "2.0.0"
val scalaCache = "0.9.3"
val scalaLogging = "3.5.0"
val scalaTags = "0.6.8"
val logback = "1.1.9"
val twitterText... | becompany/akka-social-stream | project/Settings.scala | Scala | apache-2.0 | 1,710 |
/*
* Copyright 2015 Webtrends (http://www.webtrends.com)
*
* See the LICENCE.txt file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Yo... | pcross616/wookiee | wookiee-test/src/test/scala/com/webtrends/harness/ActorWaitSpec.scala | Scala | apache-2.0 | 2,245 |
/*
* 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/computations/CP246.scala | Scala | apache-2.0 | 930 |
package com.sksamuel.elastic4s.requests.security.roles
import com.sksamuel.elastic4s.testkit.DockerTests
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import scala.util.Try
class UpdateRoleTest extends AnyWordSpec with Matchers with DockerTests {
Try {
client.execute {
... | stringbean/elastic4s | elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/requests/security/roles/UpdateRoleTest.scala | Scala | apache-2.0 | 937 |
/**
* Copyright 2012-2013 StackMob
*
* 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... | stackmob/scaliak | src/main/scala/com/stackmob/scaliak/PBStreamingClient.scala | Scala | apache-2.0 | 2,436 |
package nn.conv.versions
/**
* Created by nm on 09/01/17.
* Input channels are parallelised across workgroups
*/
import ir.TupleType
import ir.ast._
import lift.arithmetic.SizeVar
import nn._
import nn.conv.{Conv, ConvCompanion, ConvDatasets, SlidingWindowConfig}
import opencl.executor.{Execute, Executor}
impor... | lift-project/lift | src/test/nn/conv/versions/Conv1.scala | Scala | mit | 26,173 |
package org.refptr.iscala
import sun.misc.{Signal,SignalHandler}
import org.zeromq.ZMQ
import scalax.io.JavaConverters._
import scalax.file.Path
import json.JsonUtil._
import msg._
object IScala extends App {
private val options = new Options(args)
def config: Options#Config = options.config
val thre... | nkhuyu/IScala | src/main/scala/IScala.scala | Scala | mit | 6,388 |
package twitter.github.io.finatra.quickstart
import com.google.inject.testing.fieldbinder.Bind
import com.twitter.finagle.http.Status._
import com.twitter.finatra.http.test.EmbeddedHttpServer
import com.twitter.inject.Mockito
import com.twitter.inject.server.FeatureTest
import com.twitter.util.Future
import finatra.qu... | tom-chan/finatra | examples/finatra-twitter-clone/src/test/scala/twitter/github/io/finatra/quickstart/TwitterCloneFeatureTest.scala | Scala | apache-2.0 | 2,547 |
/*
* 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 ... | witgo/spark | external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaOffsetReaderConsumer.scala | Scala | apache-2.0 | 24,454 |
package org.flowpaint.raster.channel
import _root_.org.flowpaint.util.Rectangle
import collection._
import org.flowpaint.raster.blend.{OpaqueBlender, Blender}
/**
*
*/
// TODO: Undo history saving - but do it with the command history - they can store the blocks of the layers that they changed
class Raster {
pri... | zzorn/flowpaint | src/main/scala/org/flowpaint/raster/channel/Raster.scala | Scala | gpl-2.0 | 2,120 |
/*
* 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/amls-frontend | test/views/businessdetails/previously_registeredSpec.scala | Scala | apache-2.0 | 2,714 |
package com.akkademy
import akka.actor.{Status, ActorSystem}
import akka.testkit.{TestProbe, TestActorRef}
import com.akkademy.messages.SetRequest
import com.typesafe.config.ConfigFactory
import org.scalatest.{FunSpecLike, Matchers}
class AkkademyDbSpec extends FunSpecLike with Matchers {
implicit val system = Acto... | jasongoodwin/learning-akka | ch4/akkademy-db-scala/src/test/scala/com/akkademy/AkkademyDbSpec.scala | Scala | apache-2.0 | 1,376 |
package dotty.tools.dotc
package transform
import ast.tpd
import core.Contexts.Context
import core.StdNames.nme
import core.Phases.Phase
import TreeTransforms.{MiniPhaseTransform, TransformerInfo}
/** Rewrite `getClass` calls as follow:
*
* For every instance of primitive class C whose boxed class is called B:
... | densh/dotty | src/dotty/tools/dotc/transform/GetClass.scala | Scala | bsd-3-clause | 904 |
package eu.gruchala.typelevel.base
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.language.implicitConversions
object F_MagnetPattern {
class HttpResponse
sealed trait StatusCode
object StatusCode {
case object Ok extends StatusCode
case object Bad... | leszekgruchala/typelevel-programming-scala | src/main/scala/eu/gruchala/typelevel/base/F_MagnetPattern.scala | Scala | mit | 1,424 |
/*
* 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 | sql/catalyst/src/main/scala/org/apache/spark/sql/types/StringType.scala | Scala | apache-2.0 | 1,975 |
package com.typesafe.sbt.packager.archetypes
/**
* This object provides methods to generate scripts from templates. This involves
*
* <ol>
* <li>procesing - replacing a placeholders with actual values</li>
* <li>TODO: validating - check the script if there are no remaining placeholders</li>
* </ol>
*
* @exampl... | benmccann/sbt-native-packager | src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala | Scala | bsd-2-clause | 2,438 |
package scalax.chart
package exporting
import java.io._
import javax.xml.bind.DatatypeConverter
import org.jfree.chart.encoders.EncoderUtil
import org.jfree.graphics2d.svg._
import com.itextpdf.awt.{ DefaultFontMapper, FontMapper, PdfGraphics2D }
import com.itextpdf.text.{ Document, Rectangle }
import com.itextpdf.... | wookietreiber/scala-chart | src/main/scala/scalax/chart/exporting.scala | Scala | lgpl-3.0 | 6,100 |
trait X {
type Y
abstract val v: Y // error: abstract term
abstract def y: Y // error: abstract term
}
implicit object Z { // error: implict at toplevel
implicit case class C() // error: implicit classes may not be case classes
implicit type T = Int // error: implicit modifier cannot be used for types or tra... | densh/dotty | tests/neg/validate.scala | Scala | bsd-3-clause | 1,561 |
package com.git.huanghaifeng.spark.wordcount
import org.apache.spark.SparkContext
object WordCount4 {
def main(args: Array[String]) {
val master = args.length match {
case x: Int if x > 0 => args(0)
case _ => "local"
}
val sc = new SparkContext(master,... | prucehuang/quickly-start-spark | src/main/scala/com/git/huanghaifeng/spark/wordcount/WordCount4.scala | Scala | apache-2.0 | 977 |
package org.example1_1.usage
trait Usage4 {
def myScope1(): Unit = {
import org.example1_1.declaration.Z
val zzz: Z = ???
import org.example1_1.declaration.Y
val yyy: Y = ???
import org.example1_1.declaration.data.X
val xxx: X = ???
}
def myScope2(): Unit = {
import o... | JetBrains/intellij-scala | scala/scala-impl/testdata/move/allInOne_1/after/org/example1_1/usage/Usage4.scala | Scala | apache-2.0 | 633 |
package akka.duke.taskmanager.event
import akka.duke.taskmanager.ComposableActor
import akka.duke.taskmanager.Message.Event
trait Listener { this: ComposableActor =>
receiveBuilder += {
case e: Event => handleEvent(e)
}
def handleEvent(event: Event): Unit
}
| Taerus/taskmanager | taskmanager-core/src/main/scala/akka/duke/taskmanager/event/Listener.scala | Scala | bsd-3-clause | 275 |
/*
* 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 | mllib/src/main/scala/org/apache/spark/mllib/evaluation/AreaUnderCurve.scala | Scala | apache-2.0 | 2,775 |
/*
* 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/AC122.scala | Scala | apache-2.0 | 2,107 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | HuaweiBigData/carbondata | integration/spark2/src/test/scala/org/apache/carbondata/spark/testsuite/booleantype/BooleanDataTypesBigFileTest.scala | Scala | apache-2.0 | 22,952 |
package scala.concurrent.duration
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.junit.Test
@RunWith(classOf[JUnit4])
class SpecialDurationsTest {
@Test
def test_11178(): Unit = {
assert(Duration(Duration.Inf.toString) eq Duration.Inf)
assert(Duration(Duration.MinusInf.toString... | scala/scala | test/junit/scala/concurrent/duration/SpecialDurationsTest.scala | Scala | apache-2.0 | 422 |
package me.invkrh.raft.core
import akka.actor.Actor
case class Holder(coll: List[Int])
// scalastyle:off println
class AddrChecker(a: Int) extends Actor {
override def receive: Receive = {
case h: Holder =>
println(a)
// println("In: " + h.toString)
// println("In: " + h.coll.toString)
// ... | invkrh/akka-raft | src/main/scala/me/invkrh/raft/core/SanityTest.scala | Scala | mit | 1,111 |
package im.actor.server.dialog
import akka.actor.ActorSystem
import akka.util.Timeout
import im.actor.api.rpc.peers.{ ApiPeer, ApiPeerType }
import im.actor.server.dialog.Origin.{ RIGHT, LEFT }
import im.actor.server.group.{ GroupExtension, GroupViewRegion, GroupOffice }
import scala.concurrent.Future
object DialogI... | WangCrystal/actor-platform | actor-server/actor-core/src/main/scala/im/actor/server/dialog/DialogId.scala | Scala | mit | 2,592 |
package org.jetbrains.plugins.scala
package lang.psi.light.scala
import com.intellij.psi._
import com.intellij.psi.impl.light.LightElement
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiElement
import org.jetbrains.plugins.scala.lang.psi.api.base.ScModifierList
import org.jetbrains.plugins.scala.lang.psi.api.base... | triggerNZ/intellij-scala | src/org/jetbrains/plugins/scala/lang/psi/light/scala/ScLightFunctionDeclaration.scala | Scala | apache-2.0 | 3,490 |
package controllers
import anorm.Row
import play.api.libs.json.{JsNumber, JsObject, JsValue}
object CheckRecord extends REST {
val tableName: String = "check_records"
val parameters: Map[String, (String, String) => ValidationResult] = Map(
"matchup_occurences" -> validateInt,
"kos_or_switches_caused... | ishakir/PokeStat | app/controllers/CheckRecord.scala | Scala | mit | 1,282 |
package org.scaladebugger.api.lowlevel.events
import org.scalamock.scalatest.MockFactory
import org.scalatest.{FunSpec, Matchers, ParallelTestExecution}
import org.scaladebugger.api.lowlevel.events.EventManager.EventHandler
import org.scaladebugger.api.lowlevel.events.EventType.EventType
import org.scaladebugger.api.u... | chipsenkbeil/scala-debugger | scala-debugger-api/src/test/scala/org/scaladebugger/api/lowlevel/events/PendingEventHandlerSupportSpec.scala | Scala | apache-2.0 | 6,054 |
package com.deweyvm.clock
import com.badlogic.gdx.backends.lwjgl.LwjglAWTCanvas
import java.awt.BorderLayout
import javax.swing.JFrame
import java.awt.event.{MouseEvent, MouseAdapter}
import com.badlogic.gdx.Gdx
object Main {
def main(args:Array[String]) {
var (posX, posY) = (0,0)
val (width, height) = (300... | deweyvm/ScalaClock | src/com/deweyvm/clock/Main.scala | Scala | gpl-2.0 | 1,111 |
package ml.wolfe.term
case class MatrixApply(mat: MatrixTerm, i: IntTerm, j: IntTerm) extends ComposedDoubleTerm {
type ArgumentType = AnyTerm
val arguments = IndexedSeq(mat, i, j)
def copy(args: IndexedSeq[ArgumentType]) =
new MatrixApply(args(0).asInstanceOf[MatrixTerm],
args(1).asInstanceOf[IntTe... | wolfe-pack/wolfe | wolfe-core/src/main/scala/ml/wolfe/term/MatrixApply.scala | Scala | apache-2.0 | 608 |
/**
* 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... | xuwei-k/kafka-manager | app/kafka/manager/utils/AdminUtils.scala | Scala | apache-2.0 | 13,119 |
package uk.gov.dvla.vehicles.presentation.common.clientsidesession
import uk.gov.dvla.vehicles.presentation.common.{UnitSpec, TestWithApplication}
class Sha1HashSpec extends UnitSpec {
"Sha1Hash" should {
"return a hashed string" in new TestWithApplication {
sha1Hash.hash(ClearText) should not equal Clea... | dvla/vehicles-presentation-common | test/uk/gov/dvla/vehicles/presentation/common/clientsidesession/Sha1HashSpec.scala | Scala | mit | 814 |
package io.mpjsons
/**
* @author Marcin Pieciukiewicz
*/
import org.scalatest.FlatSpec
import org.scalatest.MustMatchers._
// this tests also non default constructor and final fields
class MapElement(var intValue: Int, val stringValue: String)
class SimpleMapsObject {
var emptyMap:Map[Int, Long] = Map.empty
... | marpiec/mpjsons | src/test/scala/io/mpjsons/MapsSpec.scala | Scala | apache-2.0 | 2,060 |
package playground.views
import java.util.Date
import org.joda.time.DateTime
import playground.models._
/**
* To make formatting available in templates of your project configure
* your build.sbt or Build.scala with :
*
* settings(
* templatesImport += "playground.views.Formattable._"
* )
*/
object Formatta... | ybr/playground | src/main/scala/playground/views/Formattable.scala | Scala | mit | 1,409 |
/* NSC -- new Scala compiler
* Copyright 2005-2013 LAMP/EPFL
* @author Martin Odersky
*/
package dotty.tools
package dotc
import core.Contexts.Context
import config.Settings.Setting.*
object Main extends Driver {
def resident(compiler: Compiler): Unit = unsupported("resident") /*loop { line =>
val command =... | lampepfl/dotty | tests/neg-with-compiler/Main.scala | Scala | apache-2.0 | 773 |
/*
* Copyright 2019 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/releaser | src/main/scala/uk/gov/hmrc/releaser/Transformers.scala | Scala | apache-2.0 | 8,596 |
package com.nefariouszhen.trie
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
trait BurstTrie[T] {
def put(word: String, t: T): Unit
def query(q: String): Iterator[T]
}
class BurstTrieSet (impl: BurstTrie[String]) {
def put(word: String): Unit = impl.put(word, word)
def query(q: ... | nbauernfeind/scala-burst-trie | src/main/scala/com/nefariouszhen/trie/BurstTrie.scala | Scala | apache-2.0 | 2,500 |
/*
* Tests for verit's interface.
**/
package at.logic.gapt.provers.z3
import at.logic.gapt.examples.BussTautology
import at.logic.gapt.expr._
import at.logic.gapt.proofs.HOLSequent
import at.logic.gapt.provers.smtlib.Z3
import org.specs2.mutable._
class Z3ProverTest extends Specification {
args( skipAll = !Z3.i... | gebner/gapt | tests/src/test/scala/at/logic/gapt/provers/z3/Z3ProverTest.scala | Scala | gpl-3.0 | 1,042 |
package org.jetbrains.plugins.scala.lang.parameterInfo.typeParameterInfo
class TypeParameterInfoExtendsTest extends TypeParameterInfoTestBase {
override def getTestDataPath: String =
s"${super.getTestDataPath}Extends/"
def testAllBounds(): Unit = doTest()
def testJavaGeneric(): Unit = doTest()
def test... | JetBrains/intellij-scala | scala/scala-impl/test/org/jetbrains/plugins/scala/lang/parameterInfo/typeParameterInfo/TypeParameterInfoExtendsTest.scala | Scala | apache-2.0 | 451 |
package org.jetbrains.plugins.scala
package lang.refactoring.introduceVariable
import java.awt._
import java.awt.event.{ActionEvent, ActionListener, ItemEvent, ItemListener}
import javax.swing._
import javax.swing.event.{HyperlinkEvent, HyperlinkListener}
import com.intellij.codeInsight.template.impl.{TemplateManager... | ilinum/intellij-scala | src/org/jetbrains/plugins/scala/lang/refactoring/introduceVariable/ScalaInplaceVariableIntroducer.scala | Scala | apache-2.0 | 17,952 |
package travisTest.travisstub
import scala.scalajs.js
import scala.scalajs.js.Dynamic.global
import scala.scalajs.test.JasmineTest
object ElementCreatorTest extends JasmineTest with logging {
// ElementCreator expects jquery to be present
global.importScripts("jquery-2.1.0.js")
describe("ElementCreator") {... | IridiumMaster/scalaJSStub | src/test/scala/travisTest/travisstub/ElementCreatorTest.scala | Scala | apache-2.0 | 868 |
package gapt.formats.ivy
import gapt.proofs._
import gapt.formats.lisp.SExpression
import gapt.expr._
import gapt.expr.formula.fol.FOLAtom
import gapt.expr.formula.fol.FOLConst
import gapt.expr.formula.fol.FOLTerm
import gapt.expr.subst.FOLSubstitution
/**
* ** Implementation of Ivy's Resolution Calculus ***
* Ivy ... | gapt/gapt | core/src/main/scala/gapt/formats/ivy/IvyResolution.scala | Scala | gpl-3.0 | 3,134 |
package spinoco.protocol.mgcp
import spinoco.protocol.mgcp.MGCPResponseCode.{Provisional, Success}
object MGCPResponseCode {
case class Success(code:Int) extends MGCPResponseCode
case class Provisional(code: Int) extends MGCPResponseCode
case class Error(code: Int) extends MGCPResponseCode
case class Packag... | Spinoco/protocol | mgcp/src/main/scala/spinoco/protocol/mgcp/MGCPResponseCode.scala | Scala | mit | 9,074 |
/***********************************************************************
* 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... | ddseapy/geomesa | geomesa-convert/geomesa-convert-common/src/main/scala/org/locationtech/geomesa/convert/SimpleFeatureConverterFactory.scala | Scala | apache-2.0 | 17,434 |
/*
* 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 ... | ksimar/incubator-carbondata | integration/spark-common/src/main/scala/org/apache/carbondata/spark/CarbonOption.scala | Scala | apache-2.0 | 2,411 |
/*
* Copyright 2019 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/play-graphite | src/main/scala/uk/gov/hmrc/play/graphite/GraphiteConfig.scala | Scala | apache-2.0 | 2,733 |
/* Copyright (C) 2008-2014 University of Massachusetts Amherst.
This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible)
http://factorie.cs.umass.edu, http://github.com/factorie
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with... | patverga/factorie | src/main/scala/cc/factorie/la/DenseTensor.scala | Scala | apache-2.0 | 7,140 |
/**
* © 2019 Refinitiv. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | dudi3001/CM-Well | server/cmwell-util/src/main/scala/cmwell/util/http/StringPath.scala | Scala | apache-2.0 | 1,806 |
package fpinscala.laziness
import scala.Option
trait Stream[+A] {
def uncons: Option[(A, Stream[A])]
def isEmpty: Boolean = uncons.isEmpty
def foldRight[B](z: => B)(f: (A, => B) => B): B =
uncons match {
case Some((h, t)) => f(h, t.foldRight(z)(f))
case None => z
}
def exists(p: A => Bo... | galarragas/FpInScala | exercises/src/main/scala/fpinscala/laziness/Stream.scala | Scala | mit | 4,911 |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distribute... | wvlet/wvlet | wvlet-api/src/main/scala/wvlet/dataflow/api/v1/TaskStatus.scala | Scala | apache-2.0 | 1,558 |
package com.solarmosaic.client.utilityApi.json
import spray.json.DefaultJsonProtocol
trait JsonSupport extends DefaultJsonProtocol
with IsoDateTimeJsonSupport
with SnakeCaseJsonSupport
| solarmosaic/utility-api-client | src/main/scala/com/solarmosaic/client/utilityApi/json/JsonSupport.scala | Scala | mit | 191 |
/**
* Copyright (c) 2012 Alexey Aksenov ezh@ezh.msk.ru
*
* 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... | ezh/digi-lib-ctrl | src/main/scala/scala/util/HackDoggyCode.scala | Scala | apache-2.0 | 844 |
package com.github.gdefacci.di.tests
import com.github.gdefacci.di.runtime.Bind
import com.github.gdefacci.di.runtime.AllBindings
import com.github.gdefacci.di.runtime.ApplicationScope
object samples2 {
trait Repository {
def conn: Connection
}
case class User(name: String)
case class Connection(user: U... | gdefacci/di | macros/src/test/scala/com/github/gdefacci/di/tests/samples2.scala | Scala | mit | 2,305 |
package ch.fram.medlineGeo.crunching.localize
import ch.fram.medlineGeo.models.Location
/**
* Created by alex on 14/09/15.
*/
package object geonames {
trait GeonamesEntity {
val id: Long
val name: String
}
case class GeonamesCountry(id: Long, iso: String, name: String) extends GeonamesEntity
cas... | alexmasselot/medlineGeoBackend | app/ch/fram/medlineGeo/crunching/localize/geonames/package.scala | Scala | mit | 427 |
package com.twitter.finagle.httpx
import com.twitter.finagle.httpx.netty.Bijections
import com.twitter.finagle.netty3.{ChannelBufferBuf, BufChannelBuffer}
import com.twitter.util.Base64StringEncoder
import com.twitter.io.Buf
import java.net.URL
import org.jboss.netty.buffer.{ChannelBuffer, ChannelBuffers}
import org.j... | LithiumTD/finagle | finagle-httpx/src/main/scala/com/twitter/finagle/httpx/RequestBuilder.scala | Scala | apache-2.0 | 15,895 |
//
// Taranos Cloud Sonification Framework: Service Core
// Copyright (C) 2018 David Hinson, Netrogen Blue LLC (dhinson@netrogenblue.com)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software F... | taranos/taranoscsf-core | src/main/scala/org/taranos/mc/trunk/intraprocess/SignalPortPlant.scala | Scala | agpl-3.0 | 6,491 |
import
scala.io.Source
import
sbt._,
Keys._
object PluginBuild extends Build {
def moveThatJS(classesDir: File): Unit = {
val paths = Seq(
"META-INF/resources/webjars/qunit/1.11.0/qunit.css",
"META-INF/resources/webjars/requirejs/2.1.8/require.js"
)
val dest = classesDir / "javasc... | TheBizzle/Ghost-Host | project/Build.scala | Scala | bsd-3-clause | 1,617 |
/* __ *\
** ________ ___ / / ___ __ ____ Scala.js sbt plugin **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ **
** /____/\___/_/ |_/... | matthughes/scala-js | js-envs/src/main/scala/org/scalajs/jsenv/rhino/LazyScalaJSScope.scala | Scala | bsd-3-clause | 3,479 |
// Copyright (C) 2019 The Android Open Source Project
//
// 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 ... | WANdisco/gerrit | e2e-tests/src/test/scala/com/google/gerrit/scenarios/ReplayRecordsFromFeeder.scala | Scala | apache-2.0 | 2,018 |
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero Ge... | jooooooon/rudder | rudder-web/src/main/scala/com/normation/rudder/web/components/SearchNodeComponent.scala | Scala | agpl-3.0 | 22,140 |
/*
* 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 ... | yu-iskw/gihyo-spark-book-example | src/main/scala/jp/gihyo/spark/ch08/GraphxRecommendExample.scala | Scala | apache-2.0 | 6,245 |
package sweet
import org.scalatools.testing._
class SweetRunner(val classLoader: ClassLoader, loggers: Array[Logger]) extends Runner {
def run(testClassName: String, fingerprint: TestFingerprint, eventHandler: EventHandler, args: Array[String]){
val testClass = Class.forName(testClassName, true, classLoader).a... | joshcough/Sweet | src/main/scala/sweet/SweetRunner.scala | Scala | lgpl-2.1 | 1,399 |
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.