-
Notifications
You must be signed in to change notification settings - Fork 73
Add @CandidateForRemoval annotation #1032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -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 | ||
|
@@ -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>() | ||
|
@@ -166,12 +169,16 @@ public fun AnyRow.columnNames(): List<String> = df().columnNames() | |
|
||
public fun AnyRow.columnTypes(): List<KType> = df().columnTypes() | ||
|
||
@CandidateForRemoval | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these ones should just be documented and better tested. It's in the same family of functions as |
||
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 | ||
|
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be moved to internal maybe? it's used at least once