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 |
|---|---|---|---|---|---|
/*
* 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 ... | mahak/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/NumberConverter.scala | Scala | apache-2.0 | 6,760 |
package mdtags
class link(val link: String, val mdElement: MdElement) extends MdElement {
override def toMarkdown(listIndent: Int = 0): String = s"[${mdElement.toMarkdown()}](${link})"
override def convertToMarkup(implicit indentSpaces: Int): String =
"link(\\n" +
indent(indentSpaces, "link = " + forma... | timo-schmid/mdtags | src/main/scala/mdtags/link.scala | Scala | apache-2.0 | 647 |
package vedavaapi
import java.util.concurrent.TimeUnit
import java.util.regex.{Pattern, PatternSyntaxException}
import javax.ws.rs.Path
import akka.http.scaladsl.server.{Directives, Route}
import akka.util.Timeout
import io.swagger.annotations._
import sanskritnlp.transliteration.transliterator
import scala.concurr... | vedavaapi/scala-akka-http-server | src/main/scala/vedavaapi/TransliteratorService.scala | Scala | apache-2.0 | 2,736 |
package dynamite
import zio.test._
import zio.test.Assertion._
import Ast._
import dynamite.Ast.Projection.Aggregate._
import dynamite.Ast.Projection.FieldSelector._
object ParserSpec extends DefaultRunnableSpec {
def parse(query: String) = Parser.parse(query)
def parseSuccess(query: String) =
assert(parse(... | joprice/dynamite | src/test/scala/dynamite/ParserSpec.scala | Scala | apache-2.0 | 12,288 |
package code.model.repository
import code.model.base.CrudExampleBaseRepository
object ProductRepository extends CrudExampleBaseRepository[code.model.Product] | rehei/crudible | crudible-lift-example/src/main/scala/code/model/repository/ProductRepository.scala | Scala | apache-2.0 | 159 |
package atlas
import atlas.ast.Node
import atlas.tokens.Token
import scala.collection.mutable
object Parser {
type Result = (Seq[Node], Seq[Token])
type Parsec = (Seq[Token]) => Result
def mkASTree(ts: Seq[Token]): Node =
parseTop(ts) match { case (Seq(node), Seq()) => node }
private def parseTop(ts: Se... | jankdc/atlas | src/main/scala/atlas/Parser.scala | Scala | mit | 14,024 |
package io.getquill
import io.getquill.ast._
import io.getquill.context.CanOutputClause
import io.getquill.context.sql.idiom._
import io.getquill.context.sql.norm.AddDropToNestedOrderBy
import io.getquill.context.sql.{ FlattenSqlQuery, SqlQuery }
import io.getquill.idiom.StatementInterpolator._
import io.getquill.idio... | getquill/quill | quill-sql-portable/src/main/scala/io/getquill/SQLServerDialect.scala | Scala | apache-2.0 | 2,482 |
package com.sksamuel.scapegoat.inspections.collections
import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.{ OneInstancePerTest, FreeSpec, Matchers }
/** @author Stephen Samuel */
class UnsafeContainsTest extends FreeSpec with Matchers with PluginRunner with OneInstancePerTest {
override val inspection... | pwwpche/scalac-scapegoat-plugin | src/test/scala/com/sksamuel/scapegoat/inspections/collections/UnsafeContainsTest.scala | Scala | apache-2.0 | 1,892 |
package models
import common.models.halo.TimedPoint
import play.api.libs.json.Json
package object sports {
case class SportsBookTimedOdds(bookname: String, time: Long, a: Double, b: Double)
case class SportsBookOdds(bookname: String, a: Double, b: Double)
object SportsBookOdds {
/**
* Normalized item... | asciiu/halo | arbiter/app/models/sports/package.scala | Scala | mit | 1,483 |
package drt.shared
import drt.shared.api.Arrival
object PcpUtils {
val defaultPax = 0
def bestPcpPaxEstimate(flight: Arrival): Int =
(flight.ApiPax, flight.ActPax, flight.TranPax, flight.MaxPax) match {
case (Some(apiPax), _, _, _) if !flight.FeedSources.contains(LiveFeedSource) => apiPax
case (_... | UKHomeOffice/drt-scalajs-spa-exploration | shared/src/main/scala/drt/shared/PcpUtils.scala | Scala | apache-2.0 | 714 |
package Tutorial
import Chisel._
import Node._
import scala.collection.mutable.HashMap
import scala.io.Source
import java.io.FileOutputStream
import java.io.File
object Image {
val MagicNumber = 0x59a66a95
val NoColorMap = 0
val StandardType = 1
def dwordFromString(s: String, off: Int): Int =
(s(off+0... | seyedmaysamlavasani/GorillaPP | chisel/KmeansAndMesh/srcOld/Image.scala | Scala | bsd-3-clause | 2,321 |
package org.lanyard.util
/** The incomplete beta function. */
case class IncBeta( val a: Double, val b: Double ) extends PartialFunction[Double,Double] {
require( a > 0, "Incomplete beta function parameter a needs to be strictly positive. Found value: " + a )
require( b > 0, "Incomplete beta function parameter b ... | perian/Lanyard | src/main/scala/org/lanyard/util/IncBeta.scala | Scala | gpl-2.0 | 3,023 |
package org.sstudio.bulldozer.dsl.compare
final class IntCompare(int: Int) extends TCompare[Int] {
v = int
}
| avril23/bulldozer | bulldozer/src/main/scala/org/sstudio/bulldozer/dsl/compare/IntCompare.scala | Scala | bsd-3-clause | 112 |
/*
* Copyright 2010-2011 Christos KK Loverdos
*
* 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... | loverdos/restie | src/main/scala/com/ckkloverdos/restie/RestPathManager.scala | Scala | apache-2.0 | 2,510 |
/*
* 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 ... | sgururajshetty/carbondata | integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionTableDropTestCase.scala | Scala | apache-2.0 | 11,500 |
package mesosphere.marathon.state
import java.lang.{ Double => JDouble, Integer => JInt }
import com.fasterxml.jackson.annotation.JsonIgnore
import mesosphere.marathon.Protos
import mesosphere.marathon.Protos.Constraint
import mesosphere.marathon.Protos.HealthCheckDefinition.Protocol
import mesosphere.marathon.health... | sepiroth887/marathon | src/main/scala/mesosphere/marathon/state/AppDefinition.scala | Scala | apache-2.0 | 9,870 |
package com.sksamuel.elastic4s.searches.aggs.pipeline
import com.sksamuel.elastic4s.script.Script
import com.sksamuel.elastic4s.searches.aggs.AbstractAggregation
import com.sksamuel.elastic4s.searches.sort.Sort
trait PipelineAggregationApi {
def avgBucketAgg(name: String, bucketsPath: String): AvgBucketPipelineAgg... | Tecsisa/elastic4s | elastic4s-core/src/main/scala/com/sksamuel/elastic4s/searches/aggs/pipeline/PipelineAggDsl.scala | Scala | apache-2.0 | 2,544 |
/*
* 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 ... | practice-vishnoi/dev-spark-1 | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala | Scala | apache-2.0 | 10,766 |
package org.scalaide.refactoring.internal
package source
import scala.tools.refactoring.implementations
import org.eclipse.ltk.ui.refactoring.RefactoringWizardPage
import org.scalaide.core.internal.jdt.model.ScalaSourceFile
import org.scalaide.core.internal.statistics.Features.IntroduceProductNTrait
import org.scalai... | dragos/scala-ide | org.scala-ide.sdt.core/src/org/scalaide/refactoring/internal/source/IntroduceProductNTrait.scala | Scala | bsd-3-clause | 1,628 |
package org.geoscript.feature
/**
* Utilities for working with [[org.geoscript.feature.Feature]] in a typesafe way.
*
* [[org.geoscript.feature.Feature]] is defined in terms of java.lang.Object and
* requires casting to use. The classes in this package provide some
* convenience around doing the casting - in par... | dwins/geoscript.scala | geoscript/src/main/scala/feature/builder/Builder.scala | Scala | mit | 6,930 |
/*
* Copyright 2011-2018 GatlingCorp (http://gatling.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 applic... | wiacekm/gatling | gatling-http/src/main/scala/io/gatling/http/ahc/AsyncHandler.scala | Scala | apache-2.0 | 4,321 |
/*
* Copyright (c) 2014 Contributor. All rights reserved.
*/
package org.scalaide.debug.internal.expression.sources
import scala.reflect.internal.util.SourceFile
import org.scalaide.core.compiler.IScalaPresentationCompiler
import org.scalaide.logging.HasLogger
object Imports extends HasLogger with SPCIntegration {... | stephenh/scala-ide | org.scala-ide.sdt.debug.expression/src/org/scalaide/debug/internal/expression/sources/Imports.scala | Scala | bsd-3-clause | 4,504 |
package org.skycastle.core.design
import com.jme3.scene.Spatial
import org.skycastle.util.grid.{GridSize, GridPos}
import org.skycastle.util.octree.GridStorage
trait Change {
def canDo: ChangeResult
def doChange
def undoChange
}
case class ChangeImpl(_canDo: () => ChangeResult,
_doChange... | zzorn/skycastle | src/main/scala/org/skycastle/core/design/Design.scala | Scala | gpl-2.0 | 3,879 |
/*
* 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/catalog/ExternalCatalogTable.scala | Scala | apache-2.0 | 2,233 |
package geek.lawsof.physics.lib.block
import java.util
import cpw.mods.fml.common.registry.GameRegistry
import geek.lawsof.physics.Reference
import geek.lawsof.physics.lib.item.ItemDescriptor
import geek.lawsof.physics.lib.item.traits.whiteColor
import net.minecraft.block.Block
import net.minecraft.client.renderer.te... | GeckoTheGeek42/TheLawsOfPhysics | src/main/scala/geek/lawsof/physics/lib/block/ItemBlockBase.scala | Scala | mit | 2,788 |
/*
* Copyright (c) 2014 Contributor. All rights reserved.
*/
package org.scalaide.debug.internal.preferences
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
import org.eclipse.jface.preference.BooleanFieldEditor
import org.eclipse.jface.preference.FieldEditorPreferencePage
import org.eclips... | Kwestor/scala-ide | org.scala-ide.sdt.debug/src/org/scalaide/debug/internal/preferences/DebuggerPreferencePage.scala | Scala | bsd-3-clause | 4,815 |
package katas.scala.orderbook.v5
import scala.xml.XML
import java.io.File
import org.xml.sax.helpers.DefaultHandler
import org.xml.sax.Attributes
import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import scala.collection._
import immutable.TreeMap
import katas.scala.orderbook.v5.XmlCommandReader.ReadFrom
import... | dkandalov/katas | scala/src/katas/scala/orderbook/v5/Main.scala | Scala | unlicense | 7,212 |
package io.buoyant.interpreter
import com.twitter.finagle.util.LoadService
import com.twitter.finagle.{Path, Stack}
import io.buoyant.config.Parser
import io.buoyant.namer.{InterpreterConfig, InterpreterInitializer}
import org.scalatest.FunSuite
class MeshInterpreterInitializerTest extends FunSuite {
test("sanity")... | linkerd/linkerd | interpreter/mesh/src/test/scala/io/buoyant/interpreter/MeshInterpreterInitializerTest.scala | Scala | apache-2.0 | 1,900 |
/*
* Copyright 2021 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/ct-calculations | src/test/scala/uk/gov/hmrc/ct/accounts/frs102/boxes/ACQ5021Spec.scala | Scala | apache-2.0 | 3,480 |
package edu.jhu.hlt.probe.classifier
import de.bwaldvogel.liblinear._
import edu.jhu.hlt.probe._
import java.nio.file._
import scala.collection.JavaConversions._
import scala.collection._
/**
* A simple log-linear model based on the library `liblinear`.
* This is used for fast prototyping.
* @author Tongfei Che... | ctongfei/feature | core/src/main/scala/edu/jhu/hlt/probe/classifier/LogLinearModel.scala | Scala | mit | 3,266 |
package example.akkawschat
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.stream.ActorFlowMaterializer
import scala.util.{ Success, Failure }
object Boot extends App {
implicit val system = ActorSystem()
import system.dispatcher
implicit val materializer = ActorFlowMaterializer()
v... | tabruhn/akka-chat-playground | backend/src/main/scala/example/akkawschat/Boot.scala | Scala | mit | 848 |
package com.microsoft.netalyzer.loader
import org.apache.hadoop.fs.{FileSystem, Path}
import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.types._
object Utils {
def initializeDb(path: String, sc: SQLContext): Unit = {
sc.sql(
s"""
CREATE DATABASE IF NOT EXISTS netalyzer
LO... | bitvector2/netalyzer-loader | src/main/scala/com/microsoft/netalyzer/loader/Utils.scala | Scala | apache-2.0 | 3,294 |
/*
* 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 ... | sgururajshetty/carbondata | integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/QueryTaskCompletionListener.scala | Scala | apache-2.0 | 3,659 |
/*
* Copyright 2012 Comcast Cable Communications Management, LLC
*
* 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... | Comcast/money | money-otel-logging-exporter/src/main/scala/com/comcast/money/otel/handlers/logging/LoggingSpanHandler.scala | Scala | apache-2.0 | 1,564 |
package com.szadowsz.spark.ml.feature
import com.szadowsz.common.lang.WordTokeniser
import org.apache.spark.ml.UnaryTransformer
import org.apache.spark.sql._
import org.apache.spark.sql.types.{ArrayType, DataType, StringType}
import org.slf4j.LoggerFactory
/**
* Created on 28/11/2016.
*/
class TokeniserTransforme... | zakski/project-cadisainmduit | module/spark/src/main/scala/com/szadowsz/spark/ml/feature/TokeniserTransformer.scala | Scala | apache-2.0 | 980 |
package com.geishatokyo.sqlgen.loader
import java.io.{File, InputStream}
import com.geishatokyo.sqlgen.SQLGenException
import com.geishatokyo.sqlgen.core.Workbook
import scala.util.matching.Regex
/**
* Created by takezoux2 on 2017/07/05.
*/
class AutoFileDetectionLoader(patterns: Seq[Pattern], defaultLoader: Op... | geishatokyo/sql-generator | src/main/scala/com/geishatokyo/sqlgen/loader/AutoFileDetectionLoader.scala | Scala | mit | 1,575 |
package idv.brianhsu.maidroid.plurk.fragment
import idv.brianhsu.maidroid.plurk._
import idv.brianhsu.maidroid.plurk.activity._
import idv.brianhsu.maidroid.plurk.TypedResource._
import idv.brianhsu.maidroid.plurk.adapter._
import idv.brianhsu.maidroid.plurk.dialog._
import idv.brianhsu.maidroid.plurk.util._
import id... | brianhsu/MaidroidPlurk | src/main/scala/fragment/BlockListFragment.scala | Scala | gpl-3.0 | 8,302 |
package org.json4s
package jackson
import com.fasterxml.jackson.databind._
import com.fasterxml.jackson.databind.DeserializationFeature.{USE_BIG_DECIMAL_FOR_FLOATS, USE_BIG_INTEGER_FOR_INTS}
import scala.util.control.Exception.allCatch
trait JsonMethods extends org.json4s.JsonMethods[JValue] {
private[this] lazy v... | geggo98/json4s | jackson/src/main/scala/org/json4s/jackson/JsonMethods.scala | Scala | apache-2.0 | 2,028 |
/*
* File PacketRecipe.scala is part of JsonRecipes.
* JsonRecipes is opensource Minecraft mod(released under LGPLv3), created by anti344.
* Full licence information can be found in LICENCE and LICENCE.LESSER files in jar-file of the mod.
* Copyright © 2014, anti344
*/
package net.anti344.jsonrecipes.network.pack... | mc-anti344/JsonRecipes | src/main/scala/net/anti344/jsonrecipes/network/packet/PacketRecipe.scala | Scala | gpl-3.0 | 680 |
package org.jetbrains.plugins.scala
package compiler
import com.intellij.openapi.components.ApplicationComponent
import com.intellij.openapi.projectRoots.{JavaSdk}
import collection.JavaConverters._
import com.intellij.util.PathUtil
import java.io.{IOException, File}
import com.intellij.openapi.application.Application... | consulo/consulo-scala | src/org/jetbrains/plugins/scala/compiler/CompileServerLauncher.scala | Scala | apache-2.0 | 5,996 |
package com.socrata.tileserver
package services
import java.nio.charset.StandardCharsets.UTF_8
import javax.servlet.http.HttpServletResponse
import com.rojoma.json.v3.interpolation._
import com.rojoma.json.v3.io.JsonReader
import org.slf4j.{Logger, LoggerFactory, MDC}
import org.velvia.InvalidMsgPackDataException
im... | socrata-platform/tileserver | src/main/scala/com.socrata.tileserver/services/TileService.scala | Scala | apache-2.0 | 6,048 |
package com.peterpotts.sample
import scala.util.Random
class SampleShuffle[T](samples: Sample[T]*) extends Sample[T] {
def next(): T = samples(Random.nextInt(samples.size)).next()
}
object SampleShuffle {
def apply[T](samples: Sample[T]*) = new SampleShuffle(samples: _*)
}
| peterpotts/sample | src/main/scala/com/peterpotts/sample/SampleShuffle.scala | Scala | mit | 281 |
package week5
import akka.actor.Actor
import akka.actor.ActorRef
import akka.event.LoggingReceive
object WireTransfer {
case class Transfer(from: ActorRef, to: ActorRef, amount: BigInt) {
require(amount > 0)
}
case object Done
case object Failed
}
class WireTransfer extends Actor {
import WireTransfe... | M4573R/playground-notes | principles-of-reactive-programming/week-5/src/main/scala/WireTransfer.scala | Scala | mit | 959 |
/**
* 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... | zzwlstarby/mykafka | core/src/main/scala/kafka/consumer/ConsumerFetcherManager.scala | Scala | apache-2.0 | 6,906 |
package chat.tox.antox.utils
import java.util
import android.content.{BroadcastReceiver, Context, Intent}
import android.net.ConnectivityManager
import chat.tox.antox.tox.ToxSingleton
import scala.collection.JavaConversions._
trait ConnectionTypeChangeListener {
//only called when network is connected
def conne... | wiiam/Antox | app/src/main/scala/chat/tox/antox/utils/ConnectionManager.scala | Scala | gpl-3.0 | 1,736 |
/**
* 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... | TiVo/kafka | core/src/main/scala/kafka/log/LazyIndex.scala | Scala | apache-2.0 | 4,895 |
package com.twitter.finagle.exp.swift
import com.facebook.swift.codec.ThriftCodec
import com.facebook.swift.codec.internal.{TProtocolReader, TProtocolWriter}
import com.twitter.finagle.Service
import com.twitter.finagle.thrift.ThriftClientRequest
import com.twitter.util.Future
import java.lang.reflect.{InvocationHandl... | latur19318/finagle | finagle-swift/src/main/scala/com/twitter/finagle/swift/proxy.scala | Scala | apache-2.0 | 4,057 |
package kafka.common
/**
* 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
* (t... | flange/drift-dev | kafka/00-kafka_2.11-0.10.1.0/libs/tmp/kafka/common/ClientIdAndBroker.scala | Scala | apache-2.0 | 1,344 |
package com.highperformancespark.examples.goldilocks
import scala.collection.mutable.ArrayBuffer
import scala.reflect.ClassTag
import org.apache.spark.{HashPartitioner, Partitioner}
import org.apache.spark.rdd.RDD
object SecondarySort {
//tag::sortByTwoKeys[]
def sortByTwoKeys[K : Ordering : ClassTag , S, V : ... | mahmoudhanafy/high-performance-spark-examples | src/main/scala/com/high-performance-spark-examples/GoldiLocks/SecondarySort.scala | Scala | apache-2.0 | 3,194 |
package doc.jockey.model
import org.scalatest.WordSpec
import example.project.fixture.ComputerIs
import doc.jockey.rendering.HtmlAssertions
class TestNodeBehaviourSpec extends WordSpec with HtmlAssertions {
"Executing a Before gives you an After" in {
val aCmd = ComputerIs(true)
assert(Before(aCmd).execute ... | agmenc/doc-jockey | src/test/scala/doc/jockey/model/TestNodeBehaviourSpec.scala | Scala | mit | 493 |
package api
import spray.routing.Directives
import scala.concurrent.ExecutionContext
import akka.actor.ActorRef
import core.{User, RegistrationActor}
import akka.util.Timeout
import RegistrationActor._
import spray.http._
import core.User
import core.RegistrationActor.Register
import scala.Some
class RegistrationServ... | eigengo/activator-akka-spray | src/main/scala/api/RegistrationService.scala | Scala | apache-2.0 | 1,663 |
package toolkit.exceptions
/**
* Created by #GrowinScala
*/
class GraphRootHasInvalidTypes extends Exception("The graph root has invalid types") | exocute/Toolkit | src/main/scala/toolkit/exceptions/GraphRootHasInvalidTypes.scala | Scala | bsd-2-clause | 149 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | sslavic/kafka | core/src/main/scala/kafka/security/auth/PermissionType.scala | Scala | apache-2.0 | 2,020 |
/*
* Copyright 2001-2016 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 agreed to in writ... | dotty-staging/scalatest | scalactic-macro/src/main/scala/org/scalactic/anyvals/RegexStringMacro.scala | Scala | apache-2.0 | 2,127 |
/*
* @author Philip Stutz
* @author Daniel Strebel
*
* Copyright 2013 University of Zurich
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/li... | gmazlami/dcop-maxsum | src/main/scala/com/signalcollect/examples/EfficientSssp.scala | Scala | apache-2.0 | 4,611 |
package net.wrap_trap.goju
import scala.language.implicitConversions
import scala.language.reflectiveCalls
/**
* goju: HanoiDB(LSM-trees (Log-Structured Merge Trees) Indexed Storage) clone
*
* Copyright (c) 2016 Masayuki Takahashi
*
* This software is released under the MIT License.
* http://opensource.org/lice... | masayuki038/goju | src/main/scala/net/wrap_trap/goju/Helper.scala | Scala | mit | 1,251 |
package com.twitter.finagle.stats
import com.twitter.common.base.Supplier
import com.twitter.common.stats.{Percentile, Stats}
import com.twitter.util.registry.GlobalRegistry
class CommonsStatsReceiver extends StatsReceiverWithCumulativeGauges {
GlobalRegistry.get.put(
Seq("stats", "commons_stats", "counters_lat... | folone/finagle | finagle-commons-stats/src/main/scala/com/twitter/finagle/stats/CommonsStatsReceiver.scala | Scala | apache-2.0 | 1,699 |
package monocle.function
import monocle.{Iso, Prism}
import scala.annotation.implicitNotFound
/**
* Typeclass that defines a [[Prism]] from an `S` and its empty value
* @tparam S source of [[Prism]]
*/
@implicitNotFound("Could not find an instance of Empty[${S}], please check Monocle instance location policy to "... | rperry/Monocle | core/shared/src/main/scala/monocle/function/Empty.scala | Scala | mit | 3,370 |
/** ____ __ ____ ____ ____,,___ ____ __ __ ____
* ( _ \\ /__\\ (_ )(_ _)( ___)/ __) ( _ \\( )( )( _ \\ Read
* ) / /(__)\\ / /_ _)(_ )__) \\__ \\ )___/ )(__)( ) _ < README.txt
* (_)\\_)(__)(__)(____)(____)(____)(___/ (__) (______)(____/ LICENSE.txt
*/... | razie/diesel-hydra | diesel/src/main/scala/razie/diesel/dom/WikiDomain.scala | Scala | apache-2.0 | 4,678 |
package im.mange.flakeless
private [flakeless] class ConditionNotMetException(message: String) extends RuntimeException(message) {
def this(conditionToCheck: String, millis: Long) = this(conditionToCheck + " (not met within " + millis + " millis)\\n")
}
| alltonp/flakeless | src/main/scala/im/mange/flakeless/ConditionNotMetException.scala | Scala | mit | 256 |
package net.chrisloy.akka
import com.amazonaws.services.ec2.AmazonEC2Client
import java.net.URL
import java.io.{InputStreamReader, BufferedReader}
import com.amazonaws.services.ec2.model.{InstanceStateName, DescribeInstancesRequest, Instance}
import scala.collection.JavaConversions._
import com.amazonaws.services.auto... | chrisloy/akka-ec2 | src/main/scala/net/chrisloy/akka/EC2.scala | Scala | gpl-3.0 | 1,889 |
/*
* 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 ... | spark0001/spark2.1.1 | sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala | Scala | apache-2.0 | 10,925 |
package fpscala.c03
import fpscala.datastructures.{Cons, List => FpList, Nil => FpNil}
import org.scalatest.{FlatSpec, Matchers}
class Exercise13Spec extends FlatSpec with Matchers {
"foldLeft implemented in terms of foldRight" should "work" in {
Exercise13.foldLeft(FpList(1, 2, 3, 4), FpNil: FpList[Int])((b, ... | willtaylor/fpscala | src/test/scala/fpscala/c03/Exercise13Spec.scala | Scala | gpl-3.0 | 662 |
package org.scalajs.core.tools.json
import org.json.simple.JSONValue
import scala.collection.JavaConverters._
import java.io.{Writer, Reader}
private[json] object Impl extends AbstractJSONImpl {
type Repr = Object
def fromString(x: String): Repr = x
def fromNumber(x: Number): Repr = x
def fromBoolean(x: B... | mdedetrich/scala-js | tools/jvm/src/main/scala/org/scalajs/core/tools/json/Impl.scala | Scala | bsd-3-clause | 1,153 |
package org.jetbrains.plugins.scala
package lang.typeInference.generated
import lang.typeInference.TypeInferenceTestBase
import org.jetbrains.plugins.scala.util.TestUtils
import org.jetbrains.plugins.scala.util.TestUtils.ScalaSdkVersion
/**
* @author Alefas
* @since 11.12.12
*/
class TypeInferenceScalazTest extend... | consulo/consulo-scala | test/org/jetbrains/plugins/scala/lang/typeInference/generated/TypeInferenceScalazTest.scala | Scala | apache-2.0 | 741 |
object Test {
def main(args: Array[String]): Unit = {
Macros.testDefinitions()
}
}
| som-snytt/dotty | tests/run-macros/tasty-definitions-1/quoted_2.scala | Scala | apache-2.0 | 92 |
package sangria.validation.rules
import sangria.util.{Pos, ValidationSupport}
import org.scalatest.wordspec.AnyWordSpec
class InputDocumentNonConflictingVariableInferenceSpec extends AnyWordSpec with ValidationSupport {
override val defaultRule = Some(new InputDocumentNonConflictingVariableInference)
"InputDocu... | OlegIlyenko/sangria | modules/core/src/test/scala/sangria/validation/rules/InputDocumentNonConflictingVariableInferenceSpec.scala | Scala | apache-2.0 | 1,752 |
/**
* Licensed to Big Data Genomics (BDG) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The BDG licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use ... | tdanford/bdg-utils | utils-metrics/src/main/scala/org/apache/spark/rdd/Timer.scala | Scala | apache-2.0 | 2,816 |
package com.datastax.spark.connector.rdd.partitioner
import java.net.InetAddress
import org.apache.spark.Partition
/** Stores a CQL `WHERE` predicate matching a range of tokens. */
case class CqlTokenRange(cql: String, values: Any*)
trait EndpointPartition extends Partition {
def endpoints: Iterable[InetAddress]
... | brkyvz/spark-cassandra-connector | spark-cassandra-connector/src/main/scala/com/datastax/spark/connector/rdd/partitioner/CassandraRDDPartition.scala | Scala | apache-2.0 | 1,269 |
package im.actor.server.user
import java.time.{ Instant, LocalDateTime, ZoneOffset }
import java.util.TimeZone
import akka.actor.{ ActorSystem, Status }
import akka.http.scaladsl.util.FastFuture
import akka.pattern.pipe
import im.actor.api.rpc.contacts.{ UpdateContactRegistered, UpdateContactsAdded, UpdateContactsRem... | EaglesoftZJ/actor-platform | actor-server/actor-core/src/main/scala/im/actor/server/user/UserCommandHandlers.scala | Scala | agpl-3.0 | 20,957 |
/*
* Copyright 2017 Mediative
*
* 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... | mediative/amadou | core/src/main/scala/com.mediative.amadou/Stage.scala | Scala | apache-2.0 | 4,932 |
/**
* Copyright (c) 2002-2012 "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 Foundati... | dksaputra/community | cypher/src/test/scala/org/neo4j/cypher/docgen/AggregationTest.scala | Scala | gpl-3.0 | 9,203 |
package connectorFamily.featureModel
sealed abstract class AttrConstr
case class IfOut(exp: Exp) extends AttrConstr
case class Require(fid: FID) extends AttrConstr
case class Exclude(fid: FID) extends AttrConstr
//// Booleans - 5 operators ////
abstract class Exp extends AttrConstr {
def &&(e:Exp) = new AndExp(... | joseproenca/connector-family | src/main/scala/connectorFamily/featureModel/AttrConstr.scala | Scala | mit | 2,667 |
/*
* Copyright 2011-2017 Chris de Vreeze
*
* 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... | dvreeze/yaidom | shared/src/main/scala/eu/cdevreeze/yaidom/queryapi/AnyElemApi.scala | Scala | apache-2.0 | 1,514 |
package fpinscala.parallelism
import java.util.concurrent._
object Par {
type Par[A] = ExecutorService => Future[A]
def run[A](s: ExecutorService)(a: Par[A]): Future[A] = a(s)
def unit[A](a: A): Par[A] = (es: ExecutorService) => UnitFuture(a)
// `unit` is represented as a function that returns a `UnitFutur... | wickedwukong/fpinscala2 | exercises/src/main/scala/fpinscala/parallelism/Par.scala | Scala | mit | 3,930 |
package frameless
import org.scalacheck.Arbitrary.arbitrary
import org.scalacheck.Prop._
import org.scalacheck.{Arbitrary, Gen}
import scala.collection.JavaConverters._
import org.scalatest.matchers.should.Matchers
class RandomSplitTests extends TypedDatasetSuite with Matchers {
val nonEmptyPositiveArray: Gen[Arr... | imarios/frameless | dataset/src/test/scala/frameless/forward/RandomSplitTests.scala | Scala | apache-2.0 | 1,342 |
package asobu.distributed
import akka.actor.ActorSystem
import scala.collection.JavaConverters._
object SystemValidator {
def validate(system: ActorSystem): Either[String, Unit] = {
val cfg = system.settings.config
val rolePath = "akka.cluster.distributed-data.role"
if (!cfg.hasPath(rolePath))
Lef... | kailuowang/asobu | distributed/src/main/scala/asobu/distributed/SystemValidator.scala | Scala | apache-2.0 | 678 |
/*
* Copyright (c) 2011. Alexandre Martins. All rights reserved.
*/
package pt.cnbc.wikimodels.client.record
import pt.cnbc.wikimodels.dataModel.Species
import xml.NodeSeq
import net.liftweb.common.Full._
import net.liftweb.common.{Full, Empty, Box}
import net.liftweb.http.{SHtml, S}
import net.liftweb.record._
/*... | alexmsmartins/WikiModels | wm_web_client/src/main/scala/pt/cnbc/wikimodels/client/record/SpeciesRecord.scala | Scala | mit | 2,732 |
object Problem {
def fact(n:Int):BigInt = if(n == 0) 1 else n * fact(n - 1)
def main(args: Array[String]) {
val start = System.currentTimeMillis
println(fact(100).toString.map(x => x.toInt - 48).sum)
val stop = System.currentTimeMillis
println("Time taken: " + (stop - start) + "ms")
}
}
| Jiri-Kremser/euler | 020/Problem.scala | Scala | gpl-2.0 | 312 |
/*
* 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 ... | dbtsai/spark | sql/core/src/main/scala/org/apache/spark/sql/jdbc/DerbyDialect.scala | Scala | apache-2.0 | 2,137 |
package endToEnd.bloomfilter.mutable
import bloomfilter.mutable.BloomFilter
import org.scalatest.{FreeSpec, Matchers}
class SampleUsageSpec extends FreeSpec with Matchers {
"Create, put and check " in {
val bloomFilter = BloomFilter[String](1000, 0.01)
bloomFilter.add("")
bloomFilter.add("Hello!")
... | alexandrnikitin/bloom-filter-scala | tests/src/endToEnd/scala/endToEnd/bloomfilter/mutable/SampleUsageSpec.scala | Scala | mit | 585 |
import scala.reflect.macros.blackbox.Context
import scala.reflect.runtime.{universe => ru}
object Impls {
def foo1(c: Context) = 2
def foo2(c: Context) = ru.Literal(ru.Constant(42))
def foo3(c: Context) = ???
def foo5(c: Context) = c.universe.Literal(c.universe.Constant(42))
def foo6(c: Context) = c.Expr[Int... | yusuke2255/dotty | tests/untried/neg/macro-invalidret/Impls_1.scala | Scala | bsd-3-clause | 369 |
import java.time.{DayOfWeek, LocalDate}
import Schedule.Schedule
case class Meetup(month: Int, year: Int) {
private val thirteenth = LocalDate.of(year, month, 13)
private val firstDay = LocalDate.of(year, month, 1)
private val nextMonth = firstDay.plusMonths(1)
private val teenth: Scheduler = (dayOfWeek: Int... | exercism/xscala | exercises/practice/meetup/.meta/Example.scala | Scala | mit | 1,867 |
package mimir.util
import java.io.ByteArrayInputStream
import java.io.File
import java.io.InputStream
import java.util.List
import my.com.amazonaws.HttpMethod;
import my.com.amazonaws.auth.AWSCredentials
import my.com.amazonaws.auth.BasicAWSCredentials
import my.com.amazonaws.auth.AWSStaticCredentialsProvider
import m... | UBOdin/mimir | src/main/scala/mimir/util/S3Utils.scala | Scala | apache-2.0 | 9,560 |
package TAPL2.Arith
import TAPL2.Util._
import TAPL2.Term
case object TmTrue extends Term
case object TmFalse extends Term
case class TmIf(cond: Term, t1: Term, t2: Term) extends Term
case object TmZero extends Term
case class TmSucc(t: Term) extends Term
case class TmPred(t: Term) extends Term
case class TmIs... | hy-zhang/parser | Scala/Old/TAPL2/Arith/Arith.scala | Scala | bsd-3-clause | 2,082 |
/*
* 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 | mimir/src/main/scala/quasar/mimir/TablePager.scala | Scala | apache-2.0 | 2,517 |
/*
* 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... | intel-analytics/BigDL | scala/dllib/src/main/scala/com/intel/analytics/bigdl/dllib/nn/ops/SquaredDifference.scala | Scala | apache-2.0 | 1,636 |
object Solution {
def numberOfWays(X:Int,N:Int):Int = {
// Compute the answer in this function over here
// It is fine to define new functions as and where required
numberOfWaysInner(X, N, X/2)
}
def numberOfWaysInner(X: Int, N: Int, upper: Int): Int = {
if (X <= 0 || upper <... | franklingu/HackerRank | functional-programming/recursion/the-sum-of-powers/the_sum_of_powers.scala | Scala | mit | 780 |
/*
* 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... | scalatest/scalatest | jvm/core/src/main/scala/org/scalatest/exceptions/NotSerializableWrapperException.scala | Scala | apache-2.0 | 1,273 |
// Copyright 2014 Commonwealth Bank of Australia
//
// 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... | CommBank/piped | src/main/scala/com/cba/omnia/piped/RichTypedPipe.scala | Scala | apache-2.0 | 1,567 |
package views.changekeeper
object PrivateKeeperDetails {
final val BackId = "back"
final val SubmitId = "submit"
} | dvla/vehicles-change-keeper-online | app/views/changekeeper/PrivateKeeperDetails.scala | Scala | mit | 119 |
package io.kaitai.struct.exprlang
import io.kaitai.struct.exprlang.Ast._
/**
* Namespace which holds a bunch of methods and case classes related to
* evaluation of constant expressions, e.g. it can predict that `1 + 2`
* will be always constant and equal to `3`, and anything with a variable
* in it is potenti... | kaitai-io/kaitai_struct_compiler | shared/src/main/scala/io/kaitai/struct/exprlang/ConstEvaluator.scala | Scala | gpl-3.0 | 5,504 |
package ghpages.pages
import japgolly.scalajs.react._, vdom.prefix_<^._
/**
* Created by chandrasekharkode on 11/16/14.
*/
object HomePage {
private val p =
<.p(^.margin := "1.3em 0")
val component = ReactComponentB.static("Home",
<.div(
<.h1(
<.a(
^.color := "#000",
... | beni55/scalajs-react | gh-pages/src/main/scala/ghpages/pages/HomePage.scala | Scala | apache-2.0 | 1,553 |
package org.showgregator.service.view
import com.twitter.finatra.View
/**
* Created with IntelliJ IDEA.
* User: cmarshall
* Date: 1/25/15
* Time: 7:06 PM
* To change this template use File | Settings | File Templates.
*/
class SuccessfulRegisterView(val email: String) extends View {
def template: String = "te... | csm/showgregator | showgregator-service/src/main/scala/org/showgregator/service/view/SuccessfulRegisterView.scala | Scala | agpl-3.0 | 351 |
package scutil.gui
import java.awt.{ AWTEvent, Toolkit }
import java.awt.event._
import scutil.lang._
object GlobalAWTEvent {
// TODO using this is a Using
def connect(mask:Long)(handler:AWTEvent=>Unit):Disposer = {
val listener =
new AWTEventListener {
def eventDispatched(ev:AWTEvent):Unit = handler(ev)
... | ritschwumm/scutil | modules/gui/src/main/scala/scutil/gui/GlobalAWTEvent.scala | Scala | bsd-2-clause | 484 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional logInformation regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you m... | alvsanand/spark-generic-connector | sgc-spark/src/main/scala/org/apache/spark/streaming/sgc/SgcContext.scala | Scala | apache-2.0 | 12,249 |
import scala.tools.nsc.doc.model._
import scala.tools.partest.ScaladocModelTest
object Test extends ScaladocModelTest {
override def code = s"""
/**
* Some scaladoc that contains string literal of HTML
* {{{
* val button = "<button>My Button</button>"
* }}}
*/
object Foo
"""
def s... | scala/scala | test/scaladoc/run/t11424.scala | Scala | apache-2.0 | 774 |
package controllers
import javax.inject.Singleton
import org.slf4j.{Logger, LoggerFactory}
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.libs.json._
import play.api.mvc._
import play.modules.reactivemongo.MongoController
import play.modules.reactivemongo.json.collection.JSONCollec... | HiP-App/HiPBackend | app/controllers/TopicController.scala | Scala | apache-2.0 | 11,075 |
object Test {
type A = Int
// Emits the implementation restriction but then proceeds to crash
// when creating the Foo.unapply.
case class Foo(a: A, b: A, c: A, d: A, e: A, f: A, g: A, h: A, i: A, j: A, k: A, l: A, m: A, n: A, o: A, p: A, q: A, r: A, s: A, t: A, u: A, v: A, w: A, x: A, y: A, Z: A)
}
| yusuke2255/dotty | tests/pending/pos/t7296.scala | Scala | bsd-3-clause | 309 |
package edu.cmu.cs.oak.lib.array
import edu.cmu.cs.oak.core.OakInterpreter
import edu.cmu.cs.oak.value.OakValue
import edu.cmu.cs.oak.lib.InterpreterPlugin
import edu.cmu.cs.oak.lib.InterpreterPluginProvider
import edu.cmu.cs.oak.env.Environment
import java.nio.file.Path
import com.caucho.quercus.expr.Expr
import edu.... | smba/oak | edu.cmu.cs.oak/src/main/scala/edu/cmu/cs/oak/lib/array/ArrayShift.scala | Scala | lgpl-3.0 | 1,379 |
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.