Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.7.3 #502

Merged
merged 3 commits into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.7.3
8c629287bf6379612d07c274a5cbc00f08651057
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "3.3.3"
version = "3.7.3"
runner.dialect = scala213source3
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ lazy val linalg = project
.settings(
name := "saddle-linalg",
libraryDependencies ++= Seq(
"io.github.pityka" % "netlib-java" % "0.1.0",
"io.github.pityka" % "netlib-java" % "0.1.0"
) ++ scalaTest
)
.dependsOn(
Expand Down Expand Up @@ -387,7 +387,7 @@ lazy val io = crossProject(JSPlatform, JVMPlatform)
.settings(
name := "saddle-io",
scalaVersion := scalaVersionInBuild,
libraryDependencies ++= scalaTest++specs,
libraryDependencies ++= scalaTest ++ specs,
mimaBinaryIssueFilters := Seq(
// format: off
ProblemFilters.exclude[DirectMissingMethodProblem]("org.saddle.io.npy.package.readFully"),
Expand Down
9 changes: 6 additions & 3 deletions saddle-binary/src/main/scala/org/saddle/binary/Reader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object Reader {
Right(s.map(_.toOption.get))
else s.find(_.isLeft).get.asInstanceOf[Left[A, Seq[B]]]

private def readFully(bb: ByteBuffer, channel: ReadableByteChannel) : Unit = {
private def readFully(bb: ByteBuffer, channel: ReadableByteChannel): Unit = {
bb.clear
var i = 0
while (bb.hasRemaining && i >= 0) {
Expand Down Expand Up @@ -196,7 +196,8 @@ object Reader {
}
}

private class ByteChannel(srcs: IndexedSeq[ByteBuffer]) extends ReadableByteChannel {
private class ByteChannel(srcs: IndexedSeq[ByteBuffer])
extends ReadableByteChannel {

var i = 0
var src = srcs(i)
Expand Down Expand Up @@ -226,7 +227,9 @@ object Reader {
def readMatFromArrays[T: ST](
arrays: IndexedSeq[Array[Byte]]
): Either[String, Mat[T]] =
readMatFromChannel(new ByteChannel(arrays.map(array => ByteBuffer.wrap(array))))
readMatFromChannel(
new ByteChannel(arrays.map(array => ByteBuffer.wrap(array)))
)
def readMatFromArray[T: ST](
array: Array[Byte]
): Either[String, Mat[T]] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BinarySuite extends AnyFunSuite {
)
val binaryFrame = Writer.writeFrameIntoArray(frame).toOption.get
val binaryMat = Writer.writeMatIntoArray(frame.toMat).toOption.get
val binaryMats = Writer.writeMatIntoArrays(frame.toMat,16).toOption.get
val binaryMats = Writer.writeMatIntoArrays(frame.toMat, 16).toOption.get
val deserFrame = Reader.readFrameFromArray[Double](binaryFrame)
val deserMat = Reader.readMatFromArrays[Double](Vector(binaryFrame))
val deserMat2 = Reader.readMatFromArrays[Double](Vector(binaryMat))
Expand Down
2 changes: 1 addition & 1 deletion saddle-core/src/main/scala/org/saddle/Mat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class Mat[@spec(Boolean, Int, Long, Double) T](
values: Array[T],
val scalarTag: ScalarTag[T]
) extends NumericOps[Mat[T]] {
implicit private[this] def st : ScalarTag[T] = scalarTag
implicit private[this] def st: ScalarTag[T] = scalarTag

/** Returns the backing array of this Mat Mutations to this array are visible
* to this Mat
Expand Down
11 changes: 5 additions & 6 deletions saddle-core/src/main/scala/org/saddle/Series.scala
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,11 @@ class Series[X: ST: ORD, @spec(Int, Long, Double) T: ST](
Series(values.take(offset), nix)
}

/** Return a series with the current index as values and
* current values as index
*/
def swap(implicit ord: ORD[T]): Series[T,X] =
Series(Index(this.values),this.index.toVec)

/** Return a series with the current index as values and current values as
* index
*/
def swap(implicit ord: ORD[T]): Series[T, X] =
Series(Index(this.values), this.index.toVec)

// filtering

Expand Down
4 changes: 2 additions & 2 deletions saddle-core/src/main/scala/org/saddle/csv/CsvParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ object CsvParser {

Left(
s"Header line to short for given locs: ${locs.mkString("[", ", ", "]")}. Header line: ${callback.allHeaderFields
.mkString("[", ", ", "]")}"
.mkString("[", ", ", "]")}"
)
} else {
val columns =
Expand Down Expand Up @@ -294,7 +294,7 @@ object CsvParser {
error = true
errorString =
s"Header line to short for given locs: ${locs.mkString("[", ", ", "]")}. Header line: ${allHeaderFields
.mkString("[", ", ", "]")}"
.mkString("[", ", ", "]")}"
}
if (loc < headerAllFields - 1) {
error = true
Expand Down
2 changes: 1 addition & 1 deletion saddle-core/src/main/scala/org/saddle/index/IndexInt.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.saddle.locator.Locator
class IndexInt(keys: Vec[Int], val ord: ORD[Int]) extends Index[Int] {
val scalarTag = ScalarTagInt

private implicit def o : ORD[Int]= ord
private implicit def o: ORD[Int] = ord

private lazy val (lmap, IndexProperties(contiguous, monotonic)) =
IndexImpl.keys2map(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class IndexIntRange(val length: Int, val from: Int = 0, val ord: ORD[Int])
extends Index[Int] {
require(length >= 0, "Length must be non-negative!")

private implicit def o : ORD[Int]= ord
private implicit def o: ORD[Int] = ord

@transient lazy val scalarTag = ScalarTagInt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.saddle.locator.Locator
class IndexLong(keys: Vec[Long], val ord: ORD[Long]) extends Index[Long] {
val scalarTag = ScalarTagLong

implicit private def o : ORD[Long]= ord
implicit private def o: ORD[Long] = ord

private lazy val (lmap, IndexProperties(contiguous, monotonic)) =
IndexImpl.keys2map(this)
Expand Down
17 changes: 11 additions & 6 deletions saddle-core/src/main/scala/org/saddle/index/IndexMaker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,39 @@ object IndexMaker extends IndexMakerLowPriority {
// -------------------------
// IndexMaker instances

implicit def make2V[T[K] <: IndexedSeq[K], I1: ORD, I2: ORD] : IndexMaker[(T[I1], T[I2]), (I1, I2)]=
implicit def make2V[T[K] <: IndexedSeq[K], I1: ORD, I2: ORD]
: IndexMaker[(T[I1], T[I2]), (I1, I2)] =
new IndexMaker[(T[I1], T[I2]), (I1, I2)] {
def apply(in: (T[I1], T[I2])) = zip2V(in._1, in._2)
}

implicit def make2Vec[I1: ORD, I2: ORD] :IndexMaker[(Vec[I1], Vec[I2]), (I1, I2)] =
implicit def make2Vec[I1: ORD, I2: ORD]
: IndexMaker[(Vec[I1], Vec[I2]), (I1, I2)] =
new IndexMaker[(Vec[I1], Vec[I2]), (I1, I2)] {
def apply(in: (Vec[I1], Vec[I2])) = zip2Vec(in._1, in._2)
}

implicit def make3V[T[K] <: IndexedSeq[
K
], I1: ORD, I2: ORD, I3: ORD] : IndexMaker[(T[I1], T[I2], T[I3]), (I1, I2, I3)]=
], I1: ORD, I2: ORD, I3: ORD]
: IndexMaker[(T[I1], T[I2], T[I3]), (I1, I2, I3)] =
new IndexMaker[(T[I1], T[I2], T[I3]), (I1, I2, I3)] {
def apply(in: (T[I1], T[I2], T[I3])) = zip3V(in._1, in._2, in._3)
}

implicit def make4V[T[K] <: IndexedSeq[
K
], I1: ORD, I2: ORD, I3: ORD, I4: ORD] : IndexMaker[(T[I1], T[I2], T[I3], T[I4]), (I1, I2, I3, I4)]=
], I1: ORD, I2: ORD, I3: ORD, I4: ORD]
: IndexMaker[(T[I1], T[I2], T[I3], T[I4]), (I1, I2, I3, I4)] =
new IndexMaker[(T[I1], T[I2], T[I3], T[I4]), (I1, I2, I3, I4)] {
def apply(in: (T[I1], T[I2], T[I3], T[I4])) =
zip4V(in._1, in._2, in._3, in._4)
}

implicit def make5V[T[K] <: IndexedSeq[
K
], I1: ORD, I2: ORD, I3: ORD, I4: ORD, I5: ORD] :IndexMaker[(T[I1], T[I2], T[I3], T[I4], T[I5]), (I1, I2, I3, I4, I5)] =
], I1: ORD, I2: ORD, I3: ORD, I4: ORD, I5: ORD]
: IndexMaker[(T[I1], T[I2], T[I3], T[I4], T[I5]), (I1, I2, I3, I4, I5)] =
new IndexMaker[(T[I1], T[I2], T[I3], T[I4], T[I5]), (I1, I2, I3, I4, I5)] {
def apply(in: (T[I1], T[I2], T[I3], T[I4], T[I5])) =
zip5V(in._1, in._2, in._3, in._4, in._5)
Expand Down Expand Up @@ -178,7 +183,7 @@ trait IndexMakerLowPriority {
implicit def make1V[T[K] <: IndexedSeq[K], A](implicit
st: ST[A],
org: ORD[A]
):IndexMaker[T[A], A] =
): IndexMaker[T[A], A] =
new IndexMaker[T[A], A] {
def apply(in: T[A]): Index[A] = {
val sz = in.length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class JoinerImpl[@spec(Boolean, Int, Long, Double) T: ST: ORD]
// hits hashmap
val szhint = left.length + right.length

val res = Buffer.empty[T](szhint)
val res = Buffer.empty[T](szhint)
val lft = Buffer.empty[Int](szhint)
val rgt = Buffer.empty[Int](szhint)

Expand Down
Loading