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 scodec
package codecs
class DiscriminatorCodecTest extends CodecSuite {
"the discriminator combinators" should {
"support building a codec using typecases" in {
val codec =
discriminated[AnyVal].by(uint8)
.typecase(0, int32)
.typecase(1, bool)
roundtrip(codec, true)... | alissapajer/scodec | shared/src/test/scala/scodec/codecs/DiscriminatorCodecTest.scala | Scala | bsd-3-clause | 5,550 |
package lila.tournament
import org.joda.time.DateTime
import org.joda.time.format.ISODateTimeFormat
import play.api.libs.json._
import scala.concurrent.duration._
import chess.Clock.{ Config => TournamentClock }
import lila.common.LightUser
import lila.common.PimpedJson._
import lila.game.{ Game, GameRepo, Pov }
impo... | clarkerubber/lila | modules/tournament/src/main/JsonView.scala | Scala | agpl-3.0 | 12,402 |
/* Copyright 2009-2021 EPFL, Lausanne */
import stainless.annotation._
object IfExpr1 {
def foo(): Int = {
var a = 1
var b = 2
if({a = a + 1; a != b})
a = a + 3
else
b = a + b
a
} ensuring(_ == 2)
}
| epfl-lara/stainless | frontends/benchmarks/imperative/valid/IfExpr1.scala | Scala | apache-2.0 | 238 |
// #Sireum
/*
Copyright (c) 2017, Robby, Kansas State University
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
l... | sireum/v3-runtime | library/shared/src/main/scala/org/sireum/Option.scala | Scala | bsd-2-clause | 4,177 |
package mesosphere.marathon
package raml
import mesosphere.marathon.state.{AbsolutePathId, AppDefinition, PathId, Timestamp, Group => CoreGroup, VersionInfo => CoreVersionInfo}
object GroupConversion {
def apply(groupUpdate: GroupUpdate, current: CoreGroup, timestamp: Timestamp): UpdateGroupStructureOp =
Update... | mesosphere/marathon | src/main/scala/mesosphere/marathon/raml/GroupConversion.scala | Scala | apache-2.0 | 5,053 |
package games.utils
import scala.collection.mutable.Map
import scala.collection.mutable.ArrayBuffer
import games.math.{ Vector2f, Vector3f, Vector4f, Matrix3f }
object SimpleOBJParser {
class TexInfo(var path: String) {
var blendu: Boolean = true
var blendv: Boolean = true
var bumpMultiplier: Option[Fl... | joelross/scalajs-games | demo/shared/src/main/scala/games/utils/SimpleOBJParser.scala | Scala | bsd-3-clause | 24,316 |
//############################################################################
// Enumerations
//############################################################################
object Test1 {
object WeekDays extends Enumeration {
val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
}
def isWorkingDay(d: WeekDays.Va... | scala/scala | test/files/run/enums.scala | Scala | apache-2.0 | 4,167 |
object Test extends App {
// #2235
new A2235 with B2235
}
// only one overloaded alternative is allowed to have defaults
class A {
def foo(a: Int = 0) = a
def foo(b: String = "another") = b
}
class B {
def foo(a: Int) = a
def bar(u: String = "ldksj") = u
}
class C extends B {
override def foo(a: Int = ... | yusuke2255/dotty | tests/untried/neg/names-defaults-neg-ref.scala | Scala | bsd-3-clause | 487 |
package io.finch.endpoint
import cats.effect.Sync
import com.twitter.io.{Buf, Reader}
import io.finch._
import io.finch.internal._
import io.finch.items._
import java.nio.charset.{Charset, StandardCharsets}
import scala.reflect.ClassTag
private[finch] abstract class FullBody[F[_], A] extends Endpoint[F, A] {
prote... | ImLiar/finch | core/src/main/scala/io/finch/endpoint/body.scala | Scala | apache-2.0 | 4,655 |
// Copyright: 2010 - 2017 https://github.com/ensime/ensime-server/graphs
// License: http://www.gnu.org/licenses/gpl-3.0.en.html
package org.ensime.core.javac
import javax.lang.model.`type`.{ ArrayType, DeclaredType }
import scala.collection.JavaConverters._
import scala.collection.breakOut
import scala.collection.mut... | jozi-k/ensime-server | core/src/main/scala/org/ensime/core/javac/JavaCompletionsAtPoint.scala | Scala | gpl-3.0 | 11,904 |
//package io.eels.component.hive.dialect
//
//import java.io.{BufferedReader, InputStream, InputStreamReader}
//
//import com.github.tototoshi.csv.{CSVWriter, DefaultCSVFormat}
//import com.sksamuel.exts.Logging
//import com.typesafe.scalalogging.slf4j.StrictLogging
//import io.eels.component.hive.{HiveDialect, HiveWri... | eel-lib/eel | eel-hive/src/main/scala/io/eels/component/hive/dialect/TextHiveDialect.scala | Scala | mit | 2,346 |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2015-2021 Andre White.
*
* 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
*
* https://www.apache.org/licenses/LICENSE... | adarro/ddo-calc | subprojects/common/ddo-core/src/main/scala/io/truthencode/ddo/model/feats/BelovedOfAmaunator.scala | Scala | apache-2.0 | 1,123 |
import scala.quoted.*
object Macro {
def impl[A : Type](using Quotes): Expr[A] = {
import quotes.reflect.*
TypeRepr.of[A].asType match
case '[tpe] => '{ (a: tpe) => ???}
'{???}
}
} | dotty-staging/dotty | tests/pos-macros/i8865.scala | Scala | apache-2.0 | 203 |
/*
* Copyright (c) 2014 François Cabrol.
*
* This file is part of MURAL.
*
* MURAL 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... | francoiscabrol/MURAL | src/main/scala/com/cabrol/francois/mural/generator/rulebased/parameters/Parameters.scala | Scala | gpl-3.0 | 2,449 |
package com.sksamuel.elastic4s
import com.sksamuel.elastic4s.ElasticDsl._
import com.sksamuel.elastic4s.Preference.Shards
import com.sksamuel.elastic4s.SuggestMode.{Missing, Popular}
import com.sksamuel.elastic4s.analyzers.{SnowballAnalyzer, StandardAnalyzer, WhitespaceAnalyzer}
import org.elasticsearch.common.geo.Geo... | k4200/elastic4s | elastic4s-core-tests/src/test/scala/com/sksamuel/elastic4s/SearchDslTest.scala | Scala | apache-2.0 | 37,683 |
package org.jetbrains.plugins.scala.lang.psi
import com.intellij.psi._
import org.jetbrains.plugins.scala.editor.documentationProvider.ScalaDocumentationProvider
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScFunction
import org.jetbrains.plugins.scala.lang... | gtache/intellij-lsp | intellij-lsp-dotty/src/org/jetbrains/plugins/scala/lang/psi/PresentationUtil.scala | Scala | apache-2.0 | 5,484 |
package com.github.diegopacheco.sandbox.scala.akka.dispatcher
package com.github.diegopacheco.sandbox.scala.akka.timeout
import akka.actor.Actor
import akka.actor.ActorRef
import akka.actor.ActorSystem
import akka.actor.Props
import akka.actor.actorRef2Scala
/**
* Dispatchers:
* - Dispatcher -> shared pool -... | diegopacheco/scala-playground | scala_11_akka_23_full_playground/src/main/scala/com/github/diegopacheco/sandbox/scala/akka/dispatcher/DispatcherApp.scala | Scala | unlicense | 1,319 |
/*
* Copyright 2010 LinkedIn
*
* 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 w... | tcrayford/hafka | kafka/core/src/main/scala/kafka/javaapi/message/ByteBufferMessageSet.scala | Scala | bsd-3-clause | 3,456 |
package com.arcusys.valamis.updaters.version310.certificateHistory
import com.arcusys.valamis.persistence.common.DbNameUtils._
import com.arcusys.valamis.persistence.common.{SlickProfile, TypeMapper}
import com.arcusys.valamis.updaters.common.model.PeriodTypes
import com.arcusys.valamis.updaters.version310.model.certi... | arcusys/Valamis | valamis-updaters/src/main/scala/com/arcusys/valamis/updaters/version310/certificateHistory/CertificateHistoryTableComponent.scala | Scala | gpl-3.0 | 2,184 |
/*
* Copyright 2010 the 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 applicable l... | tkrueger/awaitility | awaitility-scala/src/test/scala/com/jayway/awaitility/scala/AwaitilitySupportTest.scala | Scala | apache-2.0 | 1,825 |
package io.scalajs.nodejs
package zlib
import scala.scalajs.js
/**
* Decompress a raw deflate stream.
* @author [email protected]
*/
@js.native
trait InflateRaw extends CompressionAlgorithm | scalajs-io/nodejs | app/common/src/main/scala/io/scalajs/nodejs/zlib/InflateRaw.scala | Scala | apache-2.0 | 206 |
package chandu0101.scalajs.react.components.reactbootstrap
import japgolly.scalajs.react.ReactComponentU_
import japgolly.scalajs.react.vdom.prefix_<^._
import japgolly.scalajs.react.React
import scala.scalajs.js
/**
* Created by chandrasekharkode on 11/29/14.
*
* Its wrapper for reactbootstrap , you need js so... | coreyauger/scalajs-react-components | core/src/main/scala/chandu0101/scalajs/react/components/reactbootstrap/Bootstrap.scala | Scala | apache-2.0 | 41,721 |
/**
* Copyright (C) 2011 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... | brunobuzzi/orbeon-forms | xforms/jvm/src/test/scala/org/orbeon/oxf/xforms/control/controls/SubmissionHeadersTest.scala | Scala | lgpl-2.1 | 4,643 |
/**
* Copyright (C) 2014 TU Berlin ([email protected])
*
* 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... | peelframework/peel | peel-core/src/main/scala/org/peelframework/core/beans/data/CopiedDataSet.scala | Scala | apache-2.0 | 1,663 |
/***********************************************************************
* Copyright (c) 2013-2020 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... | aheyne/geomesa | geomesa-filter/src/main/scala/org/locationtech/geomesa/filter/visitor/QueryPlanFilterVisitor.scala | Scala | apache-2.0 | 15,450 |
/* __ *\\
** ________ ___ / / ___ __ ____ Scala.js Benchmarks **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, Jonas Fonseca **
** __\\ \\/ /__/ __ |/ /__/ __ |/_// /_\\ \\ **
** /____/\\___/... | sjrd/scalajs-benchmarks | sudoku/src/main/scala/org/scalajs/benchmark/sudoku/Sudoku.scala | Scala | bsd-3-clause | 6,904 |
/*
* Copyright 2014–2017 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | drostron/quasar | common/src/main/scala/quasar/common/package.scala | Scala | apache-2.0 | 1,200 |
/*
* Copyright 2012-2020 the 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 ap... | planet42/Laika | core/shared/src/main/scala/laika/rst/BaseParsers.scala | Scala | apache-2.0 | 2,941 |
package skinny.controller.feature
import skinny.engine.SkinnyEngineBase
import skinny.engine.json.EngineJSONStringOps
import skinny.json.AngularJSONStringOps
/**
* Angular application's server side API support.
*/
trait AngularJSONFeature
extends EngineJSONStringOps
with AngularJSONStringOps { self: SkinnyE... | holycattle/skinny-framework | framework/src/main/scala/skinny/controller/feature/AngularJSONFeature.scala | Scala | mit | 336 |
package almhirt.context
import akka.actor.ActorRef
import almhirt.common._
import almhirt.akkax.{ CircuitControl, ComponentId }
import almhirt.herder.HerderMessages
trait HasAlmhirtContext {
implicit def almhirtContext: AlmhirtContext
} | chridou/almhirt | almhirt-core/src/main/scala/almhirt/context/HasAlmhirtContext.scala | Scala | apache-2.0 | 240 |
package truerss.db.driver
import java.nio.file.Paths
import java.util.Properties
import slick.jdbc._
import truerss.util.DbConfig
trait DBProfile {
val profile: JdbcProfile
val driver: String
val sourceClassName: String
val defaultConnectionSize: Int = 10
def props(dbConf: DbConfig, isUserConf: Boolean):... | truerss/truerss | src/main/scala/truerss/db/driver/DBProfile.scala | Scala | mit | 2,521 |
package com.bwsw.tstreamstransactionserver.netty.server.db.zk
import java.util.concurrent.ConcurrentHashMap
import com.bwsw.tstreamstransactionserver.netty.server.streamService.{StreamCRUD}
import com.bwsw.tstreamstransactionserver.netty.server.streamService
import org.apache.curator.framework.CuratorFramework
fina... | bwsw/tstreams-transaction-server | src/main/scala/com/bwsw/tstreamstransactionserver/netty/server/db/zk/StreamDatabaseZK.scala | Scala | apache-2.0 | 1,775 |
/*
* 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 ... | cloudera/spark | core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala | Scala | apache-2.0 | 12,776 |
// Copyright (c) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors)
//
// 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, in... | hypertino/ScalaMock | examples/jvm/com/example/proxy/mockitostyle/OrderTest.scala | Scala | mit | 2,275 |
package medium
import medium.MediumApiProtocol._
import medium.domainObjects._
import okhttp3._
import spray.json._
class MediumClient(clientId: String, clientSecret: String, var accessToken: Option[String] = None) {
val client = new OkHttpClient()
val baseApiUrl: HttpUrl = new HttpUrl.Builder()
.scheme("htt... | shekhargulati/52-technologies-in-2016 | 06-okhttp/medium-scala-client/src/main/scala/medium/MediumClient.scala | Scala | mit | 2,566 |
/*
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Ryan C. Brozo
*
* 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 ... | ryanbrozo/spray-hawk | lib/src/main/scala/com/ryanbrozo/spray/hawk/AuthHeaderAttributes.scala | Scala | mit | 2,984 |
/*
* 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 ... | rikima/spark | external/avro/src/main/scala/org/apache/spark/sql/avro/SchemaConverters.scala | Scala | apache-2.0 | 8,223 |
package org.oedura.scavro
import org.apache.avro.Schema
/* Mock class for reading/writing */
case class Number(name: String, value: Int) extends AvroSerializeable {
type J = MockNumber
override def toAvro: MockNumber = new MockNumber(name, value)
}
object Number {
implicit def reader = new AvroReader[Number] {... | oedura/scavro | src/test/scala/org/oedura/scavro/Number.scala | Scala | apache-2.0 | 737 |
package com.gilt.gfc.aws.kinesis.client
/**
* Simplified view of AWS SDK's kinesis record, just a couple of things we care about.
*/
case class KinesisRecord (
partitionKey: String,
data: Array[Byte]
)
/** 'type class' of things that can be converted to KinesisRecord. */
trait KinesisRecordWriter[R] {
def toK... | gilt/gfc-aws-kinesis | client/src/main/scala/com/gilt/gfc/aws/kinesis/client/KinesisRecord.scala | Scala | apache-2.0 | 356 |
package mesosphere.marathon.state
import mesosphere.marathon.metrics.Metrics
import scala.concurrent.Future
/**
* Stores the last TaskFailure per app id.
*/
class TaskFailureRepository(
protected val store: EntityStore[TaskFailure],
protected val maxVersions: Option[Int] = Some(1),
protected val metrics: M... | Kosta-Github/marathon | src/main/scala/mesosphere/marathon/state/TaskFailureRepository.scala | Scala | apache-2.0 | 656 |
package com.pharmpress.scalaencoder
case class Employee(name: String, number: Int, manager: Boolean)
| pharmpress/codingdojo | scala-serializer/src/test/scala/com/pharmpress/scalaencoder/Employee.scala | Scala | apache-2.0 | 102 |
package de.htwg.zeta.server.model.metaModel
import javax.inject.Inject
import javax.inject.Singleton
import akka.actor.ActorRef
import akka.actor.ActorSystem
@Singleton
class MetaModelWsMediatorContainer @Inject()(private val system: ActorSystem) {
val mediator: ActorRef = system.actorOf(MetaModelWsMediatorActor.p... | Zeta-Project/zeta | api/server/app/de/htwg/zeta/server/model/metaModel/MetaModelWsMediatorContainer.scala | Scala | bsd-2-clause | 353 |
def tail[A]: Stream[A] => Stream[A] = {
case Stream(a, as) => as()
} | hmemcpy/milewski-ctfp-pdf | src/content/3.7/code/scala/snippet21.scala | Scala | gpl-3.0 | 70 |
/*
* Copyright 2019 http4s.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://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | http4s/http4s | ember-client/shared/src/test/scala/org/http4s/ember/client/internal/ClientHelpersSuite.scala | Scala | apache-2.0 | 5,671 |
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
package com.krux.hyperion.precondition
import com.krux.hyperion.adt.HString
import com.kru... | realstraw/hyperion | core/src/main/scala/com/krux/hyperion/precondition/DynamoDBDataExistsPrecondition.scala | Scala | bsd-3-clause | 1,726 |
/**
* Copyright (C) 2009-2011 the original author or authors.
* See the notice.md 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... | dnatic09/scalate | scalate-util/src/main/scala/org/fusesource/scalate/util/Threads.scala | Scala | apache-2.0 | 927 |
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.tools.nsc
packag... | scala/scala | src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala | Scala | apache-2.0 | 807 |
/**
* 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... | archieco/kafka | core/src/main/scala/kafka/admin/AdminUtils.scala | Scala | apache-2.0 | 4,959 |
package com.twitter.util
import org.apache.thrift.TBase
import org.apache.thrift.protocol.{TBinaryProtocol, TCompactProtocol, TProtocolFactory}
object ThriftCodec {
def apply[T <: TBase[_, _]: Manifest, P <: TProtocolFactory: Manifest]: ThriftCodec[T, P] =
new ThriftCodec[T, P]
}
class ThriftCodec[T <: TBase[_... | edombowsky/util | util-thrift/src/main/scala/com/twitter/util/ThriftCodec.scala | Scala | apache-2.0 | 1,057 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | ueshin/apache-spark | sql/core/src/test/scala/org/apache/spark/sql/ColumnExpressionSuite.scala | Scala | apache-2.0 | 117,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 | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala | Scala | apache-2.0 | 6,789 |
/*
* Copyright 2014 Renaud Bruneliere
*
* 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 agree... | bruneli/scalaopt | core/src/test/scala/com/github/bruneli/scalaopt/core/linesearch/StrongWolfeSpec.scala | Scala | apache-2.0 | 2,912 |
package security
import javax.inject.{Inject, Singleton}
import be.objectify.deadbolt.scala.{DeadboltHandler, HandlerKey}
import be.objectify.deadbolt.scala.cache.HandlerCache
/**
* @author Steve Chaloner ([email protected])
*/
@Singleton
class MyHandlerCache @Inject() (defaultHandler: DeadboltHandler) extends ... | Arquisuave/oilcol-app-play | app/security/MyHandlerCache.scala | Scala | mit | 593 |
package net.benmur.riemann.client.testingsupport
import akka.actor.Actor
import akka.actor.actorRef2Scala
import akka.event.Logging.InitializeLogger
import akka.event.Logging.LoggerInitialized
class NopEventHandler extends Actor {
def receive: Receive = {
case InitializeLogger(_) => sender ! LoggerInitialized
... | benmur/riemann-scala-client | src/test/scala/net/benmur/riemann/client/testingsupport/NopEventHandler.scala | Scala | mit | 324 |
package org.inosion.dadagen.auto
import org.scalatest.{FlatSpec, Matchers}
case class MyTest(firstname: String, surname: String)
class ScalaClassReadTest extends FlatSpec with Matchers {
"The dadagen reader" should "populate all simple fields" in {
val testInstances: IndexedSeq[MyTest] = dadagen[MyTest].ge... | inosion/dadagen | dadagen-core/src/test/scala/org/inosion/dadagen/auto/ScalaClassReadTest.scala | Scala | apache-2.0 | 400 |
package repository
import org.specs2.specification.Scope
import play.api.test.{DefaultAwaitTimeout, FutureAwaits}
import reactivemongo.bson.BSONObjectID
import securesocial.core.authenticator.IdGenerator
import utils.UniqueStrings
import securesocial.core._
import securesocial.core.providers.UsernamePasswordProvider
... | timothygordon32/reactive-todolist | it/repository/ProfileTestCase.scala | Scala | mit | 1,533 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | pgandhi999/spark | sql/core/src/test/scala/org/apache/spark/sql/StringFunctionsSuite.scala | Scala | apache-2.0 | 15,981 |
package scala.tools.nsc
package transform.patmat
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import scala.tools.asm.Opcodes._
import scala.tools.nsc.backend.jvm.AsmUtils._
import scala.tools.testkit.BytecodeTesting
import scala.tools.testkit.BytecodeTesting._
@RunWith(classO... | martijnhoekstra/scala | test/junit/scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala | Scala | apache-2.0 | 5,903 |
// GENERATED CODE: DO NOT EDIT
package org.usagram.clarify
case class Validity3[+V1, +V2, +V3](_1: Definite[V1], _2: Definite[V2], _3: Definite[V3])
extends Validity with Product3[Definite[V1], Definite[V2], Definite[V3]] {
val values = Seq(_1, _2, _3)
def resolve[R](resolve: (V1, V2, V3) => R): R =
if (... | takkkun/clarify | core/src/main/scala/org/usagram/clarify/Validity3.scala | Scala | mit | 453 |
/*
* Copyright 2017 Guy Van den Broeck <[email protected]>
*
* 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 ... | UCLA-StarAI/ScalaDD | src/main/scala/edu/ucla/cs/starai/sdd/ComposableXYDecomposition.scala | Scala | apache-2.0 | 2,735 |
package at.logic.gapt.examples.tip.prod
import at.logic.gapt.expr._
import at.logic.gapt.formats.ClasspathInputFile
import at.logic.gapt.formats.tip.TipSmtParser
import at.logic.gapt.proofs.gaptic._
import at.logic.gapt.proofs.{ Ant, Sequent }
object prop_06 extends TacticsProof {
val bench = TipSmtParser.fixupAndP... | gebner/gapt | examples/tip/prod/prop_06.scala | Scala | gpl-3.0 | 3,799 |
/*
* Copyright 2015 PayPal
*
* 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 ... | keshin/squbs | squbs-testkit/src/main/scala/org/squbs/testkit/Tags.scala | Scala | apache-2.0 | 771 |
package ca.jimr.scalatron.api
/*
* All the game entities
*/
abstract class Entity(val character: Char)
object Entity {
case object Unknown extends Entity('?')
case object Empty extends Entity('_')
case object Wall extends Entity('W')
case object Me extends Entity('M')
case object MiniMe extends Entity('... | jriecken/scalatron-bots | src/main/scala/ca/jimr/scalatron/api/Entity.scala | Scala | mit | 1,151 |
package com.themillhousegroup.edn
import org.specs2.mutable.Specification
import com.themillhousegroup.edn.test.EDNParsing
import scala.util.Try
import com.themillhousegroup.edn.test.CaseClassFixtures._
import scala.reflect.runtime.universe._
import scala.Product
class ReadIntoFlatCaseClassSpec extends Specification ... | themillhousegroup/edn-scala | src/test/scala/com/themillhousegroup/edn/ReadIntoFlatCaseClassSpec.scala | Scala | gpl-2.0 | 4,480 |
package com.github.mdr.graphospasm.grapheditor.part
import com.github.mdr.graphospasm.grapheditor.figure.NodeFigure
import com.github.mdr.graphospasm.grapheditor.Plugin
import org.eclipse.swt.graphics.Color
import org.eclipse.draw2d.IFigure
import org.eclipse.gef.EditPart
import org.eclipse.gef.GraphicalEditPart
impor... | mdr/graphospasm | com.github.mdr.graphospasm.grapheditor/src/main/scala/com/github/mdr/graphospasm/grapheditor/part/NodeTargetFeedbackEditPolicy.scala | Scala | mit | 1,571 |
package vexriscv.plugin
import vexriscv._
import spinal.core._
import spinal.lib._
import scala.collection.mutable.ArrayBuffer
class PcManagerSimplePlugin(resetVector : BigInt,
relaxedPcCalculation : Boolean = false,
keepPcPlus4 : Boolean = true) exten... | SpinalHDL/VexRiscv | src/main/scala/vexriscv/plugin/PcManagerSimplePlugin.scala | Scala | mit | 4,874 |
package org.jetbrains.plugins.scala.worksheet
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.openapi.fileTypes.LanguageFileType
import com.intellij.psi.PsiFile
import org.jetbrains.plugins.scala.base.SharedTestProjectToken
import org.jetbrains.plugins.scala.{LatestScalaVersions, ScalaVersio... | JetBrains/intellij-scala | scala/worksheet/test/org/jetbrains/plugins/scala/worksheet/WorksheetLanguageFeatureInspectionBaseTest.scala | Scala | apache-2.0 | 3,459 |
/*
* 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 ... | bwsw/sj-platform | core/sj-crud-rest/src/main/scala/com/bwsw/sj/crud/rest/cors/CorsSupport.scala | Scala | apache-2.0 | 2,147 |
/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager
import java.util.Properties
import akka.actor.{ActorRef, ActorSystem, Kill, Props}
import akka.pattern._
import akka.util.Timeout
import com.typesafe.config.{Config, ConfigFactor... | xuwei-k/kafka-manager | test/kafka/manager/TestLogkafkaViewCacheActor.scala | Scala | apache-2.0 | 3,430 |
package com.typesafe.sbt
package packager
import java.io.File
import java.nio.file.Files
import java.nio.file.attribute.{PosixFilePermission, PosixFilePermissions}
import scala.util.Try
/**
* Setting the file permissions
*/
object chmod {
/**
* Using java 7 nio API to set the permissions.
*
* @par... | fsat/sbt-native-packager | src/main/scala/com/typesafe/sbt/packager/FileUtil.scala | Scala | bsd-2-clause | 2,286 |
package model
import skinny.DBSettings
import skinny.test._
import org.scalatest.fixture.FlatSpec
import org.scalatest._
import scalikejdbc._
import scalikejdbc.scalatest._
import org.joda.time._
class AdFrameTableSpec extends FlatSpec with Matchers with DBSettings with AutoRollback {
}
| yoshitakes/skinny-task-example | src/test/scala/model/AdFrameTableSpec.scala | Scala | mit | 290 |
package com.nekopiano.scala.processing.sandbox.poc.pdf
import com.nekopiano.scala.processing.{ScalaPApplet, ScalaPVector}
import processing.core.PGraphics;
/**
* Created on 26/07/2016.
*/
class LineRenderingApp extends ScalaPApplet {
var pdf:PGraphics = null
var record = false
override def settings(): Unit ... | lamusique/ScalaProcessing | samples/src/test/scala/com/nekopiano/scala/processing/sandbox/poc/pdf/LineRendering.scala | Scala | apache-2.0 | 1,055 |
package gitbucket.core.controller.api
import gitbucket.core.api.{ApiError, ApiLabel, CreateALabel, JsonFormat}
import gitbucket.core.controller.ControllerBase
import gitbucket.core.service._
import gitbucket.core.util.Implicits._
import gitbucket.core.util._
import org.scalatra.{Created, NoContent, UnprocessableEntity}... | imeszaros/gitbucket | src/main/scala/gitbucket/core/controller/api/ApiIssueLabelControllerBase.scala | Scala | apache-2.0 | 7,250 |
/*
* Licensed to the Programming Language and Software Methodology Lab (PLSM)
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
* The PLSM licenses this file to You under the Apache License, Version 2.0
... | NCCUCS-PLSM/sbt-archetype | sub/src/test/scala/edu/nccu/plsm/archetype/HelloWorldTest.scala | Scala | apache-2.0 | 1,291 |
package com.azavea.pointcloud.ingest
import com.azavea.pointcloud.ingest.conf.IngestConf
import io.pdal._
import geotrellis.pointcloud.pipeline._
import geotrellis.pointcloud.spark._
import geotrellis.pointcloud.spark.io._
import geotrellis.pointcloud.spark.io.hadoop._
import geotrellis.pointcloud.spark.io.s3._
impor... | lossyrob/geotrellis-pointcloud-demo | src/app-backend/ingest/src/main/scala/com/azavea/pointcloud/ingest/IngestPC.scala | Scala | apache-2.0 | 3,752 |
package com.automatak.render.dnp3.objects.groups
import com.automatak.render.dnp3.objects.{FixedSize, FixedSizeField, ObjectGroup}
import FixedSizeField._
// common time of occurrence
object Group51 extends ObjectGroup {
def objects = List(Group51Var1, Group51Var2)
def group: Byte = 51
def desc: String = "Time... | thiagoralves/OpenPLC_v2 | dnp3/generation/dnp3/src/main/scala/com/automatak/render/dnp3/objects/groups/Group51.scala | Scala | gpl-3.0 | 552 |
import S99.P05._
import org.scalatest._
class P05Spec extends FlatSpec {
"reverse(xs)" should "reverse a list" in {
assertResult(List(8, 5, 3, 2, 1, 1)) {
reverse(List(1, 1, 2, 3, 5, 8))
}
}
} | gcanti/S-99 | src/test/scala/P05Spec.scala | Scala | mit | 213 |
package com.codiply.barrio.geometry
import scala.math.sqrt
import Point.Coordinates
final case class Point(id: String, location: Coordinates, data: String)
final case class PartitioningPlane(centroid1: Coordinates, centroid2: Coordinates)
final object Point {
type Coordinates = List[Double]
final object Coordi... | codiply/barrio | src/main/scala/com/codiply/barrio/geometry/Point.scala | Scala | apache-2.0 | 958 |
package org.bitcoins.testkitcore
import org.scalacheck.Gen
import org.scalatest.compatible.Assertion
import org.scalatest.exceptions.TestFailedException
import scala.annotation.tailrec
/** Provides extension methods, syntax
* and other handy implicit values that
* aid in testing.
*/
object Implicits {
/** E... | bitcoin-s/bitcoin-s | testkit-core/src/main/scala/org/bitcoins/testkitcore/Implicits.scala | Scala | mit | 1,564 |
/*
* Copyright (C) 2015 Stratio (http://stratio.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | Stratio/spark-mongodb | spark-mongodb/src/main/scala/com/stratio/datasource/schema/SchemaProvider.scala | Scala | apache-2.0 | 918 |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2015-2021 Andre White.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
... | adarro/ddo-calc | subprojects/common/ddo-core/src/main/scala/io/truthencode/ddo/support/tree/TreeLike.scala | Scala | apache-2.0 | 2,352 |
package jsm4s.attribute
import scala.collection.SortedMap
class EnumAttribute(val values: SortedMap[String, Int], val offset:Int) extends Attribute {
private val mapping = values.keys.zipWithIndex.toMap
override def apply(value: String) = Seq(offset + mapping(value))
override def size: Int = values.size
ov... | DmitryOlshansky/jsm4s | src/main/scala/jsm4s/attribute/EnumAttribute.scala | Scala | gpl-2.0 | 374 |
/*
* Accio is a platform to launch computer science experiments.
* Copyright (C) 2016-2018 Vincent Primault <[email protected]>
*
* Accio 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... | privamov/accio | accio/java/fr/cnrs/liris/util/scrooge/ScroogeSerializer.scala | Scala | gpl-3.0 | 2,598 |
package lila.relay
import akka.actor._
import akka.pattern.pipe
import scala.concurrent.duration._
import lila.hub.actorApi.map.Tell
private[relay] final class FICS(config: FICS.Config) extends Actor with Stash with LoggingFSM[FICS.State, Option[FICS.Request]] {
import FICS._
import Telnet._
import GameEvent.... | pavelo65/lila | modules/relay/src/main/FICS.scala | Scala | mit | 5,369 |
package net.liftmodules.fobo.snippet.FoBo
import xml._
import org.specs2.mutable.Specification
import net.liftweb.http._
import net.liftweb.common._
import net.liftweb.util.Helpers._
object ResourceSpecs extends Specification {
val session = new LiftSession("", randomString(20), Empty)
"Using split and trim on ... | karma4u101/FoBo | FoBo/FoBo-API/src/test/scala/net/liftmodules/fobo/snippet/FoBo/ResourcesSpec.scala | Scala | apache-2.0 | 6,467 |
object TextExamples {
class Rational(n: Int, d: Int) extends AnyRef {
private def gcd(x: Int, y: Int): Int = {
if (x == 0) y
else if (x < 0) gcd(-x, y)
else if (y < 0) gcd(x, -y)
else gcd(y % x, x)
}
private val g = gcd(n, d)
val numer: Int = n/g
val denom: Int = d/g
... | promlow/books-and-tutorials | scala-by-example/Notes-Chapter6.scala | Scala | mit | 1,828 |
/**
* Copyright 2016, deepsense.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... | deepsense-io/seahorse-workflow-executor | workflowexecutormqprotocol/src/main/scala/io/deepsense/workflowexecutor/communication/mq/json/Global.scala | Scala | apache-2.0 | 3,450 |
/*
Copyright 2015 Mate1 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 writ... | mate1/kafka-avro-tools | project/Build.scala | Scala | apache-2.0 | 2,433 |
/*
* 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 ... | u2009cf/spark-radar | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/GeneratedProjectionSuite.scala | Scala | apache-2.0 | 5,406 |
package filodb.stress
import org.apache.spark.{SparkContext, SparkConf}
import org.apache.spark.sql.{DataFrame, SaveMode, SQLContext}
import scala.util.Random
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Future}
import filodb.spark._
/**
* An in-memory concurrency and query stress teste... | markhamstra/FiloDB | stress/src/main/scala/filodb.stress/InMemoryQueryStress.scala | Scala | apache-2.0 | 4,343 |
package fr.laas.fape.structures
import java.util
import java.util.function.Predicate
import scala.collection.JavaConverters._
class ISet[T](val s : Set[T]) extends java.lang.Iterable[T] {
def this() = this(Set[T]())
def this(l : java.lang.Iterable[T]) = this(l.asScala.toSet)
class ISetIterator[X](private var... | athy/fape | structures/src/main/scala/fr/laas/fape/structures/ISet.scala | Scala | bsd-2-clause | 1,798 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 MineFormers
*
* 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 use, ... | MineFormers/MFCore | src/main/scala/de/mineformers/core/client/ui/skin/drawable/DynamicTexture.scala | Scala | mit | 8,668 |
package io.kaitai.struct
import io.kaitai.struct.format._
import io.kaitai.struct.precompile.CalculateSeqSizes
import io.kaitai.struct.translators.RubyTranslator
abstract class DocClassCompiler(classSpecs: ClassSpecs, topClass: ClassSpec) extends AbstractCompiler {
val provider = new ClassTypeProvider(classSpecs, t... | kaitai-io/kaitai_struct_compiler | shared/src/main/scala/io/kaitai/struct/DocClassCompiler.scala | Scala | gpl-3.0 | 2,484 |
package org.algorithms
import scala.annotation.tailrec
import scala.io.Source._
class PathResolver {
@tailrec
private def visit(path:String, index: Int, current: Int, increment: Int, house: Set[Int]): Set[Int] = {
val width = Byte.MaxValue
if (index >= path.length) house
else path.char... | Alex-Diez/Scala-Algorithms | advent-code/src/main/scala/org/algorithms/PathResolver.scala | Scala | mit | 1,323 |
/*
* 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.
*/
// scalastyle:off line.size.limit
/*
* Ported... | scala-js/scala-js | test-suite/shared/src/test/scala/org/scalajs/testsuite/javalib/math/BigDecimalConvertTest.scala | Scala | apache-2.0 | 16,682 |
object IfStatementSimple {
def foo(x: Boolean => String) = x(false)
foo(/*start*/if (_) "" else "g"/*end*/)
}
//(Boolean) => String | LPTK/intellij-scala | testdata/typeInference/expected/placeholder/IfStatementSimple.scala | Scala | apache-2.0 | 136 |
package controllers
import play.api.mvc._
import play.api.test._
import scala.concurrent.Future
object RootControllerSpec extends PlaySpecification with Results {
"RootController#index" should {
"should be valid" in {
val controller = new RootController()
val result = controller.index().apply(FakeR... | dtaniwaki/akka-pusher-play-app | test/controllers/RootControllerSpec.scala | Scala | mit | 423 |
package net.tomasherman.specus.server.net
import net.tomasherman.specus.common.api.net.Packet
import net.tomasherman.specus.server.api.net.Codec
import org.specs2.mutable._
import org.jboss.netty.buffer.ChannelBuffer
/**
* This file is part of Specus.
*
* Specus is free software: you can redistribute it and/or mo... | tomasherman/specus | server/src/test/scala/net/tomasherman/specus/server/net/CodecRepositorySpec.scala | Scala | gpl-3.0 | 3,369 |
package net.katsstuff.chitchat.chat.data
import java.util.Optional
import org.spongepowered.api.Sponge
import org.spongepowered.api.data.manipulator.DataManipulatorBuilder
import org.spongepowered.api.data.manipulator.immutable.common.AbstractImmutableSingleData
import org.spongepowered.api.data.manipulator.mutable.c... | Katrix-/ChitChat | shared/src/main/scala/net/katsstuff/chitchat/chat/data/ChannelData.scala | Scala | mit | 2,982 |
package com.sai.pumpkin.managedbeans
import java.io.File
import java.io.FileInputStream
import java.io.Serializable
import java.text.SimpleDateFormat
import java.util.Date
import scala.beans.BeanProperty
import scala.collection.JavaConversions.asScalaBuffer
import scala.collection.JavaConversions.seqAsJavaList
import... | SaiprasadKrishnamurthy/BigDash | src/main/scala/com/sai/pumpkin/managedbeans/AllWebservicesController.scala | Scala | apache-2.0 | 9,823 |
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.