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 2013 Eike Kettner
*
* 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... | eikek/county | api/src/test/scala/org/eknet/county/backend/jdbc/JdbcFlatCounterSuite.scala | Scala | apache-2.0 | 1,267 |
/*
* Copyright (c) 2002-2018 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j 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 Foundatio... | HuangLS/neo4j | community/cypher/frontend-2.3/src/main/scala/org/neo4j/cypher/internal/frontend/v2_3/symbols/TypeRange.scala | Scala | apache-2.0 | 3,934 |
/*
* 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 ... | shenbaise/mltoy | src/main/scala/org/apache/spark/examples/LocalLR.scala | Scala | apache-2.0 | 2,634 |
package bad.robot.radiate.teamcity
import argonaut.Argonaut._
import simplehttp.HttpResponse
import bad.robot.radiate.{ParseError, Unmarshaller, Error}
import scalaz.syntax.std.either._
import scalaz.\/
class JsonBuildUnmarshaller extends Unmarshaller[HttpResponse, Build] {
def unmarshall(response: HttpResponse): E... | tobyweston/radiate | src/main/scala/bad/robot/radiate/teamcity/JsonBuildUnmarshaller.scala | Scala | apache-2.0 | 451 |
package org.konfliktriends.bolt
import java.util
import backtype.storm.task.{ OutputCollector, TopologyContext }
import backtype.storm.tuple.Tuple
import org.apache.log4j.Logger
import spray.json._
import storm.kafka.bolt.KafkaBolt
import storm.scala.dsl.StormBolt
/**
* @author Andreas C. Osowski
*/
case class St... | th0br0/konfliktriends | backend-storm/src/main/scala/org/konfliktriends/storm/bolt/StatusToJsonBolt.scala | Scala | gpl-2.0 | 1,432 |
package controllers.application
import controllers.Application
import drt.shared.ErrorResponse
import play.api.libs.json.{JsObject, Json, Writes}
import play.api.mvc.{Action, AnyContent, Result}
import uk.gov.homeoffice.drt.auth.LoggedInUser
import uk.gov.homeoffice.drt.auth.Roles.Role
import upickle.default.write
im... | UKHomeOffice/drt-scalajs-spa-exploration | server/src/main/scala/controllers/application/WithAuth.scala | Scala | apache-2.0 | 2,379 |
package org.donderom.sbt.published
case class IvyArtifact(scalaVersion: String, version: String, sbtVersion: Option[String] = None) {
override def toString: String = sbtVersion match {
case Some(ver) => s"Scala $scalaVersion, sbt $ver: $version"
case _ => s"Scala $scalaVersion: $version"
}
}
| donderom/sbt-published-local | src/main/scala/org/donderom/sbt/published/IvyArtifact.scala | Scala | bsd-3-clause | 306 |
package im.actor.server
import akka.actor.ActorSystem
import akka.event.Logging
import com.google.protobuf.CodedInputStream
import im.actor.api.rpc.{ ClientData, Update }
import im.actor.server.db.DbExtension
import im.actor.server.model.{ SeqUpdate, SerializedUpdate }
import im.actor.server.persist.sequence.UserSeque... | ljshj/actor-platform | actor-server/actor-testkit/src/main/scala/im/actor/server/SeqUpdateMatchers.scala | Scala | mit | 8,833 |
object Challenge2 {
val input = "01000100010010111"
val diskSize = 35651584
def invertByte(c: Char): Char = {
if (c == '0') '1' else '0'
}
def invert(s: String): String = {
s.map(c=>invertByte(c))
}
def dragonize(s: String): String = {
s + "0" + invert(s reverse)
}
def getDrago... | pviafore/AdventOfCode2016 | day16/challenge2/Challenge2.scala | Scala | mit | 1,023 |
/*
* NLL2RDF Active Learner
* Copyright (C) 2014 Cristian A. Cardellino
*
* 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 ... | crscardellino/nll2rdf-active-learner | classifier/src/main/scala/nll2rdf/classifiers/NaiveBayesInfoGain.scala | Scala | gpl-3.0 | 3,539 |
package scalafiddle.compiler.cache
import scalafiddle.compiler.ScalaJSCompat.Linker
object LinkerCache extends LRUCache[Linker]("Linker") {}
| scalafiddle/scalafiddle-core | compiler-server/src/main/scala/scalafiddle/compiler/cache/LinkerCache.scala | Scala | apache-2.0 | 143 |
package emmy.autodiff
case class Add[U[_], V, S](
lhs: Expression[U, V, S],
rhs: Expression[U, V, S]
)(implicit
val vt: Evaluable[ValueOps[U, V, S]],
val so: ScalarOps[U[Double], U[V]],
val ops: ContainerOps.Aux[U, S]
)
extends Expression[U, V, S] {
override val parents = Seq(lhs, rhs)
overrid... | fvlankvelt/emmy | src/main/scala/emmy/autodiff/Add.scala | Scala | apache-2.0 | 1,044 |
package no.netcompany.testdatagen.generators.norway
// Copyright (C) 2014 Lars Reed -- GNU GPL 2.0 -- see LICENSE.txt
import org.junit.runner.RunWith
import org.scalatest.FlatSpec
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class AdresserSpec extends FlatSpec {
"The Adresser generator" s... | lre-mesan/testdata | src/test/scala/no/netcompany/testdatagen/generators/norway/AdresserSpec.scala | Scala | gpl-2.0 | 673 |
package com.spike.giantdataanalysis.spark.example.core
import com.spike.giantdataanalysis.spark.support.Datasets
/**
* 累加器
*/
object Accumulators {
def main(args : Array[String]) : Unit = {
val input = sc.textFile(Datasets.DATA_DIR + "spark-README.md")
val blankLineAccumulator = sc.accumulator(0)
val... | zhoujiagen/giant-data-analysis | data-management-infrastructure/scala-infrastructure-apache-spark/src/main/scala/com/spike/giantdataanalysis/spark/example/core/Accumulators.scala | Scala | mit | 576 |
package org.bitcoins.core.script.constant
import org.bitcoins.core.script.ScriptProgram
import org.bitcoins.core.script.bitwise.OP_EQUAL
import org.bitcoins.core.script.crypto.OP_CHECKMULTISIGVERIFY
import org.bitcoins.core.script.flag.{ ScriptFlag, ScriptVerifyMinimalData }
import org.bitcoins.core.script.result.{ Sc... | Christewart/bitcoin-s-core | src/test/scala/org/bitcoins/core/script/constant/ConstantInterpreterTest.scala | Scala | mit | 6,760 |
package lila.insight
import akka.actor.ActorRef
import org.joda.time.DateTime
import play.api.libs.iteratee._
import play.api.libs.json.Json
import reactivemongo.bson._
import lila.db.api._
import lila.db.BSON._
import lila.db.Implicits._
import lila.game.BSONHandlers.gameBSONHandler
import lila.game.tube.gameTube
im... | JimmyMow/lila | modules/insight/src/main/Indexer.scala | Scala | mit | 3,308 |
/*
* Copyright 2012-2015 2ndlanguage Limited.
*
* 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... | zzztimbo/async-dynamo | src/test/scala/com.github.piotrga.asyncdynamo/OperationsTest.scala | Scala | apache-2.0 | 14,507 |
/* Title: Pure/Tools/profiling_report.scala
Author: Makarius
Report Poly/ML profiling information from log files.
*/
package isabelle
import java.util.Locale
object Profiling_Report
{
def profiling_report(log_file: Build_Log.Log_File): List[(Long, String)] =
{
val Line = """^(?:### )?([ 0-9]... | larsrh/libisabelle | modules/pide/2019-RC4/src/main/scala/Tools/profiling_report.scala | Scala | apache-2.0 | 1,591 |
/*
* MUSIT is a museum database to archive natural and cultural history data.
* Copyright (C) 2016 MUSIT Norway, part of www.uio.no (University of Oslo)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Softw... | kpmeen/musit | service_barcode/app/models/LabelData.scala | Scala | gpl-2.0 | 1,069 |
/**
* Copyright (c) 2015, Cloudera, Inc. All Rights Reserved.
*
* Cloudera, Inc. licenses this file to you 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/LIC... | helio9cn/spark-finance | src/main/scala/com/cloudera/finance/ts/Autoregression.scala | Scala | apache-2.0 | 2,649 |
// Scala built-ins:
trait Function1[T, R] {
def apply(x: T): R
}
| agconti/scala-school | 04-functions-as-values/slides/slide017.scala | Scala | mit | 71 |
package dao.sitedata.joined
import scala.concurrent.Future
import javax.inject.Inject
import play.api.db.slick.DatabaseConfigProvider
import play.api.db.slick.HasDatabaseConfigProvider
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import slick.driver.JdbcProfile
import slick.jdbc.GetResult
import ... | tnddn/iv-web | portal/rest-portal/app/dao/sitedata/joined/SiteInfoAllDao.scala | Scala | apache-2.0 | 3,278 |
/*
* Copyright 2019 Spotify AB.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | regadas/scio | scio-parquet/src/main/scala/com/spotify/scio/parquet/avro/ParquetAvroIO.scala | Scala | apache-2.0 | 9,208 |
// Equites, a Scala chess playground
// Copyright © 2011-2015 Frank S. Thomas <frank@timepit.eu>
//
// 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 ... | equites-chess/equites-core | src/main/scala/eu/timepit/equites/Square.scala | Scala | gpl-3.0 | 4,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 ... | manuzhang/incubator-gearpump | core/src/main/scala/org/apache/gearpump/cluster/master/AppMasterLauncher.scala | Scala | apache-2.0 | 6,225 |
/*
* 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/calculations/ProfitOrLossBeforeTaxCalculator.scala | Scala | apache-2.0 | 1,061 |
/*
Copyright 2013 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... | jinlee/algebird | algebird-util/src/test/scala/com/twitter/algebird/util/summer/AsyncListMMapSumProperties.scala | Scala | apache-2.0 | 1,565 |
package edu.arizona.sista.discourse.rstparser
import edu.arizona.sista.processors.Document
/**
* Verifies is segments within a sentence are only connected to other segments in the same sentence
* User: mihais
* Date: 6/24/14
*/
object CheckSameSentence {
def main(args:Array[String]) {
val trees = CacheReade... | VivianLuwenHuangfu/processors | src/main/scala/edu/arizona/sista/discourse/rstparser/CheckSameSentence.scala | Scala | apache-2.0 | 1,841 |
/*
* 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 ... | DieBauer/flink | flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/dataset/DataSetRel.scala | Scala | apache-2.0 | 1,405 |
package eventstore
package akka
import scala.concurrent.duration._
import scala.concurrent.{Await, Awaitable, ExecutionContext}
import com.typesafe.config.{Config, ConfigFactory}
import _root_.akka.actor.ActorSystem
import _root_.akka.testkit.{ImplicitSender, TestKit}
import org.specs2.mutable.Specification
import org... | EventStore/EventStore.JVM | client/src/test/scala/eventstore/akka/ActorSpec.scala | Scala | bsd-3-clause | 1,015 |
// Scala provides extra special conveniences
// for converting methods ("functions") to Functions
object Foo {
def isGood(x: Int): Boolean = { x % 2 == 0 }
}
val predicate: Int => Boolean = x => Foo.isGood(x)
// "invoke" a method with an _ to promote it to a Function
val predicate = Foo.isGood(_)
// often the ... | agconti/scala-school | 04-functions-as-values/slides/slide059.scala | Scala | mit | 338 |
/*
* Copyright 2001-2012 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | dotty-staging/scalatest | scalactic.dotty/src/main/scala/org/scalactic/Requirements.scala | Scala | apache-2.0 | 18,191 |
/*
* 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 | mllib/src/main/scala/org/apache/spark/mllib/tree/model/treeEnsembleModels.scala | Scala | apache-2.0 | 17,628 |
package com.atomist.rug.test.gherkin.project
import com.atomist.project.archive.Rugs
import com.atomist.rug.kind.core.ProjectMutableView
import com.atomist.rug.test.gherkin._
import com.atomist.source.{ArtifactSource, EmptyArtifactSource}
/**
* Executable feature that manipulates projects
*/
class ProjectManipula... | atomist/rug | src/main/scala/com/atomist/rug/test/gherkin/project/ProjectManipulationFeature.scala | Scala | gpl-3.0 | 955 |
/*
* Copyright 2001-2013 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | dotty-staging/scalatest | scalatest-test/src/test/scala/org/scalatest/StopOnFailureProp.scala | Scala | apache-2.0 | 11,275 |
package debop4s.data.orm.hibernate
import debop4s.data.orm.AbstractJpaJUnitSuite
import debop4s.data.orm.mapping.ScalaEmployee
import org.hibernate.SessionFactory
import org.junit.Test
import org.springframework.beans.factory.annotation.Autowired
import scala.collection.JavaConverters._
/**
* Hibernate SessionFacto... | debop/debop4s | debop4s-data-orm/src/test/scala/debop4s/data/orm/hibernate/StatelessSessionFunSuite.scala | Scala | apache-2.0 | 1,350 |
class SomeClass
object Test {
def main(args: Array[String]): Unit = {
@annotation.unused val cls: Predef.Class[SomeClass] = classOf[SomeClass]
println("Value types:")
println(classOf[Unit])
println(classOf[Boolean])
println(classOf[Byte])
println(classOf[Short])
println(classOf[Char])
... | scala/scala | test/files/run/classof.scala | Scala | apache-2.0 | 857 |
package org.example2.usage
import org.example2.declaration.{U, X, Y}
class Usage_OfGlobal {
val u: U = ???
val x: X = ???
val y: Y = ???
}
//
// SIMPLE
//
class Usage_Simple_1 {
import org.example2.declaration.U
val u: U = ???
}
class Usage_Simple_2 {
import org.example2.declaration.{U, Y}
val u: U... | JetBrains/intellij-scala | scala/scala-impl/testdata/move/allInOne_LocalImports/before/org/example2/usage/Usage1_local_imports_with_global_imports.scala | Scala | apache-2.0 | 2,302 |
package com.twitter.algebird
import java.nio._
/**
* Instances of MinHasher can create, combine, and compare fixed-sized signatures of
* arbitrarily sized sets.
*
* A signature is represented by a byte array of approx maxBytes size.
* You can initialize a signature with a single element, usually a Long or S... | snoble/algebird | algebird-core/src/main/scala/com/twitter/algebird/MinHasher.scala | Scala | apache-2.0 | 6,396 |
package processor
import java.util.concurrent.atomic.AtomicInteger
import dao.LinesDao
import data.Line
import org.joda.time.DateTimeZone
import org.joda.time.format.DateTimeFormat
import play.api.Logger
import processor.ProcessorUtil._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.io.Source... | JohnnyCosta/dataconsumer | app/processor/ProcessorLogic.scala | Scala | gpl-3.0 | 2,217 |
package com.lyrx.wiki
import com.lyrx.text.Context
/**
* Created by extawe on 10/31/16.
*/
class TestWikiArticle()(implicit ctx:Context) extends WikiGenerator{
}
| lyrx/lyrxgenerator | src/test/scala/com/lyrx/wiki/TestWikiArticle.scala | Scala | gpl-3.0 | 172 |
/*
* Copyright 2016-2017 original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... | uts-cic/tap | src/test/scala/tap/UnitSpec.scala | Scala | apache-2.0 | 820 |
package crakken.data.model
import crakken.utils.MongoHelper
import reactivemongo.bson._
case class PageFetchRequest(
id: String = BSONObjectID.generate.stringify,
crawlRequestId: String,
url: String,
statusCode: Option[Int... | CrakkenCrawler/crakken | app/crakken/data/model/PageFetchRequest.scala | Scala | apache-2.0 | 1,962 |
package alexsmirnov.pbconsole.serial
import java.io.IOException
import java.util.concurrent.locks.LockSupport
import scala.collection.{ mutable => m }
import scala.concurrent.Future
import scala.util.Failure
import scala.util.Success
import scala.util.matching.Regex
import alexsmirnov.stream.PublisherBase
import ale... | alexsmirnov/printrbot-g2-console | src/main/scala/alexsmirnov/pbconsole/serial/NRJavaSerialPort.scala | Scala | bsd-3-clause | 4,594 |
/* ___ _ ___ _ _ *\\
** / __| |/ (_) | | Your SKilL scala Binding **
** \\__ \\ ' <| | | |__ generated: 01.02.2019 ... | skill-lang/skill | src/main/scala/de/ust/skill/sir/TypesOfRestriction.scala | Scala | bsd-3-clause | 2,984 |
package kata.domain.scala_api
object TaskService extends TaskService
trait TaskService extends TaskServiceAbstract {
}
| folio-sec/reladomo-scala | sbt-reladomo-plugin/src/test/resources/generated/kata/domain/scala_api/TaskService.scala | Scala | apache-2.0 | 121 |
package at.ait.dme.forcelayout.examples
import java.awt.Dimension
import javax.swing.{ JFrame, JLabel, ImageIcon }
import at.ait.dme.forcelayout.renderer.ImageRenderer
import at.ait.dme.forcelayout.{ Node, Edge, SpringGraph }
object HelloWorld extends App {
val nodes = Seq(
Node("A", "Node A"),
Node... | rsimon/scala-force-layout | src/main/scala/at/ait/dme/forcelayout/examples/HelloWorld.scala | Scala | mit | 1,010 |
package com.karasiq.shadowcloud.storage.utils.mappers
import akka.util.ByteString
import com.karasiq.common.configs.ConfigImplicits
import com.karasiq.shadowcloud.model.crypto.{AsymmetricEncryptionParameters, SymmetricEncryptionParameters}
import com.karasiq.shadowcloud.model.{Chunk, ChunkId}
import com.karasiq.shadow... | Karasiq/shadowcloud | utils/.jvm/src/main/scala/com/karasiq/shadowcloud/storage/utils/mappers/HashNonceHMACKeyMapper.scala | Scala | apache-2.0 | 1,615 |
package com.monovore.coast.wire
import java.util
import com.google.common.base.Charsets._
import com.google.common.hash.{Hashing, HashFunction}
/**
* The 'pretty' wire protocol is a cool and fun way to get human-readable formatting
* for basic types without pulling in some kind of JSON library.
*/
object pretty {... | milinda/coast | core/src/main/scala/com/monovore/coast/wire/pretty.scala | Scala | apache-2.0 | 1,614 |
/**
* Copyright (C) 2011 - 101loops.com <dev@101loops.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 applic... | crashnote/crashnote-java | agents/servlet/src/test/scala/com/crashnote/test/servlet/perf/Benchmark.scala | Scala | apache-2.0 | 2,012 |
package dao
import akka.NotUsed
import akka.stream.{Materializer, OverflowStrategy, QueueOfferResult}
import akka.stream.scaladsl.{Flow, Keep, Sink, Source, SourceQueueWithComplete}
import org.reactivestreams.Publisher
import play.api.libs.json.{Format, JsSuccess, Json}
import scala.concurrent.Future
abstract class ... | leanovate/contoso-conference-manager | app/dao/EventDao.scala | Scala | apache-2.0 | 936 |
import sbt._
//noinspection TypeAnnotation
object Dependencies {
val apacheHttp = "org.apache.httpcomponents" % "httpclient" % "4.3.3"
val jsonParser1 = "io.circe" %% "circe-parser" % "0.13.0"
val jsonParser2 = "io.circe" %% "circe-generic" % "0.13.0"
val cats = "org.typelevel" %% "cats-core" % "2.1.1"
val c... | lure/YoutubeGrabber | project/Dependencies.scala | Scala | apache-2.0 | 676 |
/*
* 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 ... | prccaraujo/openwhisk | tests/src/test/scala/whisk/core/controller/test/AuthenticateV2Tests.scala | Scala | apache-2.0 | 2,747 |
import scala.annotation.static
class Base
object Base {
@static val x = 10
@static final val y = 10
@static var a = 10
@static final var b = 10
@static def f: Int = 30
}
object Test {
def main(args: Array[String]): Unit = Base
} | som-snytt/dotty | tests/run/i5924c.scala | Scala | apache-2.0 | 243 |
package monocle
import monocle.macros.{GenIso, GenPrism}
import monocle.std._
class PrismExample extends MonocleSuite {
sealed trait IntOrString
case class I(i: Int) extends IntOrString
case class S(s: String) extends IntOrString
val _i = GenPrism[IntOrString, I] composeIso GenIso[I, Int]
val _s = Prism[I... | malcolmgreaves/Monocle | example/src/test/scala/monocle/PrismExample.scala | Scala | mit | 2,565 |
package other
import monocle.{Iso, MonocleSuite}
import monocle.law.discipline.{IsoTests, LensTests, PrismTests}
import monocle.macros.{GenIso, GenLens, GenPrism}
import org.scalacheck.Arbitrary.{arbOption => _, _}
import org.scalacheck.{Arbitrary, Gen}
import scalaz.Equal
import scalaz.std.option._
class MacroOutSi... | japgolly/Monocle | test/src/test/scala/other/MacroOutSideMonocleSpec.scala | Scala | mit | 4,074 |
/*
* 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/AC75.scala | Scala | apache-2.0 | 1,120 |
package gg.uhc.hosts.database
import java.time.Instant
import java.util.UUID
case class UblRow(
id: Long,
ign: String,
uuid: UUID,
reason: String,
created: Instant,
expires: Option[Instant],
link: String,
createdBy: String)
| Eluinhost/hosts.uhc.gg | src/main/scala/gg/uhc/hosts/database/UblRow.scala | Scala | mit | 258 |
package models
import scala.collection.mutable.ArrayBuffer
import java.io.File
import play.api.Play.current
import anorm._
import anorm.SqlParser._
import play.api.db.DB
case class User(name: String)
case class Directory(path: String) {
def toFile = new File(path)
}
object Configuration {
priv... | PaulKeeble/TVTracker | app/models/Configuration.scala | Scala | gpl-2.0 | 1,595 |
package ch.ninecode.cim
import java.io.ByteArrayOutputStream
import java.net.URI
import java.nio.charset.StandardCharsets
import java.util.Date
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import scala.reflect.ClassTag
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.File... | derrickoswald/CIMScala | CIMExport/src/main/scala/ch/ninecode/cim/CIMExport.scala | Scala | mit | 33,086 |
package services.dao;
import java.util.Date
import scala.concurrent.Future
import models.user.Account
import models.user.Column
import models.user.ProviderUser
import models.user.SkimboToken
import play.api.Play.current
import play.modules.reactivemongo.ReactiveMongoPlugin
import reactivemongo.bson.BSONDocument
import... | Froggies/Skimbo | app/services/dao/UserDao.scala | Scala | agpl-3.0 | 9,059 |
/*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | psyyz10/BigDL | spark/dl/src/test/scala/com/intel/analytics/bigdl/dataset/TransformersSpec.scala | Scala | apache-2.0 | 38,406 |
package tddmicroexercises.leaderboard
import scala.collection.mutable
class Leaderboard(val races: List[Race]) {
def driver_results(): Map[String, Int] = {
val results = mutable.Map[String, Int]().withDefaultValue(0)
races.foreach((race: Race) => {
race.results.foreach((driver: Driver) => {
v... | geleouet/Racing-Car-Katas | scala/src/main/scala/tddmicroexercises/leaderboard/Leaderboard.scala | Scala | mit | 700 |
package com.bio4j.release.generic.uniref
import com.bio4j.data.uniref._
import com.bio4j.model._
import scala.compat.java8.OptionConverters._
case class ImportUniRef[V,E](val graph: UniRefGraph[V,E]) {
type G = UniRefGraph[V,E]
def g: G = graph
def uniref50Cluster(clusterEntry: AnyCluster): Option[G#UniRef50C... | bio4j/bio4j-data-import | src/main/scala/uniref/uniref.scala | Scala | agpl-3.0 | 3,414 |
package provingground.learning
import org.tensorflow._
import org.tensorflow.op._, linalg.MatMul
import org.tensorflow.types._
import scala.util.Using
import org.tensorflow.ndarray._
import org.tensorflow.framework.optimizers._
import IngredientsRepresentation._
import provingground._, HoTT._
object IngredientsRepres... | siddhartha-gadgil/ProvingGround | jvmcore/src/main/scala/provingground/learning/IngredientsRepresentation.scala | Scala | mit | 2,748 |
package testfile
import java.something.com
package object SomeObject[A <: B] extends Implicits {
type Booger[A] = A => Unit
type SomeType = A <: B :> C
type SomeOtherType = A ⇒ Thing
type Something
type Something <: SomethingElse
type ParserContext = Context { type PrefixType = Parser }
new Something#... | ruchee/vimrc | vimfiles/bundle/vim-scala/syntax/testfile.scala | Scala | mit | 5,378 |
package com.gxq.learn.kafka.demo
import org.apache.spark._
import org.apache.spark.streaming._
import org.apache.kafka.clients.consumer.ConsumerRecord
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.spark.streaming.kafka010._
import org.apache.spark.streaming.kafka010.LocationStrategi... | gong1989313/spark-bigdata | gpfDWLogMonitor/src/test/scala/com/gxq/learn/kafka/demo/SparkKafkaUtilsMsgReceive.scala | Scala | apache-2.0 | 1,511 |
package io.buoyant.grpc.runtime
import com.twitter.finagle.buoyant.h2
private[runtime] object H2Headers {
private[this] val AuthorityHeader = h2.Headers.Authority -> ""
private[this] val ContentTypeHeader = "content-type" -> "application/grpc+proto"
private[this] val MethodHeader = h2.Headers.Method -> h2.Metho... | linkerd/linkerd | grpc/runtime/src/main/scala/io/buoyant/grpc/runtime/H2Headers.scala | Scala | apache-2.0 | 736 |
package com.haskforce.codeInsight
import java.util
import java.util.stream.Collectors
import com.haskforce.HaskellIcons
import com.intellij.codeInsight.lookup.{LookupElement, LookupElementBuilder}
object LookupElementUtil {
def create(name: String, module: String, typ: String): LookupElement = {
LookupElementB... | carymrobbins/intellij-haskforce | src/com/haskforce/codeInsight/LookupElementUtil.scala | Scala | apache-2.0 | 928 |
/*
* Copyright © 2015 Lukas Rosenthaler, Benjamin Geer, Ivan Subotic,
* Tobias Schweizer, André Kilchenmann, and Sepideh Alassi.
* This file is part of Knora.
* Knora is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free So... | nie-ine/Knora | webapi/src/test/scala/org/knora/webapi/http/CORSSupportV1R2RSpec.scala | Scala | agpl-3.0 | 3,239 |
/*
* Copyright (c) 2013, Scodec
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions a... | scodec/scodec | shared/src/main/scala/scodec/codecs/DoubleCodec.scala | Scala | bsd-3-clause | 2,387 |
package org.jetbrains.plugins.scala
package annotator
package gutter
import com.intellij.codeInsight.navigation.NavigationUtil
import com.intellij.ide.util.EditSourceUtil
import com.intellij.lang.LanguageCodeInsightActionHandler
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
impo... | advancedxy/intellij-scala | src/org/jetbrains/plugins/scala/annotator/gutter/ScalaGoToSuperActionHandler.scala | Scala | apache-2.0 | 5,150 |
package katas.scala.classic_katas.wordchain
import org.junit.Test
import org.scalatest.Matchers
import scala.collection.mutable
import scala.io.Source
/**
* User: dima
* Date: 31/07/2012
*/
class WordChain9 extends Matchers {
@Test def shouldFindSingleWordChain() {
findMinWordChain("aaa", "bbb", Set("aaa", "... | dkandalov/katas | scala/src/katas/scala/classic_katas/wordchain/WordChain9.scala | Scala | unlicense | 3,845 |
/*
* 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 ... | michalsenkyr/spark | core/src/main/scala/org/apache/spark/metrics/ExecutorMetricType.scala | Scala | apache-2.0 | 3,764 |
package com.roundeights.skene
import java.lang.reflect.{InvocationHandler, Method, Proxy}
/**
* An invocation handler that collects a map of other objects into one class
*
* @param joined A map of classes to their instances
*/
class Bundle private[skene] (
private val joined: Map[Class[_], Any] = Map()
) exte... | Nycto/Skene | src/main/scala/skene/prereq/Bundle.scala | Scala | mit | 2,519 |
package com.cerner.beadledom.jooq
import com.google.inject.{AbstractModule, CreationException, Guice}
import javax.sql.DataSource
import org.jooq.SQLDialect
import org.jooq.tools.jdbc.MockConnection
import org.mockito.Mockito.when
import org.scalatest.mockito.MockitoSugar
import org.scalatest.{BeforeAndAfter, FunSpec,... | bbaugher/beadledom | jooq/src/test/scala/com/cerner/beadledom/jooq/ThreadLocalJooqModuleSpec.scala | Scala | apache-2.0 | 3,302 |
/*
* 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 ... | wangyixiaohuihui/spark2-annotation | sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala | Scala | apache-2.0 | 21,223 |
/**
* Copyright (C) 2010-2012 LShift Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | 0x6e6562/diffa | client-support/src/test/scala/net/lshift/diffa/client/ValidatingScanResultParserTest.scala | Scala | apache-2.0 | 4,363 |
package pl.touk.nussknacker.engine.avro.sink.flink
import io.confluent.kafka.schemaregistry.client.SchemaRegistryClient
import org.scalatest.{FunSuite, Matchers}
import pl.touk.nussknacker.engine.ModelData
import pl.touk.nussknacker.engine.api.process.{EmptyProcessConfigCreator, ProcessObjectDependencies, SinkFactory,... | TouK/nussknacker | engine/flink/avro-components-utils/src/test/scala/pl/touk/nussknacker/engine/avro/sink/flink/KafkaAvroSinkExceptionHandlingSpec.scala | Scala | apache-2.0 | 3,721 |
/*
* 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 ... | aosagie/spark | sql/core/src/main/scala/org/apache/spark/sql/streaming/ProcessingTime.scala | Scala | apache-2.0 | 4,112 |
package io.getquill.context.sql.norm
import io.getquill.Spec
import io.getquill.ast.Aggregation
import io.getquill.ast.AggregationOperator
import io.getquill.ast.Ident
import io.getquill.ast.Property
import io.getquill.context.sql.testContext._
class FlattenGroupByAggregationSpec extends Spec {
"flattens mapped ag... | mentegy/quill | quill-sql/src/test/scala/io/getquill/context/sql/norm/FlattenGroupByAggregationSpec.scala | Scala | apache-2.0 | 4,376 |
package com.codingkapoor.pageselectionbykeyword.model
import com.codingkapoor.pageselectionbykeyword.util.KeywordsBuilder
// Keywords are accepted as arguments as List(Review, Car) and returned as List((review,8), (car,7)).
// The idea here is to take constructor arguments in different format and return the Page obje... | codingkapoor/solve-for-x | scala/page-selection-by-keyword-matching-II-X/src/main/scala/com/codingkapoor/pageselectionbykeyword/model/Query.scala | Scala | mit | 818 |
/*
* 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 ... | ing-bank/scruid | src/main/scala/com/ing/wbaa/druid/definitions/QueryContext.scala | Scala | apache-2.0 | 5,132 |
package com.julianpeeters.avro.annotations
import record._
import ctorgen._
import namespacegen._
import methodgen._
import schemagen._
import scala.reflect.macros.blackbox.Context
import scala.language.experimental.macros
import scala.annotation.StaticAnnotation
import org.apache.avro.Schema
import org.apache.avro.... | rvvincelli/avro-scala-macro-annotations | macros/src/main/scala/avro/scala/macro/annotations/AvroRecordMacro.scala | Scala | apache-2.0 | 4,939 |
import sbt._
import Keys._
object BuildSettings {
val buildOrganization = "com.alpinenow"
val buildVersion = "0.1"
val buildScalaVersion = "2.10.3"
val buildSettings = Defaults.defaultSettings ++ Seq (
organization := buildOrganization,
version := buildVersion,
scalaVersion := buildScala... | RichardBradley/junit_xml_listener | src/sbt-test/full-example/project/Build.scala | Scala | mit | 680 |
package bifrost.transaction.bifrostTransaction
import java.time.Instant
import bifrost.crypto.hash.FastCryptographicHash
import BifrostTransaction.{Nonce, Value}
import bifrost.tokenBoxRegistry.TokenBoxRegistry
import bifrost.transaction.box.proposition.PublicKey25519Proposition
import bifrost.transaction.box... | Topl/Project-Bifrost | src/main/scala/bifrost/transaction/bifrostTransaction/PolyTransfer.scala | Scala | mpl-2.0 | 3,495 |
/*
* 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 | base/src/main/scala/org/openurp/base/std/model/DefaultMapping.scala | Scala | lgpl-3.0 | 1,073 |
/*
* 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 ... | lhfei/spark-in-action | spark-3.x/src/main/scala/org/apache/spark/examples/streaming/clickstream/PageViewStream.scala | Scala | apache-2.0 | 4,800 |
/*
* ChangeSpec.scala
*
* Copyright 2017 wayfarerx <x@wayfarerx.net> (@thewayfarerx)
*
* 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.... | wayfarerx/dreamsleeve | shared/data/src/test/scala/net/wayfarerx/dreamsleeve/data/ChangeSpec.scala | Scala | apache-2.0 | 2,039 |
package fastparsers.parsers
import fastparsers.input.InputWindow
import InputWindow.InputWindow
import scala.annotation.compileTimeOnly
import scala.util.parsing.input.Positional
/**
* Interface for Base parsers
*/
trait BaseParsers[Elem, Input] {
/*
Used to deconstruct tuples, i.e write case a~b => inste... | begeric/FastParsers | FastParsers/src/main/scala/fastparsers/parsers/BaseParsers.scala | Scala | mit | 4,501 |
/*
* 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 | app/model/report/QuestionnaireReportItem.scala | Scala | apache-2.0 | 1,625 |
package hmda.geo.protocol
import hmda.geo.model.Status
import spray.json.DefaultJsonProtocol
trait StatusJsonProtocol extends DefaultJsonProtocol {
implicit val statusFormat = jsonFormat4(Status.apply)
}
| cfpb/hmda-pip | api/src/main/scala/hmda/geo/protocol/StatusJsonProtocol.scala | Scala | cc0-1.0 | 208 |
import test._
import org.specs2.mutable.Specification
class SpecificComplexTest extends Specification {
"A case class with an empty `Option[String]` field" should {
"serialize and deserialize correctly" in {
val record1 = AvroTypeProviderTest07(None)
val record2 = AvroTypeProviderTest07(None)
... | julianpeeters/sbt-avrohugger | src/sbt-test/avrohugger/SpecificSerializationTests/src/test/scala/specific/SpecificComplexSpec.scala | Scala | apache-2.0 | 3,369 |
package common
object LongOps {
def streamFrom(n: Long): Stream[Long] = n #:: streamFrom(n + 1)
def iteratorFrom(n: Long): Iterator[Long] = streamFrom(n).toIterator
def streamSequence1(ab: Long, f: Long => Long): Stream[Long] = ab match {
case a => a #:: streamSequence1(f(a), f)
}
def streamSequence2... | filippovitale/pe | pe-common/src/main/scala/common/LongOps.scala | Scala | mit | 1,649 |
/*
* Copyright 2015 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 agr... | howyp/http-verbs | src/main/scala/uk/gov/hmrc/play/audit/http/HttpAuditEvent.scala | Scala | apache-2.0 | 2,460 |
/**
* TABuddy-Model - a human-centric K,V framework
*
* Copyright (c) 2012-2014 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.apach... | digimead/digi-TABuddy-model | src/main/scala/org/digimead/tabuddy/model/element/Value.scala | Scala | apache-2.0 | 5,742 |
/**
* 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... | engagepoint/camel | components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/TryCatchFinallyTest.scala | Scala | apache-2.0 | 2,253 |
/*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package java.util
trait NavigableSet[E] exten... | scala-js/scala-js | javalib/src/main/scala/java/util/NavigableSet.scala | Scala | apache-2.0 | 958 |
package akka.s3
import java.nio.file.{Files, Paths}
import org.scalatest.FunSuite
class UtilTest extends FunSuite {
test("condApply") {
assert(1.applyIf(true) { a => a + 1 } === 2)
assert(1.applyIf(false) { a => a + 1 } === 1)
}
test("option plus (<+)") {
assert((Some(1) `<+` Some(2)) === Some(... | akiradeveloper/akka-s3 | src/test/scala/akka/s3/UtilTest.scala | Scala | apache-2.0 | 1,457 |
package org.mentha.tools.archimate.model.edges
import org.mentha.tools.archimate.model._
object GenericMetamodel {
}
/**
* Structural relationships represent the ‘static’ coherence within an architecture. The composing concept (the ‘from’ side of the relationship) is always an element; the composed concept (the ‘... | zhuj/mentha-web-archimate | archimate-model/src/main/scala/org/mentha/tools/archimate/model/edges/GenericMetamodel.scala | Scala | mit | 1,462 |
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.