Skip to content

Commit

Permalink
V0.11 of doc utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhillHenry committed Dec 11, 2023
1 parent 6d4e377 commit f08c72d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import org.scalatest.GivenWhenThen
import org.scalatest.matchers.should.Matchers._
import uk.co.odinconsultants.documentation_utils.{SpecPretifier, TableNameFixture}

import java.io.ByteArrayOutputStream

class ChangeDataFlowSpec extends SpecPretifier with GivenWhenThen with TableNameFixture {

info(
Expand Down Expand Up @@ -63,14 +61,6 @@ class ChangeDataFlowSpec extends SpecPretifier with GivenWhenThen with TableName
)
}
}

def captureOutputOf[T](thunk: => T): String = {
val out = new ByteArrayOutputStream()
Console.withOut(out) {
thunk
}
new String(out.toByteArray)
}
}

object ChangeDataFlowSpec {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,6 @@ class MergingDataSpec extends SpecPretifier with GivenWhenThen with TableNameFix
}
}

def histogram[K, V](kv: Map[K, V], names: Seq[String]): String = {
val width = (kv.keys.map(_.toString.length) ++ names.map(_.length)).max + 2
Seq(columnNames(names, width), histogramValues(kv, width)).mkString("\n")
}

def columnNames(names: Seq[String], width: Int = 20): String = {
val cols = names.map(x => s"%-${width}s".format(x)).mkString("")
val lines = names.map(x => s"%-${width}s".format("-" * x.length)).mkString("")
Seq(cols, lines).mkString("\n")
}

def histogramValues[K, V](kv: Map[K, V], width: Int = 20): String =
kv.map { case (k, v) => s"%-${width}s%s".format(k, v) }.mkString("\n")

private def partitionKeyToCount(
data: Seq[Datum]
): Map[Long, Int] =
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Dependencies {
val hadoopAws = "3.3.1"
val minio = "8.5.5"
val deltaLake = "3.0.0"
val documentationUtils = "0.8"
val documentationUtils = "0.11"
val scalaTest = "3.2.17"
}

Expand Down

0 comments on commit f08c72d

Please sign in to comment.