Move to DF 0.6.0-dev-6

This commit is contained in:
Alexander Nozik 2022-05-08 22:21:01 +03:00
parent 9396f3014e
commit efd38f4c11
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
3 changed files with 14 additions and 8 deletions

View File

@ -21,7 +21,7 @@ application {
} }
val dataforgeVersion by extra("0.6.0-dev-5") val dataforgeVersion by extra("0.6.0-dev-6")
val ktorVersion = KScienceVersions.ktorVersion val ktorVersion = KScienceVersions.ktorVersion
dependencies { dependencies {
@ -42,6 +42,12 @@ dependencies {
kotlin { kotlin {
explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Disabled explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Disabled
sourceSets.all {
languageSettings {
languageVersion = "1.7"
apiVersion = "1.7"
}
}
} }

View File

@ -96,7 +96,7 @@ class DataSetPageContext(
@DFInternal @DFInternal
override fun <T : Any> resolveAll(type: KType, predicate: (name: Name, meta: Meta) -> Boolean): DataSet<T> = override fun <T : Any> resolveAll(type: KType, predicate: (name: Name, meta: Meta) -> Boolean): DataSet<T> =
dataSet.filterIsInstance(type, predicate = predicate) dataSet.filterByType(type, predicate = predicate)
override fun resolveHtml(name: Name): HtmlData? = runBlocking { override fun resolveHtml(name: Name): HtmlData? = runBlocking {
resolve<ByteArray>(name)?.takeIf { it.published }?.toHtmlBlock() resolve<ByteArray>(name)?.takeIf { it.published }?.toHtmlBlock()
@ -104,7 +104,7 @@ class DataSetPageContext(
override fun resolveAllHtml(filter: (name: Name, meta: Meta) -> Boolean): Map<Name, HtmlData> = runBlocking { override fun resolveAllHtml(filter: (name: Name, meta: Meta) -> Boolean): Map<Name, HtmlData> = runBlocking {
buildMap { buildMap {
resolveAll<ByteArray>(filter).dataSequence().filter { it.published }.forEach { resolveAll<ByteArray>(filter).traverse().filter { it.published }.forEach {
put(it.name, it.toHtmlBlock()) put(it.name, it.toHtmlBlock())
} }
} }

View File

@ -4,8 +4,8 @@ import space.kscience.dataforge.actions.invoke
import space.kscience.dataforge.context.Context import space.kscience.dataforge.context.Context
import space.kscience.dataforge.data.Data import space.kscience.dataforge.data.Data
import space.kscience.dataforge.data.DataSet import space.kscience.dataforge.data.DataSet
import space.kscience.dataforge.data.filterIsInstance import space.kscience.dataforge.data.filterByType
import space.kscience.dataforge.data.selectOne import space.kscience.dataforge.data.getByType
import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.misc.DFInternal import space.kscience.dataforge.misc.DFInternal
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
@ -30,14 +30,14 @@ class SnarkPageContext(
private val parsedData: DataSet<Any> by lazy { snarkPlugin.parseAction(directoryDataTree) } private val parsedData: DataSet<Any> by lazy { snarkPlugin.parseAction(directoryDataTree) }
@DFInternal @DFInternal
override fun <T : Any> resolve(type: KType, name: Name): Data<T>? = parsedData.selectOne(type, name) override fun <T : Any> resolve(type: KType, name: Name): Data<T>? = parsedData.getByType(type, name)
@DFInternal @DFInternal
override fun <T : Any> resolveAll(type: KType, predicate: (name: Name, meta: Meta) -> Boolean): DataSet<T> = override fun <T : Any> resolveAll(type: KType, predicate: (name: Name, meta: Meta) -> Boolean): DataSet<T> =
parsedData.filterIsInstance(type, predicate) parsedData.filterByType(type, predicate)
override fun resolveHtml(name: Name): HtmlData? = resolve(name) override fun resolveHtml(name: Name): HtmlData? = resolve(name)
override fun resolveAllHtml(filter: (name: Name, meta: Meta) -> Boolean): Map<Name, HtmlData> = override fun resolveAllHtml(filter: (name: Name, meta: Meta) -> Boolean): Map<Name, HtmlData> =
resolveAll<HtmlFragment>(filter).dataSequence().filter { it.published }.associate { it.name to it.data } resolveAll<HtmlFragment>(filter).traverse().filter { it.published }.associate { it.name to it.data }
} }