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 |
|---|---|---|---|---|---|
import cats.instances.future._
import cats.syntax.functor._
import com.bot4s.telegram.future.Polling
import com.bot4s.telegram.methods._
import com.bot4s.telegram.models._
import scala.concurrent.Future
/**
* Echo, ohcE
*/
class EchoBot(token: String) extends ExampleBot(token) with Polling {
override def receive... | mukel/telegrambot4s | examples/src/EchoBot.scala | Scala | apache-2.0 | 475 |
package net.benchmark.akka.http.world
import io.circe.{Decoder, Encoder}
object World {
implicit val decodeWorld: Decoder[World] =
Decoder.forProduct2("id", "randomNumber")(World.apply)
implicit val encodeWorld: Encoder[World] =
Encoder.forProduct2("id", "randomNumber")(v => (v.id, v.randomNumber))
de... | zloster/FrameworkBenchmarks | frameworks/Scala/akka-http/akka-http-slick-postgres/src/main/scala/net/benchmark/akka/http/world/World.scala | Scala | bsd-3-clause | 401 |
package pigpio.scaladsl
import java.nio.{ByteBuffer, IntBuffer}
import com.sun.jna._
import com.sun.jna.ptr.IntByReference
import pigpio.javadsl._
object PigpioLibrary {
val JNA_LIBRARY_NAME: String = "pigpio"
lazy val JNA_NATIVE_LIB: NativeLibrary =
NativeLibrary.getInstance(PigpioLibrary.JNA_LIBRARY_NAME... | jw3/pigpio-scala | src/main/scala/pigpio/scaladsl/PigpioLibrary.scala | Scala | apache-2.0 | 30,981 |
/*
* 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 ... | akrabat/openwhisk | tests/src/test/scala/org/apache/openwhisk/core/containerpool/mesos/test/MesosContainerFactoryTest.scala | Scala | apache-2.0 | 10,884 |
package com.twitter.finagle.netty4.channel
import io.netty.channel._
import io.netty.util.concurrent.{GenericFutureListener, Future => NettyFuture}
/**
* This object provides [[GenericFutureListener]]s that are useful for implementing handlers
* that delay a connect-promise until some additional step is done (i.e.,... | luciferous/finagle | finagle-netty4/src/main/scala/com/twitter/finagle/netty4/channel/ConnectPromiseDelayListeners.scala | Scala | apache-2.0 | 2,181 |
package com.pnns
/**
* Algorithm trait.
*
* @author Ondrej Perutka
*
* @tparam I input type
* @tparam S state type
* @tparam M message type
*/
trait Algorithm[I,S,M] {
/**
* Create algorithm instance for a given node and input.
*
* @param node a node
* @param input an input
* @return alg... | operutka/pn-network-simulator | src/main/scala/com/pnns/Algorithm.scala | Scala | mit | 410 |
/*
* 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 org.scalajs.testsuite.javalib.util
im... | SebsLittleHelpers/scala-js | test-suite/js/src/test/scala/org/scalajs/testsuite/javalib/util/FormatterJSTest.scala | Scala | apache-2.0 | 779 |
package chee.properties
case class Property(ident: Ident, value: String) {
def map(f: Ident => Ident) = Property(f(ident), value)
}
object Property {
import scala.language.implicitConversions
implicit def fromTuple1(t: (Ident, String)): Property =
Property(t._1, t._2)
implicit def fromTuple2(t: (Symbol,... | eikek/chee | src/main/scala/chee/properties/Property.scala | Scala | gpl-3.0 | 2,157 |
/*
* 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 ... | steveloughran/spark-timeline-integration | yarn-timeline-history/src/test/scala/org/apache/spark/deploy/history/yarn/unit/HistoryWithDisabledTimelineSuite.scala | Scala | apache-2.0 | 2,902 |
package utils
import java.sql.Connection
import cz.kamenitxan.jakon.core.database.DBHelper
import cz.kamenitxan.jakon.utils.PageContext
import cz.kamenitxan.jakon.utils.security.AesEncryptor
import cz.kamenitxan.jakon.utils.security.oauth.Google.createAuthUrl
import cz.kamenitxan.jakon.utils.security.oauth.{OauthInfo,... | kamenitxan/Jakon | modules/backend/src/test/scala/utils/SecurityTest.scala | Scala | bsd-3-clause | 2,308 |
/*
* 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 ... | tejasapatil/spark | external/avro/src/main/scala/org/apache/spark/sql/avro/AvroFileFormat.scala | Scala | apache-2.0 | 9,899 |
package app.agent
import server.ServiceFactory.dateFormats
import app.server.ProbeFailure
import im.mange.jetboot.Bss
import im.mange.jetpac._
import java.util.UUID
import im.mange.jetboot.widget.Spacer
import net.liftweb.http.js.jquery.JqJsCmds.FadeOut
import app.model.Broadcast
import scala.xml.Unparsed
import Bss._... | alltonp/reprobate | src/main/scala/app/agent/BroadcastFlashAgent.scala | Scala | apache-2.0 | 2,383 |
package org.jetbrains.plugins.scala
package lang
package resolve
package processor
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.util.{Key, RecursionManager}
import com.intellij.psi._
import com.intellij.psi.scope._
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains... | double-y/translation-idea-plugin | src/org/jetbrains/plugins/scala/lang/resolve/processor/BaseProcessor.scala | Scala | apache-2.0 | 15,495 |
package org.scalatest.path
import org.scalatest.verb.BehaveWord
import scala.collection.immutable.ListSet
import org.scalatest.PathEngine.isInTargetPath
import org.scalatest._
import org.scalatest.Suite.autoTagClassAnnotations
/**
* A sister trait to <code>org.scalatest.FunSpec</code> that isolates tests by running ... | hubertp/scalatest | src/main/scala/org/scalatest/path/FunSpec.scala | Scala | apache-2.0 | 50,249 |
package edu.tum.cs.isabelle.setup
import java.io.File
import java.nio.file.{Files, Path, Paths}
import scala.concurrent.{Future, ExecutionContext}
import coursier._
import coursier.{Fetch, MavenRepository}
import org.log4s._
import edu.tum.cs.isabelle.Implementations
import edu.tum.cs.isabelle.api.{BuildInfo, Envi... | wneuper/libisabelle | setup/src/main/scala/Setup.scala | Scala | mit | 5,771 |
package com.twitter.finagle.http.filter
import com.twitter.finagle.{Filter, Service}
import com.twitter.finagle.http.{Request, Response, Status, Method}
import com.twitter.util.{Duration, Future}
/** Implements http://www.w3.org/TR/cors/ */
object Cors {
/**
* A Cross-Origin Resource Sharing policy.
*
* A ... | zfy0701/finagle | finagle-http/src/main/scala/com/twitter/finagle/http/filter/Cors.scala | Scala | apache-2.0 | 9,899 |
/**
* Copyright 2012 Jorge Aliss (jaliss at gmail dot com) - twitter: @jaliss
*
* 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
*
* U... | mslinn/securesocial | samples/scala/demo/app/service/InMemoryUserService.scala | Scala | apache-2.0 | 5,757 |
package org.scalaide.extensions
import org.scalaide.core.text.Change
import org.scalaide.core.text.TextChange
/**
* Base interface for auto edits. An auto edit is an IDE extension that is
* executed while an user types.
*/
trait AutoEdit extends ScalaIdeExtension with DocumentSupport {
/**
* Contains the tex... | dragos/scala-ide | org.scala-ide.sdt.core/src/org/scalaide/extensions/AutoEdit.scala | Scala | bsd-3-clause | 5,002 |
/*
* Copyright 2016 David R. Bild
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed t... | drbild/tristate | tristate-cats/src/main/scala/org/davidbild/tristate/contrib/cats/Tristate.scala | Scala | apache-2.0 | 10,215 |
package org.globalnames
package parser
package formatters
import formatters.{DetailsGenerator => dg}
import spray.json._
object DetailsGeneratorProtocol extends DefaultJsonProtocol {
implicit val ignoredFormat = jsonFormat1(dg.Ignored)
implicit val yearFormat = jsonFormat2(dg.Year)
implicit val subGenusForma... | GlobalNamesArchitecture/gnparser | parser-render/src/main/scala/org/globalnames/parser/formatters/DetailsGeneratorProtocol.scala | Scala | mit | 777 |
package edu.berkeley.cs.amplab.mlmatrix
import breeze.linalg._
import org.apache.spark.rdd.RDD
abstract class RowPartitionedSolver {
def solveLeastSquares(
A: RowPartitionedMatrix,
b: RowPartitionedMatrix): DenseMatrix[Double] = {
solveLeastSquaresWithL2(A, b, 0.0)
}
def solveLeastSquaresWith... | amplab/ml-matrix | src/main/scala/edu/berkeley/cs/amplab/mlmatrix/RowPartitionedSolver.scala | Scala | apache-2.0 | 1,288 |
/*
* 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 ... | zuotingbing/spark | external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala | Scala | apache-2.0 | 69,399 |
package ru.org.codingteam.cttalk.model
/**
* Created by hgn on 25.10.2015.
*/
case class Token(_id: String, handle: Handle) {
}
| hagane/cttalk | server/app/ru/org/codingteam/cttalk/model/Token.scala | Scala | mit | 131 |
package com.gabeos.wafflemusic
/**
* Created by Gabriel Schubiner on 8/8/2014.
*/
object Cfg {
object Image {
val trackingWidth: Int = 5
}
object Processing {
val cannyThreshold = (100,200)
}
}
| gabeos/WaffleMusic | src/main/scala/com/gabeos/wafflemusic/Cfg.scala | Scala | gpl-2.0 | 214 |
/*
* Copyright 2014 Claude Mamo
*
* 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... | malduarte/kafka-web-console | app/models/Setting.scala | Scala | apache-2.0 | 1,615 |
package io.getquill.idiom
import io.getquill.ast._
import io.getquill.NamingStrategy
trait Idiom {
def emptySetContainsToken(field: Token): Token = StringToken("FALSE")
def defaultAutoGeneratedToken(field: Token): Token = StringToken("DEFAULT VALUES")
def liftingPlaceholder(index: Int): String
def transla... | mentegy/quill | quill-core/src/main/scala/io/getquill/idiom/Idiom.scala | Scala | apache-2.0 | 435 |
package TAPLcomp2.fullequirec
import scala.text.Document
import scala.text.Document._
// outer means that the term is the top-level term
object FullEquiRecPrinter {
import TAPLcomp2.Print._
def ptyType(outer: Boolean, ty: Ty): Document = ty match {
case TyRec(x, tyT) =>
g2("Rec " :: x :: "." :/: ptyTy... | hy-zhang/parser | Scala/Parser/src/TAPLcomp2/fullequirec/syntax.scala | Scala | bsd-3-clause | 4,561 |
/*
* -----------------------------------------------------------------------------
* - ScaNao is on open-source enabling Nao's control from Scala code. -
* - At the low level jNaoqi is used to bridge the C++ code with the JVM. -
* - ... | iPomme/scanao | messages/src/main/scala/io/nao/scanao/msg/Robot.scala | Scala | mit | 5,558 |
/**
* Generated by API Builder - https://www.apibuilder.io
* Service version: 0.15.47
* apibuilder 0.15.33 app.apibuilder.io/apicollective/apibuilder-internal/latest/play_2_x_json
*/
package io.apibuilder.internal.v0.models {
sealed trait TaskData extends _root_.scala.Product with _root_.scala.Serializable
/*... | apicollective/apibuilder | generated/app/ApicollectiveApibuilderInternalV0Models.scala | Scala | mit | 11,913 |
import scala.quoted._
class Foo {
def foo(using QuoteContext): Unit = {
val expr ='{
val a = 3
println("foo")
2 + a
}
}
}
| som-snytt/dotty | tests/pos/quote-no-splices.scala | Scala | apache-2.0 | 152 |
package com.simplex9.splendor
import com.fasterxml.jackson.annotation.JsonIgnore
/**
* Created by hongbo on 6/10/17.
*/
case class Noble(
cards : Array[Short]
)
{
@JsonIgnore
val totalCards = cards.sum
@JsonIgnore
val cardScore = cards.map (c => Param.NOBLE_POINT * Param.POINT_VALUE * c... | liuhb86/splendor-ai | app/com/simplex9/splendor/Noble.scala | Scala | mit | 577 |
package com.github.novamage.svalidator.binding.binders.typed
import com.github.novamage.svalidator.binding.binders.{JsonTypedBinder, TypedBinder}
import com.github.novamage.svalidator.binding.{BindingConfig, BindingFailure, BindingPass, BindingResult}
import io.circe.ACursor
/** Performs binding of a long field
*
... | NovaMage/SValidator | src/main/scala/com/github/novamage/svalidator/binding/binders/typed/LongBinder.scala | Scala | mit | 1,726 |
// Loading package
import org.apache.spark.rdd.RDD
import org.apache.spark.mllib.stat.{MultivariateStatisticalSummary, Statistics}
import org.apache.commons.math3.stat.descriptive._
import org.apache.commons.math3.distribution._
package io.hupi.datascience_tools {
object Discretisation {
/* function : computeQu... | hupi-analytics/DataScienceTools | src/main/scala/io/hupi/datascience_tools/discretisation.scala | Scala | apache-2.0 | 13,105 |
/*
* 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/nisp-frontend | app/uk/gov/hmrc/nisp/views/formatting/SinglePlural.scala | Scala | apache-2.0 | 856 |
package mesosphere.marathon
package core.launchqueue.impl
import akka.NotUsed
import akka.stream.OverflowStrategy
import akka.stream.scaladsl.{Flow, Source}
import com.typesafe.scalalogging.StrictLogging
import mesosphere.marathon.core.instance.update.{InstanceChangeOrSnapshot, InstanceDeleted, InstanceUpdated, Instan... | mesosphere/marathon | src/main/scala/mesosphere/marathon/core/launchqueue/impl/ReviveOffersStreamLogic.scala | Scala | apache-2.0 | 10,860 |
package scorex.integration
import play.api.libs.json.Json
import scorex.app.api.http._
class BlocksRoutingSpecification extends RouteTest with BlocksHttpService {
"blocksRouting" should "return first block" in {
Get("/blocks/first") ~> blocksRouting ~> check {
val js = Json.parse(responseAs[String])
... | pozharko/Scorex-Lagonaki | src/test/scala/scorex/integration/BlocksRoutingSpecification.scala | Scala | cc0-1.0 | 1,621 |
package org.jetbrains.plugins.scala.lang.psi.api
import com.intellij.openapi.progress.ProgressManager
import com.intellij.psi._
import com.intellij.psi.impl.migration.PsiMigrationManager
import com.intellij.psi.scope.{NameHint, PsiScopeProcessor}
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi... | gtache/intellij-lsp | intellij-lsp-dotty/src/org/jetbrains/plugins/scala/lang/psi/api/FileDeclarationsHolder.scala | Scala | apache-2.0 | 9,353 |
package org.psesd.srx.shared.core.sif
import org.psesd.srx.shared.core.exceptions.ArgumentNullOrEmptyOrWhitespaceException
import org.psesd.srx.shared.core.extensions.TypeExtensions._
/** Represents a SIF zone.
*
* @version 1.0
* @since 1.0
* @author Stephen Pugmire (iTrellis, LLC)
*/
class SifZone(zoneId: ... | PSESD/srx-shared-core | src/main/scala/org/psesd/srx/shared/core/sif/SifZone.scala | Scala | mit | 652 |
/**
* Copyright 2015 Thomson Reuters
*
* Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... | nruppin/CM-Well | server/cmwell-rts/src/test/scala/RTSPub1.scala | Scala | apache-2.0 | 1,581 |
package de.fosd.typechef.parser.c
import de.fosd.typechef.parser._
import de.fosd.typechef.featureexpr._
import de.fosd.typechef.lexer._
import de.fosd.typechef.LexerToken
import de.fosd.typechef.error.Position
/**
* thin wrapper around jccp tokens to make them accessible to MultiFeatureParser
* @author kaestner
... | ckaestne/TypeChef | CParser/src/main/scala/de/fosd/typechef/parser/c/TokenWrapper.scala | Scala | lgpl-3.0 | 1,585 |
/***********************************************************************
* 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... | jahhulbert-ccri/geomesa | geomesa-accumulo/geomesa-accumulo-jobs/src/test/scala/org/locationtech/geomesa/jobs/mapreduce/InputFormatBaseAdapterTest.scala | Scala | apache-2.0 | 1,253 |
/*
* Copyright (C) 2014 - 2016 Softwaremill <http://softwaremill.com>
* Copyright (C) 2016 - 2019 Lightbend Inc. <http://www.lightbend.com>
*/
package akka.kafka.tests.scaladsl
import akka.kafka.tests.CapturingAppender
import scala.util.control.NonFatal
import org.scalatest.BeforeAndAfterAll
import org.scalatest... | softwaremill/reactive-kafka | tests/src/test/scala/akka/kafka/tests/scaladsl/LogCapturing.scala | Scala | apache-2.0 | 2,256 |
/*
* 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 | streaming/src/main/scala/org/apache/gearpump/streaming/task/TaskMessageSerializer.scala | Scala | apache-2.0 | 1,037 |
package io.toolsplus.atlassian.connect.play.auth.jwt
import io.toolsplus.atlassian.jwt.api.CanonicalHttpRequest
/**
* Authentication credentials representing an unverified JSON Web Token.
*/
case class JwtCredentials(rawJwt: String,
canonicalHttpRequest: CanonicalHttpRequest)
| toolsplus/atlassian-connect-play | modules/core/app/io/toolsplus/atlassian/connect/play/auth/jwt/JwtCredentials.scala | Scala | apache-2.0 | 309 |
package org.jetbrains.plugins.scala.extensions.implementation.iterator
import com.intellij.psi.PsiElement
import junit.framework.{Assert, TestCase}
import org.jetbrains.plugins.scala.lang.psi.PsiElementMock
/**
* Pavel.Fatin, 11.05.2010
*/
abstract class IteratorTestCase extends TestCase {
protected def assertIt... | ilinum/intellij-scala | test/org/jetbrains/plugins/scala/extensions/implementation/iterator/IteratorTestCase.scala | Scala | apache-2.0 | 873 |
package dao
import javax.inject.Inject
import com.github.tototoshi.slick.MySQLJodaSupport._
import models.{Thing, ThingRelation}
import org.joda.time.DateTime
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import slick.jdbc.JdbcProfile
import scala.concurrent.{ExecutionContext, Future}
... | MarekSuchanek/Inventory | app/dao/ThingDAO.scala | Scala | mit | 3,595 |
/*
* Copyright 2017 Anton Wierenga
*
* 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 ... | antonwierenga/activemq-cli | src/test/scala/activemq/cli/command/TopicCommandsTests.scala | Scala | apache-2.0 | 5,555 |
/*
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | jedesah/Quasar | yggdrasil/src/main/scala/quasar/yggdrasil/jdbm3/JDBMRawSortProjection.scala | Scala | apache-2.0 | 5,060 |
package com.spann
import com.spann.actors.ApplicationActor
object App {
def main(args: Array[String]): Unit = {
val initialActor = classOf[ApplicationActor].getName
akka.Main.main(Array(initialActor))
}
}
| sunil-123/SpannRace | src/main/scala/com/spann/App.scala | Scala | mit | 220 |
/*
* Copyright 2017-2018 47 Degrees, LLC. <http://www.47deg.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 require... | frees-io/freestyle | modules/integrations/http/http-client/shared/src/main/scala/free/http/free.scala | Scala | apache-2.0 | 2,869 |
package org.sbuild.plugins.aether
import java.io.File
import scala.Array.canBuildFrom
import de.tototec.sbuild.Logger
import de.tototec.sbuild.Project
import de.tototec.sbuild.SchemeHandler.SchemeContext
import de.tototec.sbuild.SchemeResolver
import de.tototec.sbuild.TargetContext
import de.tototec.sbuild.TargetRefs
... | SBuild-org/sbuild-aether-plugin | org.sbuild.plugins.aether/src/main/scala/org/sbuild/plugins/aether/AetherSchemeHandler.scala | Scala | apache-2.0 | 3,021 |
package llsm.algebras
import java.nio.file.Path
import cats.InjectK
import cats.free.Free
import llsm.io.LLSMImg
import llsm.io.metadata.FileMetadata
trait ImgWriterAPI[F[_]] {
def writeImg(path: Path, img: LLSMImg): F[FileMetadata]
}
sealed trait ImgWriterF[A]
object ImgWriterAPI {
def apply[F[_]](implicit ev... | keithschulze/llsm | api/src/main/scala/llsm/algebras/writer.scala | Scala | mit | 1,635 |
import scala.util.parsing.combinator._
class ExprParser extends RegexParsers {
val number = "[0-9]+".r
def expr: Parser[Any] = term ~! opt(("+" | "-") ~! expr)
def term: Parser[Any] = factor ~! rep("*" ~! factor)
def factor: Parser[Any] = "(" ~! expr ~! ")" | number
}
object Main extends App {
val parser = ... | yeahnoob/scala-impatient-2e-code | src/ch20/sec08/ExprParser.scala | Scala | gpl-3.0 | 437 |
import scalanative.unsafe._
import scalanative.unsigned._
import sdl2.SDL._
import sdl2.Extras._
object Threading {
val title = c"Threading"
val width = 800
val height = 800
def main(args: Array[String]): Unit = {
println("First hello from main thread, with id: " + SDL_ThreadID())
val fn: SDL_Threa... | regb/scalanative-graphics-bindings | examples/threading/Main.scala | Scala | mit | 586 |
/* __ __ _____ __ *\
** / // // /_/ |/ / Wix **
** / // // / /| / (c) 2006-2015, Wix LTD. **
** / // // / // | http://www.wix.com/ **
** \__/|__/_//_/| | ... | wix/common-protocol | common-protocol-testkit/src/test/scala/com/wix/restaurants/common/protocol/matchers/NingResponseMatchersTest.scala | Scala | apache-2.0 | 6,008 |
/*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0, (the "License"); you ma... | equella/Equella | Source/Plugins/Core/com.equella.core/scalasrc/com/tle/core/oauthclient/OAuthClientService.scala | Scala | apache-2.0 | 7,546 |
/*
* 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 ... | StephanEwen/incubator-flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/GenerateUtils.scala | Scala | apache-2.0 | 34,765 |
/* NSC -- new Scala compiler
* Copyright 2005-2013 LAMP/EPFL
* @author Martin Odersky
*/
package scala.tools.nsc
package typechecker
import scala.reflect.internal.util.StringOps.{ countElementsAsString, countAsString }
import scala.compat.Platform.EOL
import scala.reflect.runtime.ReflectionUtils
import scala.refl... | slothspot/scala | src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | Scala | bsd-3-clause | 61,158 |
package com.thoughtworks.sbt.sbteo
import java.io.File
import java.net.URLClassLoader
import java.util.jar.JarFile
import scala.tools.nsc.Settings
import scala.tools.nsc.io.VirtualDirectory
class BasicSettings {
/*
* For a given FQ classname, trick the resource finder into telling us the containing jar.
*/
p... | thoughtworks/sbteo | src/main/scala/com/thoughtworks/sbt/sbteo/BasicSettings.scala | Scala | apache-2.0 | 2,995 |
/*
* Copyright (c) 2012, Martin Zuber
* 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, this list of condi... | mzuber/typechecklib | core/src/main/scala/typechecklib/Errors.scala | Scala | bsd-3-clause | 3,817 |
/***********************************************************************
* 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... | jahhulbert-ccri/geomesa | geomesa-hbase/geomesa-hbase-datastore/src/main/scala/org/locationtech/geomesa/hbase/package.scala | Scala | apache-2.0 | 2,053 |
package sangria.execution
import sangria.ast.AstLocation
import sangria.ast
import sangria.marshalling.{InputUnmarshaller, RawResultMarshaller, ResultMarshaller, ToInput}
import sangria.ast.SourceMapper
import sangria.renderer.{QueryRenderer, SchemaRenderer}
import sangria.schema._
import sangria.util.Cache
import san... | sangria-graphql/sangria | modules/core/src/main/scala/sangria/execution/ValueCoercionHelper.scala | Scala | apache-2.0 | 25,981 |
package io.finch.internal
import com.twitter.io.Buf
import io.finch.FinchSpec
import java.nio.charset.Charset
class HttpContentSpec extends FinchSpec {
behavior of "HttpContet"
it should "asByteArrayWithBeginAndEnd" in {
check { b: Buf =>
val (array, begin, end) = b.asByteArrayWithBeginAndEnd
Bu... | ImLiar/finch | core/src/test/scala/io/finch/internal/HttpContentSpec.scala | Scala | apache-2.0 | 778 |
import java.io.{ByteArrayInputStream, ByteArrayOutputStream, StringReader, StringWriter}
import com.hypertino.binders.json.JsonBinders
import org.scalatest.{FlatSpec, Matchers}
class TestReaderWriterSerializer extends FlatSpec with Matchers {
import JsonBinders._
"Json " should " serialize to OutputStream" in {... | hypertino/json-binders | jsonBinders/jvm/src/test/scala/TestReaderWriterSerializer.scala | Scala | bsd-3-clause | 626 |
package org.ausdigital.apecconnect.businessregister.model
import play.api.libs.json.{ Json, OFormat }
/**
* Response that returned from APEC Connect Business Register.
* Note that we don't need all fields from the response yet.
* @see https://github.com/TeamAusDigital/apec-connect-cloud-ledger/blob/master/busin... | TeamAusDigital/apec-connect | server/modules/common/src/main/scala/org/ausdigital/apecconnect/businessregister/model/ParticipantRegistrationResponse.scala | Scala | apache-2.0 | 966 |
package com.nthportal.euler
package h0.t0
import com.nthportal.euler.maths.Primes
object Problem5 extends ProjectEulerProblem {
override def apply(): Long = {
(1 to 20)
.map(Primes.primeFactors(_).toList)
.map(_.groupBy(identity).mapValues(_.size))
.flatMap(_.toSeq)
.groupBy(_._1)
... | NthPortal/euler-n-scala | src/main/scala/com/nthportal/euler/h0/t0/Problem5.scala | Scala | mit | 407 |
package io.finch
import java.util.Locale
import shapeless.Witness
/**
* Models an HTTP Accept header (see RFC2616, 14.1).
*
* @note This API doesn't validate the input primary/sub types.
*
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
*/
abstract class Accept {
def primary: String
def sub:... | ImLiar/finch | core/src/main/scala/io/finch/Accept.scala | Scala | apache-2.0 | 2,389 |
/*
* 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 ... | eyalfa/spark | external/avro/src/main/scala/org/apache/spark/sql/avro/AvroOptions.scala | Scala | apache-2.0 | 3,953 |
package ch.wsl.box.rest.utils
import java.security.MessageDigest
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import net.ceedubs.ficus.Ficus._
import ch.wsl.box.jdbc.PostgresProfile.api._
import ch.wsl.box.services.Services
import scribe.Logging
import scala.concurrent.duratio... | Insubric/box | server/src/main/scala/ch/wsl/box/rest/utils/Auth.scala | Scala | apache-2.0 | 2,002 |
package cook.config
import cook.meta.Meta
import cook.meta.MetaHelper
import cook.meta.db.DbProvider.{ db => metaDb }
import cook.util.GlobScanner
import scala.util.Try
/**
* Generate, compile and load config class.
*
* @author iamtimgreen@gmail.com (Tim Green)
*/
private[cook] object ConfigEngine {
import c... | timgreen/cook | src/cook/config/ConfigEngine.scala | Scala | apache-2.0 | 3,836 |
/*
* Copyright 2015 ligaDATA
*
* 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... | traytonwhite/Kamanja | trunk/InputOutputAdapters/IbmMqSimpleInputOutputAdapters/src/main/scala/com/ligadata/InputAdapters/IbmMqConsumer.scala | Scala | apache-2.0 | 13,748 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | ArvinDevel/onlineAggregationOnSparkV2 | core/src/main/scala/org/apache/spark/deploy/ClientArguments.scala | Scala | apache-2.0 | 4,328 |
/*
* 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 ... | lincoln-lil/flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamPhysicalPythonCorrelate.scala | Scala | apache-2.0 | 2,932 |
package collins.solr
import play.api.Logger
/**
* StringValueFormat determines how wildcards are used on string values. We
* currently allow leading and/or trailing wildcard characters on unquoted
* string values. If the value is quoted, such as foo = "*bar", the * is not
* interpreted as a wildcard
*
* We ... | Shopify/collins | app/collins/solr/StringValueFormat.scala | Scala | apache-2.0 | 3,735 |
package ch.fhnw.ima.saav.model
import ch.fhnw.ima.saav.TestUtil
import ch.fhnw.ima.saav.model.config.AnalysisConfig
import org.scalatest.{FunSpec, Matchers}
class ConfigModelSpec extends FunSpec with Matchers with TestUtil {
val json =
"""{
"title" : "Title",
"allowedValueRange": [-1000, 1000],... | fhnw-saav/saav | src/test/scala/ch/fhnw/ima/saav/model/ConfigModelSpec.scala | Scala | mit | 2,343 |
/*
* 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 ... | aljoscha/flink | flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/plan/stream/table/CorrelateTest.scala | Scala | apache-2.0 | 6,056 |
package se.skltp.aggregatingservices.riv.clinicalprocess.healthcond.basic.getaggregatedobservations
import se.skltp.agp.testnonfunctional.TPHappyPathAbstract
/**
* Just test Tolvan Tolvansson - no error latency
*/
class TPHappyPath extends TPHappyPathAbstract with CommonParameters {
setUp(setUpAbstract(serviceNam... | skltp-aggregerandetjanster/riv.clinicalprocess.healthcond.basic.GetAggregatedObservations | test/non-functional/gatling/src/test/scala/se/skltp/aggregatingservices/riv/clinicalprocess/healthcond/basic/getaggregatedobservations/TPHappyPath.scala | Scala | lgpl-2.1 | 371 |
/*
* 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... | wzhongyuan/BigDL | spark/dl/src/test/scala/com/intel/analytics/bigdl/nn/ThresholdSpec.scala | Scala | apache-2.0 | 5,950 |
package play.api.cache
import play.api._
import play.api.mvc._
import reflect.ClassTag
/**
* Cache an action.
*
* @param key Compute a key from the request header
* @param duration Cache duration (in seconds)
* @param action Action to cache
*/
case class Cached[A](key: RequestHeader => String, duration: Int)(ac... | noel-yap/setter-for-catan | play-2.1.1/framework/src/play/src/main/scala/play/api/cache/Cached.scala | Scala | apache-2.0 | 1,412 |
package org.apache.spark.rdd
import io.unimatic.scripting.groovy.{DataPoint, Executor}
import org.apache.spark.util.ComputeExecutor
import java.util
import scala.reflect.ClassTag
import org.apache.spark.{Partition, TaskContext}
import scala.collection.Iterator
/**
* 要注意这里的map,一定要注意这里的map是java.util... | javalovelinux/SparkGroovyScript | core/src/main/scala/org/apache/spark/rdd/GroovyScriptRDD.scala | Scala | apache-2.0 | 3,509 |
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author John Miller
* @version 1.3
* @date Mon Nov 2 15:05:06 EDT 2009
* @see LICENSE (MIT style license file).
*/
package apps.process
import scalation.model.Modelable
import scalation.process._
import scalation.ran... | NBKlepp/fda | scalation_1.3/scalation_models/src/main/scala/apps/process/Bank.scala | Scala | mit | 3,245 |
package io.eels.component.hive
import io.eels.schema.{Field, PartitionPart}
import org.apache.hadoop.hive.metastore.api.StorageDescriptor
case class PartitionKey(field: Field)
// Represents a partition, which is the full set of partition key/values pairs for a particular record
// eg key1=value1/key2=value2/key3=val... | stheppi/eel | eel-hive/src/main/scala/io/eels/component/hive/partitions.scala | Scala | apache-2.0 | 962 |
/**
* Copyright (C) 2012-2013 Vadim Bartko (vadim.bartko@nevilon.com).
*
* 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 2 of the License, or
* (at your option) any later ve... | hudvin/nomad | src/main/scala/com/nevilon/nomad/crawler/Carousel.scala | Scala | gpl-2.0 | 2,320 |
/*
* Copyright 2015 Simin You
*
* 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 ... | syoummer/SpatialSpark | src/main/scala/spatialspark/main/SpatialJoinApp.scala | Scala | apache-2.0 | 10,538 |
package com.twitter.querulous.query
import java.sql.{ResultSet, Connection}
import scala.collection.immutable.Map
trait QueryFactory {
def apply(connection: Connection, queryClass: QueryClass, queryString: String, params: Any*): Query
def shutdown() = {}
}
trait Query {
def select[A](f: ResultSet => A): Seq[A]... | kievbs/querulous210 | src/main/scala/com/twitter/querulous/query/Query.scala | Scala | apache-2.0 | 719 |
package scala.runtime
import scala.math.ScalaNumber
object BoxesRunTime {
def boxToCharacter(c: Char): java.lang.Character =
java.lang.Character.valueOf(c)
@inline
def unboxToChar(c: Object): Char =
if (c eq null) 0
else c.asInstanceOf[java.lang.Character].charValue()
def equals(x: Object, y: Ob... | colinrgodsey/scala-js | scalalib/overrides/scala/runtime/BoxesRunTime.scala | Scala | bsd-3-clause | 3,530 |
/*
* Copyright (c) 2014-2020 by The Monix Project Developers.
* See the project homepage at: https://monix.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... | alexandru/monifu | monix-eval/shared/src/main/scala/monix/eval/internal/TaskSleep.scala | Scala | apache-2.0 | 2,398 |
/*
* 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... | JerryYanWan/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/example/tensorflow/Save.scala | Scala | apache-2.0 | 1,870 |
package co.ledger.wallet.web.ripple.core.device.usb
import co.ledger.wallet.core.device.DeviceFactory.ScanRequest
import co.ledger.wallet.core.device.DeviceManager.{ConnectivityType, ConnectivityTypes}
import co.ledger.wallet.core.device.{Device, DeviceFactory}
import co.ledger.wallet.web.ripple.core.device.usb.UsbDev... | LedgerHQ/ledger-wallet-ripple | src/main/scala/co/ledger/wallet/web/ripple/core/device/usb/UsbDeviceFactory.scala | Scala | mit | 4,640 |
package edu.nus.maxsmtplay
import com.microsoft.z3._
class BenchmarkDriver(name: String, solver: SolverTestUtils with Z3 with Printer with Verifier) {
def init(timeout: Option[Int]) = {
solver.init(timeout)
}
def delete() = {
solver.delete()
}
def measureTime[A](f: => A) = {
val s = System.na... | mechtaev/maxsmt-playground | src/main/scala/edu/nus/maxsmtplay/BenchmarkDriver.scala | Scala | mit | 1,425 |
/*
* 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... | yiheng/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/nn/Normalize.scala | Scala | apache-2.0 | 6,082 |
package xml.circumstances
import controllers.mappings.Mappings
import models.{PaymentFrequency, DayMonthYear}
import models.domain.{Claim, _}
import models.view.CachedChangeOfCircs
import models.yesNo._
import org.specs2.mutable._
import utils.{WithApplication}
class EmploymentSpec extends Specification {
lazy val ... | Department-for-Work-and-Pensions/ClaimCapture | c3/test/xml/circumstances/EmploymentSpec.scala | Scala | mit | 9,053 |
package org.jetbrains.jps.incremental.scala
package data
import java.io.File
/**
* @author Pavel Fatin
*/
case class CompilerJars(library: File, compiler: File, extra: Seq[File]) {
def files: Seq[File] = library +: compiler +: extra
}
| LPTK/intellij-scala | jps-plugin/src/org/jetbrains/jps/incremental/scala/data/CompilerJars.scala | Scala | apache-2.0 | 241 |
package co.uproot.abandon
import java.io.FileOutputStream
import java.nio.file.Paths
import fi.e257.testing.Glob
/**
* Test valid and invalid input with full CLI App
* and verify return value of main app.
*/
class CliAppTests extends DefaultArgsDirSuite {
val basedir = Paths.get("../tests").toAbsolutePath.n... | hrj/abandon | cli/src/test/scala/co/uproot/abandon/CliTest.scala | Scala | apache-2.0 | 2,204 |
package eu.devtty.ipfs
import eu.devtty.multiaddr.Multiaddr
import eu.devtty.peerinfo.PeerInfo
import scala.concurrent.Future
import scala.scalajs.js
trait SwarmApi {
def addrs: Future[Array[PeerInfo]]
def connect(addr: Multiaddr): Future[_]
def disconnect(addr: Multiaddr): Future[_]
def peers(opts: SwarmPee... | magik6k/scalajs-ipfs-api | core-api/src/main/scala/eu/devtty/ipfs/SwarmApi.scala | Scala | mit | 1,048 |
package utils.db
import java.io.File
import com.typesafe.config.ConfigFactory
import slick.profile.SqlProfile.ColumnOption
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
/**
* Based on https://github.com/tminglei/slick-pg/blob/mast... | tetrao-eu/template-site | app/utils/db/SourceCodeGenerator.scala | Scala | mit | 3,691 |
/*
* 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 ... | nchammas/spark | sql/hive/src/test/scala/org/apache/spark/sql/hive/test/TestHive.scala | Scala | apache-2.0 | 26,408 |
package org.sparkexample.myTries
//import org.apache.spark.sql.SparkSession
object inputScala {
/*def main(args: Array[String]) {
val t0 = System.nanoTime()
val spark = SparkSession
.builder
.appName("inputScala").master("local")
.getOrCreate()
val file = args(0)
val input = s... | kmulgrew/spark-bootstrap | src/main/scala/org/sparkexample/myTries/inputScala.scala | Scala | mit | 642 |
package com.ferhtaydn.biocemid.evals
sealed trait Rate
case object FN extends Rate
case object TN extends Rate
case object FP extends Rate
case object TP extends Rate
| ferhtaydn/BioCreative5Task6 | src/main/scala/com/ferhtaydn/biocemid/evals/Rate.scala | Scala | apache-2.0 | 168 |
package com.aluxian.tweeather.scripts
import org.apache.spark.Logging
/**
* This script is used to count the number of rows that [[TwitterEmoCollector]] has collected.
*/
object TwitterEmoCounter extends Script with Logging {
override def main(args: Array[String]) {
super.main(args)
// Import data
... | Aluxian/Tweeather | src/main/scala/com/aluxian/tweeather/scripts/TwitterEmoCounter.scala | Scala | apache-2.0 | 497 |
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.