text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>y.live, Bear.live)
}
<|fim_prefix|>package zio.examples
import zio.examples.types._
import zio._
import java.io.IOException
object ZLayerInjectExample extends ZIOAppDefault {
val program: ZIO[OldLady, IOException, Unit] =
OldLa<|fim_middle|>dy.contentsOfStomach.flatMap { contents =>
Consol... | fim | zio/zio | scala |
<|fim_prefix|>package zio.examples.types
import zio._
trait OldLady {
def contentsOfStomach: UIO[List[String]]
}
object OldLady {
val contentsOfStomach: ZIO[OldLady, Nothing, List[String]] = ZIO.serviceWithZIO(_.contentsOfStomach)
val live: URLayer[Spider with Bear, OldLady] =
ZLayer {
for {
... | fim | zio/zio | scala |
<|fim_suffix|>ilation unit
val program: URIO[
AccessibleMacroExample with Random,
(Int, String, Long, List[Foo], Int, String, String, String, String, Chunk[Int], Chunk[Int], String, String)
] =
for {
_ <- AccessibleMacroExample.foo
_ <- AccessibleMacroExample.foo2
_ <- Accessible... | fim | zio/zio | scala |
<|fim_prefix|>package zio.examples.test
import zio.test._
object ExampleSpec extends ZIOSpecDefault {
def spec = suite("some suite")(
test("failing test") {
<|fim_suffix|>on.isSome(Assertion.equalTo(2)))
},
test("failing test 3") {
val stuff = Some(1)
assert(stuff)(Assertion.isSome(Asser... | fim | zio/zio | scala |
<|fim_prefix|>//package zio.examples.test
//
//import zio._
//import zio.examples.ZLayerInjectExample.{Bear, Fly, OldLady, Spider}
//import zio.test.Assertion.an<|fim_suffix|>eCustom(OldLady.live, Spider.live, Fly.live, Bear.live),
// test("injectShared") {
// assertZIO(exampleZio)(anything)
// }.provi... | fim | zio/zio | scala |
<|fim_prefix|>package zio.internal
import zio.internal.ansi._
private[zio] object TerminalRendering {
def circularityError(circularDependencies: List[(String, String)]): String = {
val circularDependencyMessage =
circularDependencies.map { case (a0, b0) =>
val a = a0.red.bold.underlined
va... | fim | zio/zio | scala |
<|fim_suffix|>= withAnsi(Style.Bold)
def faint: String = withAnsi(Style.Faint)
def underlined: String = withAnsi(Style.Underlined)
def inverted: String = withAnsi(Style.Reversed)
def withAnsi(ansiCode: AnsiCode): String =
new StringBuilder(capacity = ansiCode.code.length + self.length + Re... | fim | zio/zio | scala |
<|fim_suffix|> => List(t)
}
private val badTypes = Set(c.weakTypeOf[AnyRef], c.weakTypeOf[Any], c.weakTypeOf[Object])
def isIntersection(tpe: Type): Boolean =
tpe.widen.dealias match {
case tpe: RefinedType if flattenIntersection(tpe).filterNot(badTypes).distinct.length > 1 => true
case _ ... | fim | zio/zio | scala |
<|fim_suffix|>, Unit] =
ZIO.serviceWithZIO(_.reload)
}
<|fim_prefix|>/*
* Copyright 2023-2024 John A. De Goes and the ZIO Contributors
*
* 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... | fim | zio/zio | scala |
<|fim_prefix|>package zio
package object macros {
implicit final class ReloadableSyntax[Service](private val layer: ZLayer[Any, Any, Service]) extends AnyVal {
/**
* Returns a layer that constructs a version of the service output by this
* layer that can be dynamically reloaded with `ServiceReloader.... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright <|fim_suffix|>oName: String = "accessibleMM"
protected lazy val aliases: Seq[Tree] = Seq(io, rio, urio, managed, rManaged, urManaged)
protected def expectedTypeParams: Long = 2
}
<|fim_middle|>2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License,... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licens<|fim_suffix|> an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ... | fim | zio/zio | scala |
/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* 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 requir... | fim | zio/zio | scala |
<|fim_suffix|>ode, silent = true).tpe)
c.typecheck(tq"$typeName[..$typeArgs]", c.TYPEmode).tpe
}
override protected def typeArgsForService(serviceTypeParams: List[TypeDef]): List[TypeName] =
serviceTypeParams.map(_.name)
override protected def typeParamsForAccessors(serviceTypeParams: Li... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* 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 Lic<|fim_suffix|>arn
import scala.reflect.macros.whitebox
private[ma... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compli<|fim_suffix|>KIND, either express or implied.
* See the License for the specific language governing permissions and
* lim... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the A<|fim_suffix|> with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distrib... | fim | zio/zio | scala |
<|fim_suffix|>lass throwing extends StaticAnnotation
<|fim_prefix|>/*
* Copyright 2021-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>package zio.macros
import zio._
import zio.test._
@scala.annotation.experimental
object ReloadableSpec extends ZIOSpecDefault {
def spec<|fim_suffix|>ableSpec")(
test("reloadable") {
for {
first <- Counter.get
_ <- Counter.increment
second <- Counter.get
... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2023-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_suffix|>nder the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package scala
package annotation
/**
* For Scala 3 compatibility
... | fim | zio/zio | scala |
<|fim_suffix|>val foo: ZIO[Module.Service[URIO] with Unit, Nothing, Unit] =
Module.foo
}
"""
})(isRight(anything))
},
test("generates accessor for functions") {
assertZIO(typeCheck {
"""
@accessibleMM[URIO]
object Module... | fim | zio/zio | scala |
<|fim_prefix|>package zio.macros
import zio._
import zio.managed._
import zio.test.Assertion._
import zio.test._
object AccessibleMSpec extends ZIOSpecDefault {
def spec = suite("AccessibleMSpec")(
suite("AccessibleM macro")(
test("compiles when applied to object with empty Service") {
assertZIO(... | fim | zio/zio | scala |
<|fim_prefix|>package zio.macros
import zio._
import zio.managed._
import zio.stream._
import zio.test.Assertion._
import zio.test._
object AccessibleSpec extends ZIOSpecDefault {
def spec = suite("AccessibleSpec")(
suite("Accessible macro")(
test("compiles when applied to object with empty Service") {
... | fim | zio/zio | scala |
<|fim_suffix|>[String]
val staticManaged : UManaged[String]
def zeroArgsManaged : UManaged[Int]
def zeroArgsTypedManaged[T] : UManaged[T]
def zeroArgsWithParensManaged() ... | fim | zio/zio | scala |
<|fim_suffix|> E, Any],
outputBuffer: => Int = 16
)(implicit trace: Trace): ZStream[R, E, A] =
ZStream.asyncScoped[R, E, A](register(_).scoped, outputBuffer)
}
}
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* Licensed under the Apache License, Version 2.0 (the "... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_suffix|>L()) else readFile(uri.toString())
} yield is
def writeFile(path: String)(implicit trace: Trace): ZManaged[Any, IOException, ZOutputStream] =
ZManaged
.acquireReleaseWith(
ZIO.attemptBlockingIO {
val fos = new io.FileOutputStream(path)
(fos, ZOutputStream.fromO... | fim | zio/zio | scala |
<|fim_suffix|>ronous callback that can be called
* multiple times. The registration of the callback itself returns an a
* managed resource. The optionality of the error type `E` can be used to
* signal the end of the stream, by setting it to `None`.
*/
def asyncManaged[R, E, A](
register: ... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
<|fim_suffix|>issions and
* limitations under the License.
*/
package zio.managed
import zio.stacktracer.TracingImplicits.disableAutoTrace
private[managed] trait ZManagedPlatformSpecific
<|fim_middle|> *
* Licensed under the Apache L... | fim | zio/zio | scala |
<|fim_suffix|>t: ZManagedAspect[LowerR1, UpperR1, LowerE1, UpperE1, LowerA1, UpperA1]
): ZManagedAspect[LowerR1, UpperR1, LowerE1, UpperE1, LowerA1, UpperA1] =
new ZManagedAspect[LowerR1, UpperR1, LowerE1, UpperE1, LowerA1, UpperA1] {
def apply[R >: LowerR1 <: UpperR1, E >: LowerE1 <: UpperE1, A >: LowerA1 ... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2018-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_suffix|> ProvideSomeLayerManagedPartiallyApplied[R0, R, E, A] =
new ProvideSomeLayerManagedPartiallyApplied[R0, R, E, A](self)
/**
* Automatically assembles a layer for the ZManaged effect.
*/
def provide[E1 >: E](layer: ZLayer[_, E1, _]*): ZManaged[Any, E1, A] =
macro LayerMacros.provideImpl[Z... | fim | zio/zio | scala |
<|fim_suffix|> /**
* Splits the environment into two parts, assembling one part using the
* specified layer and leaving the remainder `R0`.
*
* {{{
* val clockLayer: ZLayer[Any, Nothing, Clock] = ???
*
* val managed: ZIO[Clock with Random, Nothing, Unit] = ???
*
* val managed2 = managed.prov... | fim | zio/zio | scala |
package zio.managed
import zio._
import zio.test.Assertion._
import zio.test._
import java.io.{File, IOException}
import java.nio.file.Files
import java.{util => ju}
object ZManagedPlatformSpecificSpec extends ZIOBaseSpec {
def spec = suite("ZManagedPlatformSpecificSpec")(
test("writeFile & readFile & OutputS... | fim | zio/zio | scala |
<|fim_prefix|>package zio.managed
import zio._
import zio.test._
import scala.annotation.tailrec
trait ZIOBaseSpec extends ZIOSpecDefault {
override def aspects: Chunk[TestAspectAtLeastR[TestEnvironment]] =
if (TestPlatform.isJVM) Chunk(TestAspect.timeout(120.seconds), TestAspect.timed)
else if (TestPlatfo... | fim | zio/zio | scala |
<|fim_prefix|>package zio.managed
import zio._
import zio.managed.ZManaged.ReleaseMap
import zio.test.Assertion._
import zio.test.TestAspect.{exceptJS, nonFlaky, scala2Only}
import zio.test._
import scala.concurrent.ExecutionContext
object ZManagedSpec extends ZIOBaseSpec {
import ZIOTag._
def spec = suite("ZM... | fim | zio/zio | scala |
<|fim_suffix|>(
test("automatically constructs a layer, leaving off ZEnv") {
val stringLayer = ZLayer(Console.readLine.orDie)
val program = ZManaged.service[String].zipWith(Random.nextInt.toManaged)((str, int) => s"$str $int")
val provided = TestConsole.feedLines("Your ... | fim | zio/zio | scala |
<|fim_prefix|>import explicitdeps.ExplicitDepsPlugin.autoImport.*
import mdoc.MdocPlugin.autoImport.{mdocIn, mdocOut}
import sbt.*
import sbt.Keys.*
import sbtbuildinfo.*
import sbtbuildinfo.BuildInfoKeys.*
import sbtcrossproject.CrossPlugin.autoImport.*
import scala.scalanative.build.{GC, Mode}
import scala.scalanati... | fim | zio/zio | scala |
<|fim_prefix|>import sbt.*
object Dependencies {
// Runtime dependencies
val JunitVersion = "4.13.2"
val IzumiReflectVersion = "3.0.9"
val JunitPlatformEngineVersion = "6.1.0"
val MagnoliaScala2Version = "1.1.13"
val MagnoliaScala3Version = "1.3.20"
val RefinedVer... | fim | zio/zio | scala |
<|fim_suffix|>ingMethodProblem]("zio.ZLayer#MemoMap*"),
exclude[Problem]("zio.Queue#Strategy*.shutdown"),
exclude[Problem]("zio.test.TestClock#SuspendedWarningData*"),
exclude[Problem]("zio.test.TestClock#WarningData*"),
exclude[Problem]("zio.test.TestClock.SuspendedWarningData"),
... | fim | zio/zio | scala |
<|fim_prefix|><|fim_suffix|> {
object HasSpec extends DefaultRunnableSpec {
override def spec: ZSpec[Environment, Failure] = ???
}
}
<|fim_middle|>/*
rule = Zio2Upgrade
*/
package fix
import zio.test._
class AbstractRunnableSpecToZioSpec<|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>/*
rul<|fim_suffix|>age fix
import zio.blocking.effectBlockingIO
import zio.blocking._
import zio.blocking.Blocking
object BlockingUses {
val x = Blocking.Service
}
<|fim_middle|>e = Zio2Upgrade
*/
pack<|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package zio
trait LatchOps {
def withLatch[R, E, A](f: UIO[Unit] => ZIO[R, E, A]): ZIO[R, E, A] =
Promise.make[Nothing, Unit] >>= (latch => f(latch.succeed(()).unit) <* latch.await)
def withLatch[R, E, A](f: (UIO[Unit], UIO[Unit]) => ZIO[R, E, A]): ZIO[R, E, A] =
for... | fim | zio/zio | scala |
<|fim_suffix|>RIO[Has[Random.Service], Random.Service] = ZIO.service[Random.Service]
}<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio.random.Random
import zio._
object RandomSer<|fim_middle|>vice {
val random: U<|endoftext|> | fim | zio/zio | scala |
/*
rule = Zio2Upgrade
*/
package fix
import zio.Schedule.once
@annotation.nowarn("msg=pure expression does nothing")
object ScheduleRenames {
once.addDelayM _
once.checkM _
once.contramapM _
once.delayedM _
once.dimapM _
once.foldM _
once.mapM _
once.modifyDelayM _
once.reconsiderM _
once.untilIn... | fim | zio/zio | scala |
<|fim_suffix|>ervice], Unit] = ZIO.unit
val effect = getStrLn *> putStrLn("hi")
}<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio.console.Console
import zio.{Has, URIO, ZIO}
import zio.random.Random
import zio.console.{getStrLn, putStrLn}
import zio._
import zio.test.{Annotations, Sized, TestConfig, Te... | fim | zio/zio | scala |
<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio.console.Console
import zio.{Has, URIO, ZIO}
import zio.random.Random
import zio.system.System
import zio.test.{Annotations, Sized, TestConfig, TestLogger}
import zio.test.environment.{Live, TestConsole, TestRandom, TestSystem}
object ServicesIntermediateMi... | fim | zio/zio | scala |
<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio.App
trait SimpleApp e<|fim_suffix|>{}
<|fim_middle|>xtends App <|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio.ZLayer
object ZLayerPieces {
ZLaye<|fim_suffix|>yer.identity[Int]
}
<|fim_middle|>r.requires[Int]
ZLa<|endoftext|> | fim | zio/zio | scala |
<|fim_suffix|>}
),
suite("absolve")(
testM("Returns the same as ZManaged.absolve") {
checkM(Gen.string(Gen.alphaNumericChar)) { str =>
val managedEither: ZManaged[Any, Nothing, Either[Nothing, String]] = ZManaged.succeed(Right(str))
val test = for {
abs1 <- managedE... | fim | zio/zio | scala |
<|fim_suffix|>licateM_ _
ZSTM.unlessM _
ZSTM.whenCaseM _
ZSTM.whenM _
}
<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio.stm.ZSTM
@annotation.nowarn("msg=pure expression does nothing")
object ZSTMRenames {
ZSTM.collectAll_ _
ZSTM.foreach_ _
ZSTM.fromFunction _
ZSTM.fromFunctionM _
ZSTM.i... | fim | zio/zio | scala |
/*
rule = Zio2Upgrade
*/
package zio.stream
import zio._
import zio.random.Random
import zio.test.{Gen, GenZIO, Sized}
object ZStreamGen extends GenZIO {
def tinyListOf[R <: Random, A](g: Gen[R, A]): Gen[R, List[A]] =
Gen.listOfBounded(0, 5)(g)
def tinyChunkOf[R <: Random, A](g: Gen[R, A]): Gen[R, Chunk[A]]... | fim | zio/zio | scala |
<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio.stream.ZStream
object ZStreamPieces {
ZStream.accessStream
val stream: ZStream[Any, Nothing, Unit] = ???
stream.collectWhileM(???)
stream.fold(???)(???)
stream.foldManaged(???)(???)
stream.foldManagedM(???)(???)
stream.foldWhile(???)(???)(??... | fim | zio/zio | scala |
<|fim_prefix|>/*
rule = Zio2Upgrade
*/
package fix
import zio._
import zio.blocking.effectBlockingIO
import zio.blocking._
import zio.blocking.Blocking
import zio.console._
import zio.duration.Duration
import zio.internal.Platform
import z<|fim_suffix|>asEC)
ZManaged.fromFunction( (x: Int) => x)
ZManaged.fromF... | fim | zio/zio | scala |
<|fim_suffix|>extends ZIOSpecDefault {
override def spec = ???
}
}
<|fim_prefix|>package fix
import zio.test._
import zio.test.ZIOSpecDefault
class AbstractRunnableSpecToZioSpec {
object HasSp<|fim_middle|>ec <|endoftext|> | fim | zio/zio | scala |
<|fim_suffix|>lockingUses {
val x = Blocking.Service
}
<|fim_prefix|>pac<|fim_middle|>kage fix
object B<|endoftext|> | fim | zio/zio | scala |
<|fim_suffix|>[Unit]) => ZIO[R, E, A]): ZIO[R, E, A] =
for {
ref <- Ref.make(true)
latch <- Promise.make[Nothing, Unit]
a <- f(latch.succeed(()).unit, ZIO.uninterruptibleMask(restore => ref.set(false) *> restore(latch.await)))
_ <- ZIO.whenZIO(ref.get)(latch.await)
} yield a
}
... | fim | zio/zio | scala |
<|fim_suffix|><|fim_prefix|>package fix
import zio._
import zio.Random
o<|fim_middle|>bject RandomService {
val random: URIO[Random, Random] = ZIO.service[Random]
}<|endoftext|> | fim | zio/zio | scala |
<|fim_suffix|>fyDelayZIO _
once.reconsiderZIO _
once.untilInputZIO _
once.untilOutputZIO _
once.whileInputZIO _
once.whileOutputZIO _
}
<|fim_prefix|>package fix
import zio.Schedule.once
object ScheduleRenames {
once.addDelay<|fim_middle|>ZIO _
once.checkZIO _
once.contramapZIO _
once.delayedZIO _
... | fim | zio/zio | scala |
<|fim_prefix|>package fix
import zio.{URIO, ZIO}
import zio._
import zio.{ Console, Random, S<|fim_suffix|>, TestRandom, TestSystem }
object Services {
val random: URIO[Random, Random] = ZIO.service[Random]
val console: URIO[Console, Console] = ZIO.service[Console]
val live: ZIO[System, Nothing, Unit] = ZIO.uni... | fim | zio/zio | scala |
<|fim_suffix|>stLoggerService: URIO[TestLogger, Unit] = ZIO.unit
val sized: URIO[Sized, Unit] = ZIO.unit
val sizedService: URIO[Sized, Unit] = ZIO.unit
val testConsole: URIO[TestConsole, Unit] = ZIO.unit
val testConsoleService: URIO[TestConsole, Unit] = ZIO.unit
val testRandom: URIO[TestRandom, Unit] = ZIO.un... | fim | zio/zio | scala |
<|fim_prefix|>package fix
import zio.ZIOAppDefault
trait Simple<|fim_suffix|>{}
<|fim_middle|>App extends ZIOAppDefault <|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>package fix
import<|fim_suffix|>ice[Int]
ZLayer.service[Int]
}
<|fim_middle|> zio.ZLayer
object ZLayerPieces {
ZLayer.serv<|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>//format: off
package zio
import zio.Cause.Interrupt
import zio.Exit.Failure
import zio.ZManaged.ReleaseMap
import zio.test.Assertion._
import zio.test.TestAspect.{nonFlaky, scala2Only}
import zio.test._
import zio.{ Clock, FiberId, _ }
import zio.managed._
import zio.test.{ Live, ZIOSpecDefault }
ob... | fim | zio/zio | scala |
<|fim_prefix|>package fix
import zio.stm.ZSTM
object ZSTMRenames {
ZSTM.collectAllDiscard _
ZSTM.foreachDiscard _
ZS<|fim_suffix|>ZSTM.ifSTM _
ZSTM.loopDiscard _
ZSTM.attempt _
ZSTM.replicateSTM _
ZSTM.replicateSTMDiscard _
ZSTM.unlessSTM _
ZSTM.whenCaseSTM _
ZSTM.whenSTM _
}
<|fim_middle|>TM.envi... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio._
import zio.test.{Gen, GenZIO}
import zio.Random
import zio.test.{ Gen, Sized }
object ZStreamGen extends GenZIO {
def tinyListOf[R <: Random, A](g: Gen[R, A]): Gen[R, List[A]] =
Gen.listOfBounded(0, 5)(g)
def tinyChunkOf[R <: Random, A](g: Gen[R, A]): Gen[R, Chun... | fim | zio/zio | scala |
<|fim_prefix|>package fix
import zio.stream.ZStream
object ZStreamPieces {
ZStream.environmentWithStream
val stream: ZStream[Any, Nothing, Unit] = ???
stream.collectWhileZIO(???)
stream.runFold(???)(???)
stream.runFoldManaged(???)(???)
stream.runFoldManagedZIO(???)(???)
stream.runFoldWhile(???)(???)(???... | fim | zio/zio | scala |
<|fim_suffix|>ecutionContext _
Cause.fail("Die").isInterrupted
FiberId
zio.Duration
val x: Layer[Nothing, Random] = zio.Random.live
zio.Executor
RuntimeConfig.fromExecutor(???)
zio.RuntimeConfig
.fromExecutor(???)
Chunk.succeed(1).mapZIO(???)
ZStream.succeed("hi") flatMap (x => ZStream... | fim | zio/zio | scala |
<|fim_suffix|> case List(value, assertion) => (value, assertion)
}
Patch.replaceTree(t, name.toString + "(" + value + ")(" + assertion + ")")
case _ =>
Patch.empty
}.asPatch
}
<|fim_prefix|>package fix
import scalafix.v1._
import scala.meta._
class CurriedAssert extends SemanticRule(... | fim | zio/zio | scala |
<|fim_prefix|>package fix
import scalafix.v1._
import scala.annotation.tailrec
import scala.meta._
class Zio2Upgrade extends SemanticRule("Zio2Upgrade") {
val renames =
Map(
"access" -> "environment",
"accessManaged" -> "environmentWithManaged",
"accessM" ... | fim | zio/zio | scala |
<|fim_suffix|>eSuite with AnyFunSuiteLike {
runAllTests()
}
<|fim_prefix|>package fix
import scalafix.testkit._
import org.scalatest.funsui<|fim_middle|>te.AnyFunSuiteLike
class RuleSuite extends AbstractSemanticRul<|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>package zio.interna<|fim_suffix|>Trace(
location: String,
file: String,
line: Int
)
<|fim_middle|>l.stacktracer
private[zio] final case class Parsed<|endoftext|> | fim | zio/zio | scala |
<|fim_suffix|>Finding the opening parentesis
var openingParentesisIdx = colonIdx - 1
while (openingParentesisIdx >= 0 && trace.charAt(openingParentesisIdx) != '(') {
openingParentesisIdx -= 1
}
if (line == 0 || openingParentesisIdx < 0) null
else
ParsedTrace(
loca... | fim | zio/zio | scala |
package zio.stacktracer
object TracingImplicits {
implicit val disableAutoTrace: DisableAutoTrace = new DisableAutoTrace {}
}
sealed trait DisableAutoTrace
<|endoftext|> | fim | zio/zio | scala |
<|fim_prefix|>package zio.internal.stacktracer
import scala.reflect.macros.{blackbox, whitebox}
import zio.internal.stacktracer.Tracer.createTrace
import zio.stacktracer.DisableAutoTrace
object Macros {
def sourceLocation(c: blackbox.Context): c.Tree = {
import c.universe._
val pos = c.macroApplication.pos... | fim | zio/zio | scala |
<|fim_suffix|>License for the specific language governing permissions and
* limitations under the License.
*/
package zio.internal.stacktracer
final case class SourceLocation(path: String, line: Int)
object SourceLocation {
implicit def sourceLocation: SourceLocation = macro Macros.sourceLocation
}
<|fim_prefix|>... | fim | zio/zio | scala |
<|fim_suffix|>
def apply(location: String, file: String, line: Int): Type with Tracer.Traced
}
<|fim_prefix|>package zio.internal.stacktracer
object Tracer {
trait Traced extends Any
implicit def <|fim_middle|>autoTrace: instance.Type with zio.internal.stacktracer.Tracer.Traced = macro Macros.autoTraceImpl
/... | fim | zio/zio | scala |
<|fim_suffix|> I'm doing, generate a new trace anyway
|[${Console.RED}error${Console.RESET}]
|""".stripMargin
)
report.errorAndAbort("Auto-generated traces are disabled")
}
}
private def traceExpr(trace: String)(using ctx: Quotes): Expr[Tracer.instance.Type] =
'{ ${ E... | fim | zio/zio | scala |
/*
* Copyright 2021-2024 John A. De Goes and the ZIO Contributors
*
* 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 requir... | fim | zio/zio | scala |
<|fim_prefix|>package zio.internal.stacktracer
object Tracer {
type Traced = Any
/**
* This implicit is always in scope and will generate a new Trace any time one
* is implicitly required (or the method is explicitly called)
*
* This can be disabled by importing `import
* zio.stacktracer.TracingImp... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2018-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2018-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2018-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_suffix|>
case (deflater, buffer) => {
lazy val loop: ZChannel[Any, Err, Chunk[Byte], Done, Err, Chunk[Byte], Done] =
ZChannel.readWithCause(
chunk =>
ZChannel.succeed {
deflater.setInput(chunk.toArray)
p... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.stream.compression.{CompressionException, Gunzipper}
import zio.{Chunk, ZIO, Trace}
private object Gunzip {
def m<|fim_suffix|> done =>
ZChannel.fromZIO {
gunzipper.onNo... | fim | zio/zio | scala |
<|fim_suffix|>ace): ZChannel[Any, Err, Chunk[Byte], Done, Err, Chunk[Byte], Done] =
ZChannel.unwrapScoped {
ZIO
.acquireRelease(
Gzipper.make(bufferSize, level, strategy, flushMode)
) { gzipper =>
ZIO.succeed(gzipper.close())
}
.map {
case gzipper ... | fim | zio/zio | scala |
<|fim_suffix|>
} else {
throw CompressionException("Inflater is not finished when input stream completed")
}
}.refineOrDie { case e: DataFormatException =>
CompressionException(e)
}
}.fl... | fim | zio/zio | scala |
<|fim_suffix|> => ref.set(a).as(b) <* hub.publish(a) })
def set(a: A)(implicit trace: Trace): UIO[Unit] =
semaphore.withPermit(ref.set(a) <* hub.publish(a))
def setAsync(a: A)(implicit trace: Trace): UIO[Unit] =
semaphore.withPermit(ref.setAsync(a) <* hub.publish(a))
}
}
<|fim_prefix|>/*... | fim | zio/zio | scala |
<|fim_suffix|> exit.foldExitZIO(Cause.flipCauseOption(_).fold(end)(error), value)
/**
* Checks if this `take` is done (`Take.end`).
*/
def isDone: Boolean =
exit.foldExit(Cause.flipCauseOption(_).isEmpty, _ => false)
/**
* Checks if this `take` is a failure.
*/
def isFailure: Boolean =
exi... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2018-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>package zio.stream
import zio.{LogAnnotation, Trace}
import zio.metrics.MetricLabel
import zio.stacktracer.TracingImplicits.disableAutoTrace
trait ZStreamAspect[+LowerR, -UpperR, +LowerE, -UpperE, +LowerA, -UpperA] { self =>
def apply[R >: LowerR <: UpperR, E >: LowerE <: UpperE, A >: LowerA <: Upper... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
<|fim_suffix|>ress: Boolean = acc.nonEmpty
}
private class ParseExtraStep(acc: Array[Byte], crc32: CRC32, checkCrc16: Boolean, commentsToSkip: Int) extends State {
override def feed(chunkBytes: Array[Byte]): (State, Chunk[Byte]) = {
val bytes = acc ++ chunkBytes
if (bytes.length < 12) {
(n... | fim | zio/zio | scala |
/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* 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 requir... | fim | zio/zio | scala |
<|fim_prefix|>/*
* Copyright 2020-2024 John A. De Goes and the ZIO Contributors
*
* 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
*
*... | fim | zio/zio | scala |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.