Skip to content

Commit

Permalink
FormatOps: in one-arg-per-line, handle lbrace case
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Meltzer committed Feb 18, 2020
1 parent d7b7725 commit e2042d0
Show file tree
Hide file tree
Showing 74 changed files with 771 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ class EngineManifestSerializer
case _ => enginemanifest
}
}
}, {
},
{
case enginemanifest: EngineManifest =>
JObject(JField("id", JString(enginemanifest.id)) ::
JField("version", JString(enginemanifest.version)) ::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class VectorSerializer
case JDouble(x) => x
case _ => 0
}.toVector
}, {
},
{
case x: Vector[Double] =>
JArray(x.toList.map(y => JDouble(y)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class VectorSerializer
}
}
new DenseVector(v)
}, {
},
{
case x: Vector =>
JArray(x.toArray.toList.map(d => JDouble(d)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ class Tuple2IntSerializer
(
{
case JArray(List(JInt(x), JInt(y))) => (x.intValue, y.intValue)
}, {
},
{
case x: (Int, Int) => JArray(List(JInt(x._1), JInt(x._2)))
}
))
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ private[http] object Handshake {
showExactOther: Boolean = true,
caseInsensitive: Boolean = false): Expectation =
check(_.headers.find(_.name == candidate.name))(
compare(candidate, caseInsensitive), {
compare(candidate, caseInsensitive),
{
case Some(other) if showExactOther
s"response that was missing required `$candidate` header. Found `$other` with the wrong value."
case Some(_) s"response with invalid `${candidate.name}` header."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ private[http] object RouteImplementation

case BasicAuthentication(authenticator)
authenticateBasicAsync(
authenticator.realm, { creds
authenticator.realm,
{ creds
val javaCreds =
creds match {
case Credentials.Missing
Expand Down Expand Up @@ -137,7 +138,8 @@ private[http] object RouteImplementation

case OAuth2Authentication(authenticator)
authenticateOAuth2Async(
authenticator.realm, { creds
authenticator.realm,
{ creds
val javaCreds =
creds match {
case Credentials.Missing
Expand Down
3 changes: 2 additions & 1 deletion repos/akka/project/Protobuf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ object Protobuf {
"-I" + srcDir.absolutePath,
"--java_out=%s" format targetDir.absolutePath) ++
protoFiles.map(_.absolutePath),
log, { (p, l) => p ! l })
log,
{ (p, l) => p ! l })
if (exitCode != 0)
sys.error("protoc returned exit code: %d" format exitCode)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ final class DenseMatrix[@spec(Double, Int, Float, Long) V](
/** Creates a matrix with the specified data array and rows. columns inferred automatically */
def this(rows: Int, data: Array[V], offset: Int) =
this(
rows, { assert(data.length % rows == 0); data.length / rows },
rows,
{ assert(data.length % rows == 0); data.length / rows },
data,
offset)

Expand Down
38 changes: 31 additions & 7 deletions repos/breeze/math/src/main/scala/breeze/linalg/Vector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,15 @@ trait VectorOps { this: Vector.type =>
OpMod,
OpPow) Op <: OpType](
implicit @expand.sequence[Op](
{ _ + _ }, { _ - _ }, { _ * _ }, { _ * _ }, {
{ _ + _ },
{ _ - _ },
{ _ * _ },
{ _ * _ }, {
_ / _
}, { (a, b) => b }, { _ % _ }, { _ pow _ })
},
{ (a, b) => b },
{ _ % _ },
{ _ pow _ })
op: Op.Impl2[T, T, T],
@expand.sequence[T](0, 0.0, 0.0f, 0L)
zero: T): BinaryRegistry[Vector[T], T, Op.type, Vector[T]] =
Expand Down Expand Up @@ -488,9 +494,15 @@ trait VectorOps { this: Vector.type =>
OpMod,
OpPow) Op <: OpType](
implicit @expand.sequence[Op](
{ _ + _ }, { _ - _ }, { _ * _ }, { _ * _ }, {
{ _ + _ },
{ _ - _ },
{ _ * _ },
{ _ * _ }, {
_ / _
}, { (a, b) => b }, { _ % _ }, { _ pow _ })
},
{ (a, b) => b },
{ _ % _ },
{ _ pow _ })
op: Op.Impl2[T, T, T],
@expand.sequence[T](0, 0.0, 0.0f, 0L)
zero: T): BinaryRegistry[T, Vector[T], Op.type, Vector[T]] =
Expand Down Expand Up @@ -613,10 +625,22 @@ trait VectorOps { this: Vector.type =>
OpDiv,
OpSet,
OpMod,
OpPow) Op <: OpType](implicit @expand.sequence[Op](
{ _ + _ }, { _ - _ }, { _ * _ }, { _ * _ }, { _ / _ }, { (a, b) => b }, {
OpPow) Op <: OpType](
implicit @expand.sequence[Op](
{ _ + _ }, {
_ - _
}, {
_ * _
}, {
_ * _
}, {
_ / _
},
{ (a, b) => b }, {
_ % _
}, { _ pow _ })
}, {
_ pow _
})
op: Op.Impl2[T, T, T]): BinaryUpdateRegistry[Vector[T], T, Op.type] =
new BinaryUpdateRegistry[Vector[T], T, Op.type] {
override def bindingMissing(a: Vector[T], b: T): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,14 @@ trait DenseMatrixOps { this: DenseMatrix.type =>
implicit def dm_dm_UpdateOp[
@expand.args(Int, Double, Float, Long) T,
@expand.args(OpAdd, OpSub, OpMulScalar, OpDiv, OpSet, OpMod, OpPow) Op <: OpType](
implicit @expand.sequence[Op]({ _ + _ }, { _ - _ }, { _ * _ }, { _ / _ }, {
(a, b) => b
}, { _ % _ }, { _ pow _ }) op: Op.Impl2[T, T, T],
implicit @expand.sequence[Op](
{ _ + _ },
{ _ - _ },
{ _ * _ },
{ _ / _ },
{ (a, b) => b },
{ _ % _ },
{ _ pow _ }) op: Op.Impl2[T, T, T],
@expand.sequence[Op]({ _ += _ }, { _ -= _ }, { _ :*= _ }, { _ :/= _ }, {
_ := _
}, { _ %= _ }, { _ :^= _ }) vecOp: Op.Impl2[T, T, T])
Expand Down Expand Up @@ -781,10 +786,22 @@ trait DenseMatrixOps { this: DenseMatrix.type =>
OpDiv,
OpSet,
OpMod,
OpPow) Op <: OpType](implicit @expand.sequence[Op](
{ _ + _ }, { _ - _ }, { _ * _ }, { _ * _ }, { _ / _ }, { (a, b) => b }, {
OpPow) Op <: OpType](
implicit @expand.sequence[Op](
{ _ + _ }, {
_ - _
}, {
_ * _
}, {
_ * _
}, {
_ / _
},
{ (a, b) => b }, {
_ % _
}, { _ pow _ }) op: Op.Impl2[T, T, T]): Op.InPlaceImpl2[DenseMatrix[T], T] =
}, {
_ pow _
}) op: Op.Impl2[T, T, T]): Op.InPlaceImpl2[DenseMatrix[T], T] =
new Op.InPlaceImpl2[DenseMatrix[T], T] {
def apply(a: DenseMatrix[T], b: T): Unit = {

Expand Down Expand Up @@ -896,7 +913,17 @@ trait DenseMatrixOps { this: DenseMatrix.type =>
@expand.args(Int, Double, Float, Long) T,
@expand.args(OpAdd, OpSub, OpMulScalar, OpMulMatrix, OpDiv, OpMod, OpPow) Op <: OpType](
implicit @expand.sequence[Op](
{ _ + _ }, { _ - _ }, { _ * _ }, { _ * _ }, { _ / _ }, { _ % _ }, {
{ _ + _ }, {
_ - _
}, {
_ * _
}, {
_ * _
}, {
_ / _
}, {
_ % _
}, {
_ pow _
}) op: Op.Impl2[T, T, T]): Op.Impl2[T, DenseMatrix[T], DenseMatrix[T]] =
new Op.Impl2[T, DenseMatrix[T], DenseMatrix[T]] {
Expand Down Expand Up @@ -1475,7 +1502,17 @@ trait DenseMatrix_OrderingOps extends DenseMatrixOps { this: DenseMatrix.type =>
@expand.args(Int, Double, Float, Long) T,
@expand.args(OpGT, OpGTE, OpLTE, OpLT, OpEq, OpNe) Op <: OpType](
implicit @expand.sequence[Op](
{ _ > _ }, { _ >= _ }, { _ <= _ }, { _ < _ }, { _ == _ }, { _ != _ })
{ _ > _ }, {
_ >= _
}, {
_ <= _
}, {
_ < _
}, {
_ == _
}, {
_ != _
})
op: Op.Impl2[T, T, T])
: Op.Impl2[DenseMatrix[T], DenseMatrix[T], DenseMatrix[Boolean]] =
new Op.Impl2[DenseMatrix[T], DenseMatrix[T], DenseMatrix[Boolean]] {
Expand Down Expand Up @@ -1505,7 +1542,17 @@ trait DenseMatrix_OrderingOps extends DenseMatrixOps { this: DenseMatrix.type =>
@expand.args(Int, Double, Float, Long) T,
@expand.args(OpGT, OpGTE, OpLTE, OpLT, OpEq, OpNe) Op <: OpType](
implicit @expand.sequence[Op](
{ _ > _ }, { _ >= _ }, { _ <= _ }, { _ < _ }, { _ == _ }, { _ != _ })
{ _ > _ }, {
_ >= _
}, {
_ <= _
}, {
_ < _
}, {
_ == _
}, {
_ != _
})
op: Op.Impl2[T, T, Boolean])
: Op.Impl2[DenseMatrix[T], Matrix[T], DenseMatrix[Boolean]] =
new Op.Impl2[DenseMatrix[T], Matrix[T], DenseMatrix[Boolean]] {
Expand All @@ -1530,7 +1577,17 @@ trait DenseMatrix_OrderingOps extends DenseMatrixOps { this: DenseMatrix.type =>
@expand.args(Int, Double, Float, Long) T,
@expand.args(OpGT, OpGTE, OpLTE, OpLT, OpEq, OpNe) Op <: OpType](
implicit @expand.sequence[Op](
{ _ > _ }, { _ >= _ }, { _ <= _ }, { _ < _ }, { _ == _ }, { _ != _ })
{ _ > _ }, {
_ >= _
}, {
_ <= _
}, {
_ < _
}, {
_ == _
}, {
_ != _
})
op: Op.Impl2[T, T, Boolean])
: Op.Impl2[DenseMatrix[T], T, DenseMatrix[Boolean]] =
new Op.Impl2[DenseMatrix[T], T, DenseMatrix[Boolean]] {
Expand Down
Loading

0 comments on commit e2042d0

Please sign in to comment.