Skip to content

Commit

Permalink
Automated commit of generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 29, 2025
1 parent a9e70da commit 651cbae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.jetbrains.kotlinx.dataframe.annotations

/**
* Functions that can be replaced with other API, such as shortcuts without clean value,
* or something not properly designed, and so will be considered to be removed from API.
* If you see a function marked with it and think it should be kept, please let us know in the GitHub issue:
* https://github.com/Kotlin/dataframe/issues/1028
*/
internal annotation class CandidateForRemoval
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.DataRow
import org.jetbrains.kotlinx.dataframe.RowExpression
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
import org.jetbrains.kotlinx.dataframe.impl.columnName
Expand All @@ -20,8 +21,10 @@ import kotlin.experimental.ExperimentalTypeInference
import kotlin.reflect.KProperty
import kotlin.reflect.KType

@CandidateForRemoval
public fun AnyRow.isEmpty(): Boolean = owner.columns().all { it[index] == null }

@CandidateForRemoval
public fun AnyRow.isNotEmpty(): Boolean = !isEmpty()

public inline fun <reified R> AnyRow.valuesOf(): List<R> = values().filterIsInstance<R>()
Expand Down Expand Up @@ -184,12 +187,16 @@ public fun AnyRow.columnNames(): List<String> = df().columnNames()

public fun AnyRow.columnTypes(): List<KType> = df().columnTypes()

@CandidateForRemoval
public fun <T> DataRow<T>.getRow(index: Int): DataRow<T> = getRowOrNull(index)!!

@CandidateForRemoval
public fun <T> DataRow<T>.getRows(indices: Iterable<Int>): DataFrame<T> = df().getRows(indices)

@CandidateForRemoval
public fun <T> DataRow<T>.getRows(indices: IntRange): DataFrame<T> = df().getRows(indices)

@CandidateForRemoval
public fun <T> DataRow<T>.getRowOrNull(index: Int): DataRow<T>? {
val df = df()
return if (index >= 0 && index < df.nrow) df[index] else null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.jetbrains.kotlinx.dataframe.api

import org.jetbrains.kotlinx.dataframe.DataFrame

import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
// region DataFrame

@CandidateForRemoval
public fun <T> DataFrame<T>.copy(): DataFrame<T> = columns().toDataFrame().cast()

// endregion

0 comments on commit 651cbae

Please sign in to comment.