Move scheme to root meta package to avoid import clutter

This commit is contained in:
Alexander Nozik 2020-03-28 10:25:24 +03:00
parent 7f0ad68d9d
commit 01711c2b8c
22 changed files with 21 additions and 48 deletions

View File

@ -1,17 +1,5 @@
package hep.dataforge.descriptors
import hep.dataforge.meta.*
import hep.dataforge.meta.descriptors.ItemDescriptor
import hep.dataforge.meta.descriptors.NodeDescriptor
import hep.dataforge.meta.descriptors.attributes
import hep.dataforge.meta.scheme.ConfigurableDelegate
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.values.parseValue
import kotlin.reflect.KProperty1
import kotlin.reflect.full.findAnnotation
import kotlin.reflect.full.isSubclassOf
import kotlin.reflect.full.memberProperties
//inline fun <reified T : Scheme> T.buildDescriptor(): NodeDescriptor = NodeDescriptor {
// T::class.apply {

View File

@ -1,11 +1,6 @@
package hep.dataforge.data
import hep.dataforge.meta.Meta
import hep.dataforge.meta.isEmpty
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.meta.scheme.SchemeSpec
import hep.dataforge.meta.scheme.string
import hep.dataforge.meta.scheme.wrap
import hep.dataforge.meta.*
import hep.dataforge.names.toName

View File

@ -34,7 +34,7 @@ class EnvelopeBuilder {
/**
* Construct a data binary from given builder
*/
@ExperimentalIoApi
@OptIn(ExperimentalIoApi::class)
fun data(block: Output.() -> Unit) {
data = ArrayBinary.write(builder = block)
}

View File

@ -6,7 +6,6 @@ import hep.dataforge.io.*
import hep.dataforge.meta.Meta
import hep.dataforge.meta.get
import hep.dataforge.meta.int
import hep.dataforge.meta.scheme.int
import kotlin.reflect.KClass
class RemoteFunctionClient(override val context: Context, val responder: Responder) : FunctionServer, ContextAware {

View File

@ -8,7 +8,6 @@ import hep.dataforge.io.Responder
import hep.dataforge.io.type
import hep.dataforge.meta.get
import hep.dataforge.meta.int
import hep.dataforge.meta.scheme.int
class RemoteFunctionServer(
override val context: Context,

View File

@ -3,7 +3,6 @@ package hep.dataforge.io
import hep.dataforge.meta.DFExperimental
import hep.dataforge.meta.get
import hep.dataforge.meta.int
import hep.dataforge.meta.scheme.int
import kotlinx.io.text.writeRawString
import kotlinx.io.text.writeUtf8String

View File

@ -1,6 +1,5 @@
package hep.dataforge.meta.scheme
package hep.dataforge.meta
import hep.dataforge.meta.*
import hep.dataforge.meta.descriptors.*
import hep.dataforge.names.Name
import hep.dataforge.names.toName

View File

@ -1,6 +1,5 @@
package hep.dataforge.meta.scheme
package hep.dataforge.meta
import hep.dataforge.meta.*
import hep.dataforge.names.Name
import hep.dataforge.names.asName
import hep.dataforge.values.*

View File

@ -1,9 +1,10 @@
@file:Suppress("UNUSED_PARAMETER")
package hep.dataforge.meta
import hep.dataforge.meta.descriptors.ItemDescriptor
import hep.dataforge.meta.descriptors.NodeDescriptor
import hep.dataforge.meta.descriptors.ValueDescriptor
import hep.dataforge.meta.scheme.getProperty
import hep.dataforge.names.NameToken
import hep.dataforge.names.toName
import hep.dataforge.values.*

View File

@ -1,6 +1,5 @@
package hep.dataforge.meta
import hep.dataforge.meta.scheme.Configurable
import hep.dataforge.names.*
import hep.dataforge.values.Value

View File

@ -1,6 +1,5 @@
package hep.dataforge.meta.scheme
package hep.dataforge.meta
import hep.dataforge.meta.*
import hep.dataforge.meta.descriptors.*
import hep.dataforge.names.Name
import hep.dataforge.names.NameToken
@ -59,7 +58,8 @@ inline operator fun <T : Scheme> T.invoke(block: T.() -> Unit) = apply(block)
/**
* A specification for simplified generation of wrappers
*/
open class SchemeSpec<T : Scheme>(val builder: () -> T) : Specification<T> {
open class SchemeSpec<T : Scheme>(val builder: () -> T) :
Specification<T> {
override fun empty(): T = builder()
override fun wrap(config: Config, defaultProvider: (Name) -> MetaItem<*>?): T {

View File

@ -1,6 +1,5 @@
package hep.dataforge.meta.scheme
package hep.dataforge.meta
import hep.dataforge.meta.*
import hep.dataforge.names.Name
import kotlin.jvm.JvmName

View File

@ -5,6 +5,9 @@ import hep.dataforge.meta.MetaItem
import hep.dataforge.names.NameToken
import hep.dataforge.values.Null
/**
* A [Meta] that wraps a descriptor node
*/
class DescriptorMeta(val descriptor: NodeDescriptor) : MetaBase() {
override val items: Map<NameToken, MetaItem<*>>
get() = descriptor.items.entries.associate { entry ->

View File

@ -1,7 +1,6 @@
package hep.dataforge.meta.descriptors
import hep.dataforge.meta.*
import hep.dataforge.meta.scheme.*
import hep.dataforge.names.*
import hep.dataforge.values.False
import hep.dataforge.values.True

View File

@ -1,3 +1,5 @@
@file:Suppress("UNUSED_PARAMETER")
package hep.dataforge.meta
import hep.dataforge.meta.descriptors.NodeDescriptor

View File

@ -8,7 +8,7 @@ import kotlin.test.assertEquals
class MetaBuilderTest {
@Test
fun testBuilder() {
val meta = buildMeta {
val meta = Meta {
"a" put 22
"b" put listOf(1, 2, 3)
this["c"] = "myValue".asValue()
@ -25,7 +25,7 @@ class MetaBuilderTest {
@Test
fun testSNS(){
val meta = buildMeta {
val meta = Meta {
repeat(10){
"b.a[$it]" put it
}

View File

@ -1,6 +1,5 @@
package hep.dataforge.meta
import hep.dataforge.meta.scheme.*
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,7 +1,5 @@
package hep.dataforge.meta
import hep.dataforge.meta.scheme.asScheme
import hep.dataforge.meta.scheme.getProperty
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,8 +1,5 @@
package hep.dataforge.meta
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.meta.scheme.Specification
import hep.dataforge.meta.scheme.numberList
import hep.dataforge.names.Name
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -3,7 +3,6 @@ package hep.dataforge.scripting
import hep.dataforge.context.Global
import hep.dataforge.meta.get
import hep.dataforge.meta.int
import hep.dataforge.meta.scheme.int
import hep.dataforge.workspace.SimpleWorkspaceBuilder
import hep.dataforge.workspace.context
import hep.dataforge.workspace.target

View File

@ -1,9 +1,9 @@
package hep.dataforge.tables
import hep.dataforge.meta.scheme.Scheme
import hep.dataforge.meta.scheme.SchemeSpec
import hep.dataforge.meta.scheme.enum
import hep.dataforge.meta.scheme.string
import hep.dataforge.meta.Scheme
import hep.dataforge.meta.SchemeSpec
import hep.dataforge.meta.enum
import hep.dataforge.meta.string
import hep.dataforge.values.ValueType
open class ColumnScheme : Scheme() {

View File

@ -6,7 +6,6 @@ import hep.dataforge.meta.boolean
import hep.dataforge.meta.builder
import hep.dataforge.meta.get
import hep.dataforge.meta.int
import hep.dataforge.meta.scheme.int
import hep.dataforge.names.plus
import kotlin.test.Test
import kotlin.test.assertEquals