Skip to content

Commit a0c1a18

Browse files
committed
fixup! ktlint: manual fixes
1 parent f6ee8d5 commit a0c1a18

File tree

156 files changed

+1857
-2613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1857
-2613
lines changed

build.gradle.kts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,13 @@ fun String.findVersion(): Version {
7878
// these names of outdated dependencies will not show up in the table output
7979
val dependencyUpdateExclusions = listOf(
8080
// TODO Requires more work to be updated to 1.7.0+, https://github.com/Kotlin/dataframe/issues/594
81-
libs.plugins.kover
82-
.get()
83-
.pluginId,
81+
libs.plugins.kover.get().pluginId,
8482
// TODO 5.8.0 is not possible due to https://github.com/Kotlin/dataframe/issues/595
8583
libs.kotestAssertions.get().name,
8684
// Can't be updated to 7.4.0+ due to Java 8 compatibility
87-
libs.android.gradle.api
88-
.get()
89-
.group,
85+
libs.android.gradle.api.get().group,
9086
// TODO 0.1.6 broke kotlinter, https://github.com/Kotlin/dataframe/issues/598
91-
libs.plugins.korro
92-
.get()
93-
.pluginId,
87+
libs.plugins.korro.get().pluginId,
9488
// Directly dependent on the Gradle version
9589
"org.gradle.kotlin.kotlin-dsl",
9690
)
@@ -110,16 +104,14 @@ tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
110104
doLast {
111105
val outputFile = layout.buildDirectory
112106
.file("../$outputDir/$reportfileName.json")
113-
.get()
114-
.asFile
107+
.get().asFile
115108
when (val outDatedDependencies = DataFrame.readJson(outputFile)["outdated"]["dependencies"][0]) {
116109
is AnyFrame -> {
117-
val df = outDatedDependencies
118-
.select {
119-
cols("group", "name", "version") and {
120-
"available"["milestone"] named "newVersion"
121-
}
122-
}.filter { "name"() !in dependencyUpdateExclusions && "group"() !in dependencyUpdateExclusions }
110+
val df = outDatedDependencies.select {
111+
cols("group", "name", "version") and {
112+
"available"["milestone"] named "newVersion"
113+
}
114+
}.filter { "name"() !in dependencyUpdateExclusions && "group"() !in dependencyUpdateExclusions }
123115
logger.warn("Outdated dependencies found:")
124116
df.print(
125117
rowsLimit = Int.MAX_VALUE,

core/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,7 @@ val changeJarTask by tasks.creating {
231231
doFirst {
232232
tasks.withType<Jar> {
233233
doFirst {
234-
require(
235-
generatedSources.kotlin.srcDirs
236-
.toList()
237-
.isNotEmpty(),
238-
) {
234+
require(generatedSources.kotlin.srcDirs.toList().isNotEmpty()) {
239235
logger.error("`processKDocsMain`'s outputs are empty, did `processKDocsMain` run before this task?")
240236
}
241237
kotlin.sourceSets.main {

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,8 @@ internal interface DiffOrNullDocs
102102
@OptIn(ExperimentalTypeInference::class)
103103
@OverloadResolutionByLambdaReturnType
104104
public fun <T> DataRow<T>.diff(firstRowResult: Double, expression: RowExpression<T, Double>): Double =
105-
prev()?.let { p ->
106-
expression(
107-
this,
108-
this,
109-
) - expression(p, p)
110-
} ?: firstRowResult
105+
prev()?.let { p -> expression(this, this) - expression(p, p) }
106+
?: firstRowResult
111107

112108
/**
113109
* @include [DiffDocs]
@@ -116,37 +112,30 @@ public fun <T> DataRow<T>.diff(firstRowResult: Double, expression: RowExpression
116112
@OverloadResolutionByLambdaReturnType
117113
// required to resolve `diff(0) { intValue }`
118114
public fun <T> DataRow<T>.diff(firstRowResult: Int, expression: RowExpression<T, Int>): Int =
119-
prev()?.let { p ->
120-
expression(
121-
this,
122-
this,
123-
) - expression(p, p)
124-
} ?: firstRowResult
115+
prev()?.let { p -> expression(this, this) - expression(p, p) }
116+
?: firstRowResult
125117

126118
/**
127119
* @include [DiffDocs]
128120
*/
129121
public fun <T> DataRow<T>.diff(firstRowResult: Long, expression: RowExpression<T, Long>): Long =
130-
prev()?.let { p -> expression(this, this) - expression(p, p) } ?: firstRowResult
122+
prev()?.let { p -> expression(this, this) - expression(p, p) }
123+
?: firstRowResult
131124

132125
/**
133126
* @include [DiffDocs]
134127
*/
135128
public fun <T> DataRow<T>.diff(firstRowResult: Float, expression: RowExpression<T, Float>): Float =
136-
prev()?.let { p -> expression(this, this) - expression(p, p) } ?: firstRowResult
129+
prev()?.let { p -> expression(this, this) - expression(p, p) }
130+
?: firstRowResult
137131

138132
/**
139133
* @include [DiffOrNullDocs]
140134
*/
141135
@OptIn(ExperimentalTypeInference::class)
142136
@OverloadResolutionByLambdaReturnType
143137
public fun <T> DataRow<T>.diffOrNull(expression: RowExpression<T, Double>): Double? =
144-
prev()?.let { p ->
145-
expression(
146-
this,
147-
this,
148-
) - expression(p, p)
149-
}
138+
prev()?.let { p -> expression(this, this) - expression(p, p) }
150139

151140
/**
152141
* @include [DiffOrNullDocs]

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/JsonPath.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ public value class JsonPath(
2929
JsonPath(
3030
path.toCharArray().let { chars ->
3131
val lastStarIndex = chars.lastIndexOf('*')
32-
chars
33-
.flatMapIndexed { i, c ->
34-
if (i == lastStarIndex) {
35-
index.toString().toCharArray().toList()
36-
} else {
37-
listOf(c)
38-
}
39-
}.joinToString("")
32+
chars.flatMapIndexed { i, c ->
33+
if (i == lastStarIndex) {
34+
index.toString().toCharArray().toList()
35+
} else {
36+
listOf(c)
37+
}
38+
}.joinToString("")
4039
},
4140
)
4241

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/aggregate.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ public fun <T, R> Pivot<T>.aggregate(separate: Boolean = false, body: Selector<A
2121
@Refine
2222
@Interpretable("Aggregate")
2323
public fun <T, R> Grouped<T>.aggregate(body: AggregateGroupedBody<T, R>): DataFrame<T> =
24-
aggregateGroupBy((this as GroupBy<*, *>).toDataFrame(), {
25-
groups.cast()
26-
}, removeColumns = true, body).cast<T>()
24+
aggregateGroupBy((this as GroupBy<*, *>).toDataFrame(), { groups.cast() }, removeColumns = true, body).cast<T>()

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,17 +1159,16 @@ internal fun SingleColumn<DataRow<*>>.allColsExceptInternal(other: ColumnsResolv
11591159
internal fun <C> SingleColumn<DataRow<C>>.exceptExperimentalInternal(
11601160
other: ColumnsResolver<*>,
11611161
): SingleColumn<DataRow<C>> =
1162-
ensureIsColumnGroup()
1163-
.transformSingle { singleCol ->
1164-
val columnsToExcept = singleCol
1165-
.asColumnGroup()
1166-
.getColumnsWithPaths { other }
1167-
.map { it.changePath(singleCol.path + it.path) }
1162+
ensureIsColumnGroup().transformSingle { singleCol ->
1163+
val columnsToExcept = singleCol
1164+
.asColumnGroup()
1165+
.getColumnsWithPaths { other }
1166+
.map { it.changePath(singleCol.path + it.path) }
11681167

1169-
val newCols = listOf(singleCol).allColumnsExceptKeepingStructure(columnsToExcept)
1168+
val newCols = listOf(singleCol).allColumnsExceptKeepingStructure(columnsToExcept)
11701169

1171-
newCols as List<ColumnWithPath<DataRow<*>>>
1172-
}.singleInternal() as SingleColumn<DataRow<C>>
1170+
newCols as List<ColumnWithPath<DataRow<*>>>
1171+
}.singleInternal() as SingleColumn<DataRow<C>>
11731172

11741173
/**
11751174
* Functions annotated with this annotation are experimental and will be removed or renamed in the future.

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/append.kt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,19 @@ public fun <T> DataFrame<T>.append(vararg values: Any?): DataFrame<T> {
1414
"Invalid number of arguments. Multiple of $ncol is expected, but actual was: ${values.size}"
1515
}
1616
val newRows = values.size / ncol
17-
return columns()
18-
.mapIndexed { colIndex, col ->
19-
val newValues = (0 until newRows).map { values[colIndex + it * ncol] }
20-
col.updateWith(col.values + newValues)
21-
}.toDataFrame()
22-
.cast()
17+
return columns().mapIndexed { colIndex, col ->
18+
val newValues = (0 until newRows).map { values[colIndex + it * ncol] }
19+
col.updateWith(col.values + newValues)
20+
}.toDataFrame().cast()
2321
}
2422

2523
public fun <T> DataFrame<T>.appendNulls(numberOfRows: Int = 1): DataFrame<T> {
2624
require(numberOfRows >= 0)
2725
if (numberOfRows == 0) return this
2826
if (ncol == 0) return DataFrame.empty(nrow + numberOfRows).cast()
29-
return columns()
30-
.map { col ->
31-
col.updateWith(col.values + arrayOfNulls(numberOfRows))
32-
}.toDataFrame()
33-
.cast()
27+
return columns().map { col ->
28+
col.updateWith(col.values + arrayOfNulls(numberOfRows))
29+
}.toDataFrame().cast()
3430
}
3531

3632
// endregion

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,11 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
169169
* @include [ColReferenceDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
170170
*/
171171
public fun <C> SingleColumn<DataRow<*>>.col(col: ColumnAccessor<C>): SingleColumn<C> =
172-
this
173-
.ensureIsColumnGroup()
174-
.transformSingle {
175-
val child = it.getCol(col)
176-
?: throw IllegalStateException("Column '${col.path()}' not found in column group '${it.path}'")
177-
listOf(child)
178-
}.singleImpl()
172+
this.ensureIsColumnGroup().transformSingle {
173+
val child = it.getCol(col)
174+
?: throw IllegalStateException("Column '${col.path()}' not found in column group '${it.path}'")
175+
listOf(child)
176+
}.singleImpl()
179177

180178
/**
181179
* @include [ColReferenceDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
@@ -238,13 +236,11 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
238236
* @include [CommonColDocs.ColumnTypeParam]
239237
*/
240238
public fun <C> SingleColumn<DataRow<*>>.col(name: String): SingleColumn<C> =
241-
this
242-
.ensureIsColumnGroup()
243-
.transformSingle {
244-
val child = it.getCol(name)?.cast<C>()
245-
?: throw IllegalStateException("Column '$name' not found in column group '${it.path}'")
246-
listOf(child)
247-
}.singleImpl()
239+
this.ensureIsColumnGroup().transformSingle {
240+
val child = it.getCol(name)?.cast<C>()
241+
?: throw IllegalStateException("Column '$name' not found in column group '${it.path}'")
242+
listOf(child)
243+
}.singleImpl()
248244

249245
/**
250246
* @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
@@ -340,13 +336,11 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
340336
* @include [CommonColDocs.ColumnTypeParam]
341337
*/
342338
public fun <C> SingleColumn<DataRow<*>>.col(path: ColumnPath): SingleColumn<C> =
343-
this
344-
.ensureIsColumnGroup()
345-
.transformSingle {
346-
val child = it.getCol(path)?.cast<C>()
347-
?: throw IllegalStateException("Column '$path' not found in column group '${it.path}'")
348-
listOf(child)
349-
}.singleImpl()
339+
this.ensureIsColumnGroup().transformSingle {
340+
val child = it.getCol(path)?.cast<C>()
341+
?: throw IllegalStateException("Column '$path' not found in column group '${it.path}'")
342+
listOf(child)
343+
}.singleImpl()
350344

351345
/**
352346
* @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
@@ -512,8 +506,7 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
512506
* @include [CommonColDocs.ColumnTypeParam]
513507
*/
514508
public fun <C> SingleColumn<DataRow<*>>.col(index: Int): SingleColumn<C> =
515-
this
516-
.ensureIsColumnGroup()
509+
this.ensureIsColumnGroup()
517510
.allColumnsInternal()
518511
.getAt(index)
519512
.cast()

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,14 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
170170
* @include [ColGroupReferenceDocs] {@set [CommonColGroupDocs.ReceiverArg] myColumnGroup.}
171171
*/
172172
public fun <C> SingleColumn<DataRow<*>>.colGroup(colGroup: ColumnAccessor<DataRow<C>>): SingleColumn<DataRow<C>> =
173-
this
174-
.ensureIsColumnGroup()
175-
.transformSingle {
176-
val child = it.getCol(colGroup)
177-
?: throw IllegalStateException(
178-
"ColumnGroup '${colGroup.path()}' not found in column group '${it.path}'",
179-
)
180-
child.data.ensureIsColumnGroup()
181-
listOf(child)
182-
}.singleImpl()
173+
this.ensureIsColumnGroup().transformSingle {
174+
val child = it.getCol(colGroup)
175+
?: throw IllegalStateException(
176+
"ColumnGroup '${colGroup.path()}' not found in column group '${it.path}'",
177+
)
178+
child.data.ensureIsColumnGroup()
179+
listOf(child)
180+
}.singleImpl()
183181

184182
/**
185183
* @include [ColGroupReferenceDocs] {@set [CommonColGroupDocs.ReceiverArg] myColumnGroup.}
@@ -242,14 +240,12 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
242240
* @include [CommonColGroupDocs.ColumnGroupTypeParam]
243241
*/
244242
public fun <C> SingleColumn<DataRow<*>>.colGroup(name: String): SingleColumn<DataRow<C>> =
245-
this
246-
.ensureIsColumnGroup()
247-
.transformSingle {
248-
val child = it.getCol(name)?.cast<DataRow<C>>()
249-
?: throw IllegalStateException("Column group '$name' not found in column group '${it.path}'")
250-
child.data.ensureIsColumnGroup()
251-
listOf(child)
252-
}.singleImpl()
243+
this.ensureIsColumnGroup().transformSingle {
244+
val child = it.getCol(name)?.cast<DataRow<C>>()
245+
?: throw IllegalStateException("Column group '$name' not found in column group '${it.path}'")
246+
child.data.ensureIsColumnGroup()
247+
listOf(child)
248+
}.singleImpl()
253249

254250
/**
255251
* @include [ColGroupNameDocs] {@set [CommonColGroupDocs.ReceiverArg] myColumnGroup.}
@@ -344,8 +340,7 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
344340
* @include [CommonColGroupDocs.ColumnGroupTypeParam]
345341
*/
346342
public fun <C> SingleColumn<DataRow<*>>.colGroup(path: ColumnPath): SingleColumn<DataRow<C>> =
347-
this
348-
.ensureIsColumnGroup()
343+
this.ensureIsColumnGroup()
349344
.transformSingle {
350345
val child = it.getCol(path)?.cast<DataRow<C>>()
351346
?: throw IllegalStateException("Column group '$path' not found in column group '${it.path}'")
@@ -563,8 +558,7 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
563558
* @include [CommonColGroupDocs.ColumnGroupTypeParam]
564559
*/
565560
public fun <C> SingleColumn<DataRow<*>>.colGroup(index: Int): SingleColumn<DataRow<C>> =
566-
this
567-
.ensureIsColumnGroup()
561+
this.ensureIsColumnGroup()
568562
.allColumnsInternal()
569563
.getAt(index)
570564
.cast<DataRow<C>>()

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cols.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,14 +1091,13 @@ public interface ColsColumnsSelectionDsl<out _UNUSED> {
10911091
}
10921092

10931093
internal fun SingleColumn<DataRow<*>>.colsInternal(refs: Iterable<ColumnReference<*>>): ColumnSet<*> =
1094-
ensureIsColumnGroup()
1095-
.transformSingle { col ->
1096-
refs.map {
1097-
col.getCol(it) ?: throw IllegalArgumentException(
1098-
"Column at ${col.path.plus(it.path()).joinToString()} was not found.",
1099-
)
1100-
}
1094+
ensureIsColumnGroup().transformSingle { col ->
1095+
refs.map {
1096+
col.getCol(it) ?: throw IllegalArgumentException(
1097+
"Column at ${col.path.plus(it.path()).joinToString()} was not found.",
1098+
)
11011099
}
1100+
}
11021101

11031102
/**
11041103
* If this [ColumnsResolver] is a [SingleColumn], it

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsOfKind.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,6 @@ public interface ColsOfKindColumnsSelectionDsl {
205205
internal fun ColumnsResolver<*>.columnsOfKindInternal(
206206
kinds: Set<ColumnKind>,
207207
filter: ColumnFilter<*>,
208-
): TransformableColumnSet<*> =
209-
colsInternal {
210-
it.kind() in kinds && filter(it)
211-
}
208+
): TransformableColumnSet<*> = colsInternal { it.kind() in kinds && filter(it) }
212209

213210
// endregion

0 commit comments

Comments
 (0)