Skip to content

Commit

Permalink
[Compiler plugin] Update imports in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koperagen committed Jun 27, 2024
1 parent 423dca8 commit da0f881
Show file tree
Hide file tree
Showing 53 changed files with 128 additions and 183 deletions.
5 changes: 3 additions & 2 deletions plugins/kotlin-dataframe/testData/box/OuterClass.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.columns.*
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

class OuterClass

Expand Down
13 changes: 4 additions & 9 deletions plugins/kotlin-dataframe/testData/box/Schema.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package org.jetbrains.kotlinx.dataframe

import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.add
import org.jetbrains.kotlinx.dataframe.api.cast
import org.jetbrains.kotlinx.dataframe.api.convert
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
import org.jetbrains.kotlinx.dataframe.api.print
import org.jetbrains.kotlinx.dataframe.api.with
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface Schema {
Expand Down
2 changes: 1 addition & 1 deletion plugins/kotlin-dataframe/testData/box/castTo.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*
import org.jetbrains.kotlinx.dataframe.*

fun box(): String {
val sample =
Expand Down
5 changes: 3 additions & 2 deletions plugins/kotlin-dataframe/testData/box/columnGroupApi.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*

import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
data class Record(val a: String, val b: Int)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
data class Record(val id: String, val b: Int)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.jetbrains.kotlinx.dataframe

import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface Repo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*
import org.jetbrains.kotlinx.dataframe.*

@DataSchema
data class Sessions(
Expand Down
5 changes: 3 additions & 2 deletions plugins/kotlin-dataframe/testData/box/dataRowSchemaApi.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
class Schema(
Expand Down
7 changes: 4 additions & 3 deletions plugins/kotlin-dataframe/testData/box/dataSchemaCodegen.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package foo

import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface Schema {
Expand Down
12 changes: 4 additions & 8 deletions plugins/kotlin-dataframe/testData/box/dfIde.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package org.jetbrains.kotlinx.dataframe

import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.add
import org.jetbrains.kotlinx.dataframe.api.cast
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
import org.jetbrains.kotlinx.dataframe.api.filter
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface Schema {
Expand Down
13 changes: 3 additions & 10 deletions plugins/kotlin-dataframe/testData/box/diff.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
@file:Suppress("warnings")

package org.jetbrains.kotlinx.dataframe

import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit
import java.time.temporal.Temporal
import kotlin.experimental.ExperimentalTypeInference
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.annotations.DisableInterpretation
import org.jetbrains.kotlinx.dataframe.api.cast
import org.jetbrains.kotlinx.dataframe.io.*
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

//fun <T, V : Temporal> DataRow<T>.diff(unit: ChronoUnit, expression: RowExpression<T, V>): Long? = prev()?.let { p -> unit.between(expression(this, this), expression(p, p)) }
fun <T, V : Temporal> DataRow<T>.diff(unit: ChronoUnit, expression: RowExpression<T, V>): Long? = prev()?.let { p -> unit.between(expression(p, p), expression(this, this)) }

/**
Expand Down
2 changes: 2 additions & 0 deletions plugins/kotlin-dataframe/testData/box/dropNulls.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

data class Nested(val i: Double?)

Expand Down
49 changes: 7 additions & 42 deletions plugins/kotlin-dataframe/testData/box/duplicatedSignature.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
// FILE: Test.kt
package org.jetbrains.kotlinx.dataframe

import kotlin.random.Random
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.add
import org.jetbrains.kotlinx.dataframe.api.cast
import org.jetbrains.kotlinx.dataframe.api.convert
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
import org.jetbrains.kotlinx.dataframe.api.explode
import org.jetbrains.kotlinx.dataframe.api.filter
import org.jetbrains.kotlinx.dataframe.api.first
import org.jetbrains.kotlinx.dataframe.api.print
import org.jetbrains.kotlinx.dataframe.api.with
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface Schema {
Expand All @@ -24,14 +16,6 @@ interface Log {
val message: String
}

//fun testCast(): DataFrame<Log> {
// val df = DataFrame.empty(10)
// .add("timestamp") { Random.nextLong() }
// .add("message") { "$timestamp: diagnostic ..." }
//
// return df.cast<Log>()
//}

fun main(args: Array<String>) {
val res = dataFrameOf("a")(1)
.cast<Schema>()
Expand All @@ -43,33 +27,17 @@ fun main(args: Array<String>) {
val a = res.convert { a }.with { it.digitToChar() }

val str: DataColumn<Char> = a.a



print(str)

// println(org.jetbrains.kotlinx.dataframe.testCast())

// val res1 = res.conv
//res.filter { it }
}

// FILE: duplicatedSignature.kt

package org.jetbrains.kotlinx.dataframe

import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.cast
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.read

//@DataSchema
//interface Log {
// val timestamp: Long
// val message: String
//}
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface ActivePlayer {
Expand All @@ -86,11 +54,8 @@ interface ActivePlayer {
fun box(): String {
val df = dataFrameOf("char", "level", "race", "charclass", "zone", "guild", "timestamp")(59425,1,"Orc","Rogue","Orgrimmar",165,"01/01/08 00:02:04").cast<ActivePlayer>(verify = true)
val format = DateTimeFormatter.ofPattern("MM/dd/yy HH:mm:ss")
// df.timestamp
val df1 = df
.convert { timestamp }.with { LocalDateTime.parse(it, format)!! }
// .add("tsDiff") { diff(ChronoUnit.MINUTES) { timestamp }?.let { it > 20 } ?: true }
// .add("charDiff") { diff { char }?.let { it != 0 } ?: true }

df1.print()
return "OK"
Expand Down
11 changes: 4 additions & 7 deletions plugins/kotlin-dataframe/testData/box/explode.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package org.jetbrains.kotlinx.dataframe

import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.cast
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
import org.jetbrains.kotlinx.dataframe.api.explode
import org.jetbrains.kotlinx.dataframe.api.print
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface ExplodeSchema {
Expand Down
5 changes: 2 additions & 3 deletions plugins/kotlin-dataframe/testData/box/explodeDataFrame.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jetbrains.kotlinx.dataframe

import org.jetbrains.kotlinx.dataframe.api.explode
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

fun box(): String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
data class Record(val id: String, val b: Int)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
data class Record(val id: String, val b: Int)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.jetbrains.kotlinx.dataframe

import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
class Bridge(val type: Type,
Expand Down
14 changes: 3 additions & 11 deletions plugins/kotlin-dataframe/testData/box/flexibleReturnType.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
package org.jetbrains.kotlinx.dataframe

import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit
import java.time.temporal.Temporal
import kotlin.experimental.ExperimentalTypeInference
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.annotations.DisableInterpretation
import org.jetbrains.kotlinx.dataframe.api.cast
import org.jetbrains.kotlinx.dataframe.io.*
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface ActivePlayer {
val char: Int
// val level: Int
// val race: String
// val charclass: String
// val zone: String
// val guild: Int
val timestamp: String
}

Expand Down
2 changes: 2 additions & 0 deletions plugins/kotlin-dataframe/testData/box/group.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

data class Record(val a: String, val b: Int)

Expand Down
3 changes: 2 additions & 1 deletion plugins/kotlin-dataframe/testData/box/groupBy.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
data class Record(val a: String, val b: Int)
Expand Down
3 changes: 2 additions & 1 deletion plugins/kotlin-dataframe/testData/box/groupBy_DataRow.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
data class Record(val a: String, val b: Int)
Expand Down
3 changes: 2 additions & 1 deletion plugins/kotlin-dataframe/testData/box/groupBy_toDataFrame.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
data class Record(val a: String, val b: Int)
Expand Down
3 changes: 2 additions & 1 deletion plugins/kotlin-dataframe/testData/box/injectAccessors.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface Cars {
Expand Down
3 changes: 2 additions & 1 deletion plugins/kotlin-dataframe/testData/box/injectAccessorsDsl.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

fun `Dsl is evaluated to `(df: DataFrame<*>) {
val df1 = df.add {
Expand Down
3 changes: 2 additions & 1 deletion plugins/kotlin-dataframe/testData/box/insert.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*

@DataSchema
interface Person {
Expand Down
18 changes: 2 additions & 16 deletions plugins/kotlin-dataframe/testData/box/join.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
package org.jetbrains.kotlinx.dataframe

import org.jetbrains.kotlinx.dataframe.*
import org.jetbrains.kotlinx.dataframe.annotations.*
import org.jetbrains.kotlinx.dataframe.api.asGroupBy
import org.jetbrains.kotlinx.dataframe.api.convert
import org.jetbrains.kotlinx.dataframe.api.count
import org.jetbrains.kotlinx.dataframe.api.explode
import org.jetbrains.kotlinx.dataframe.api.filter
import org.jetbrains.kotlinx.dataframe.api.first
import org.jetbrains.kotlinx.dataframe.api.join
import org.jetbrains.kotlinx.dataframe.api.print
import org.jetbrains.kotlinx.dataframe.api.*
import org.jetbrains.kotlinx.dataframe.io.*
import org.jetbrains.kotlinx.dataframe.api.select
import org.jetbrains.kotlinx.dataframe.api.sortBy
import org.jetbrains.kotlinx.dataframe.api.sortByDesc
import org.jetbrains.kotlinx.dataframe.api.sum
import org.jetbrains.kotlinx.dataframe.api.sumOf
import org.jetbrains.kotlinx.dataframe.api.with

fun box(): String {
val df = @Import DataFrame.readJson("testResources/achievements_all.json")
Expand Down
Loading

0 comments on commit da0f881

Please sign in to comment.