1
1
package org.jetbrains.kotlinx.dataframe.explainer
2
2
3
- import com.beust.klaxon.JsonObject
4
3
import org.jetbrains.kotlinx.dataframe.AnyCol
5
4
import org.jetbrains.kotlinx.dataframe.AnyFrame
6
5
import org.jetbrains.kotlinx.dataframe.DataFrame
@@ -22,7 +21,6 @@ import org.jetbrains.kotlinx.dataframe.api.Update
22
21
import org.jetbrains.kotlinx.dataframe.api.format
23
22
import org.jetbrains.kotlinx.dataframe.api.frames
24
23
import org.jetbrains.kotlinx.dataframe.api.into
25
- import org.jetbrains.kotlinx.dataframe.api.print
26
24
import org.jetbrains.kotlinx.dataframe.api.toDataFrame
27
25
import org.jetbrains.kotlinx.dataframe.api.values
28
26
import org.jetbrains.kotlinx.dataframe.api.where
@@ -88,11 +86,11 @@ object PluginCallback {
88
86
when (statements.size) {
89
87
0 -> TODO (" function doesn't have any dataframe expression" )
90
88
1 -> {
91
- output + = statementOutput(statements.values.single(), open = false )
89
+ output + = statementOutput(statements.values.single())
92
90
}
93
91
else -> {
94
92
statements.forEach { (index, expressions) ->
95
- var details: DataFrameHtmlData = statementOutput(expressions, open = true )
93
+ var details: DataFrameHtmlData = statementOutput(expressions)
96
94
97
95
details = details.copy(
98
96
body =
@@ -123,10 +121,7 @@ object PluginCallback {
123
121
124
122
private fun statementOutput (
125
123
expressions : List <Expression >,
126
- open : Boolean ,
127
124
): DataFrameHtmlData {
128
- // val attribute = if (open) " open" else ""
129
- val attribute = " "
130
125
var data = DataFrameHtmlData ()
131
126
if (expressions.size < 2 ) error(" Sample without output or input (i.e. function returns some value)" )
132
127
for ((i, expression) in expressions.withIndex()) {
@@ -135,7 +130,7 @@ object PluginCallback {
135
130
val table = convertToHTML(expression.df)
136
131
val description = table.copy(
137
132
body = """
138
- <details$attribute >
133
+ <details>
139
134
<summary>Input ${convertToDescription(expression.df)} </summary>
140
135
${table.body}
141
136
</details>
@@ -148,7 +143,7 @@ object PluginCallback {
148
143
val table = convertToHTML(expression.df)
149
144
val description = table.copy(
150
145
body = """
151
- <details$attribute >
146
+ <details>
152
147
<summary>Output ${convertToDescription(expression.df)} </summary>
153
148
${table.body}
154
149
</details>
@@ -180,41 +175,6 @@ object PluginCallback {
180
175
val element = Expression (source, containingClassFqName, containingFunName, df)
181
176
list?.plus(element) ? : listOf (element)
182
177
}
183
- // strings.add(string)
184
- // names.add(name)
185
- // Can be called with the same name multiple times, need to aggregate samples by function name somehow?
186
- // save schema
187
- val path = " $containingClassFqName .$containingFunName .html"
188
- // names.compute(path) { }
189
- // dfs.add(path)
190
- if (df is AnyFrame ) {
191
- println (source)
192
- // df.print()
193
- println (id)
194
- println (receiverId)
195
- } else {
196
- println (df::class )
197
- }
198
- File (" build/out" ).let {
199
- val json = JsonObject (
200
- mapOf (
201
- " string" to source,
202
- " name" to name,
203
- " path" to path,
204
- " id" to id,
205
- " receiverId" to receiverId,
206
- )
207
- ).toJsonString()
208
- it.appendText(json)
209
- it.appendText(" ,\n " )
210
- }
211
- println (path)
212
- if (df is AnyFrame ) {
213
- df.print ()
214
- } else {
215
- println (df::class )
216
- }
217
- // convertToHTML(df).writeHTML(File("build/dataframes/$path"))
218
178
}
219
179
220
180
@Suppress(" unused" )
0 commit comments