Skip to content

Commit

Permalink
updating deprecations post 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Sep 23, 2024
1 parent 45ef5d1 commit dfb46f1
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 510 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.jetbrains.kotlinx.dataframe.api

import org.jetbrains.kotlinx.dataframe.ColumnsSelector
import org.jetbrains.kotlinx.dataframe.DataColumn
import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.DataRow
import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar.ColumnGroupPartOfGrammar
import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar.ColumnSetPartOfGrammar
import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar.DefinitionsPartOfGrammar
import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar.PlainDslPartOfGrammar
import org.jetbrains.kotlinx.dataframe.columns.ColumnPath
import org.jetbrains.kotlinx.dataframe.columns.ColumnSet
import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver
Expand All @@ -16,9 +19,6 @@ import org.jetbrains.kotlinx.dataframe.documentation.Indent
import org.jetbrains.kotlinx.dataframe.documentation.LineBreak
import org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns
import org.jetbrains.kotlinx.dataframe.impl.DataFrameReceiver
import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnsList
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_LIST_DATACOLUMN_GET
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_LIST_DATACOLUMN_GET_REPLACE
import kotlin.reflect.KProperty

/** [Columns Selection DSL][ColumnsSelectionDsl] */
Expand Down Expand Up @@ -380,22 +380,6 @@ public interface ColumnsSelectionDsl<out T> : // SingleColumn<DataRow<T>>
public operator fun <C> ColumnsSelector<T, C>.invoke(): ColumnsResolver<C> =
this@invoke(this@ColumnsSelectionDsl, this@ColumnsSelectionDsl)

/**
* ## Deprecated: Columns by Index Range from List of Columns
* Helper function to create a [ColumnSet] from a list of columns by specifying a range of indices.
*
* ### Deprecated
*
* Deprecated because it's too niche. Let us know if you have a good use for it!
*/
@Deprecated(
message = COL_SELECT_DSL_LIST_DATACOLUMN_GET,
replaceWith = ReplaceWith(COL_SELECT_DSL_LIST_DATACOLUMN_GET_REPLACE),
level = DeprecationLevel.ERROR,
)
public operator fun <C> List<DataColumn<C>>.get(range: IntRange): ColumnSet<C> =
ColumnsList(subList(range.first, range.last + 1))

// region select
// NOTE: due to invoke conflicts these cannot be moved out of the interface

Expand Down
134 changes: 0 additions & 134 deletions core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/all.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.addPath
import org.jetbrains.kotlinx.dataframe.impl.columns.onResolve
import org.jetbrains.kotlinx.dataframe.impl.columns.transform
import org.jetbrains.kotlinx.dataframe.impl.owner
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_AFTER
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_AFTER_REPLACE
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_BEFORE
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_BEFORE_REPLACE
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_FROM
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_FROM_REPLACE
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_REPLACE
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_UP_TO
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_COLS_UP_TO_REPLACE
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_FROM
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_FROM_REPLACE
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_UP_TO
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_ALL_UP_TO_REPLACE
import kotlin.reflect.KProperty

// region DataColumn
Expand Down Expand Up @@ -1187,126 +1173,6 @@ public interface AllColumnsSelectionDsl<out _UNUSED> {
public fun ColumnPath.allColsUpTo(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsUpTo(column)

// endregion

// region deprecated

@Deprecated(
COL_SELECT_DSL_ALL_COLS,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.all(): TransformableColumnSet<*> = allCols()

@Deprecated(
COL_SELECT_DSL_ALL_COLS,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun String.all(): TransformableColumnSet<*> = allCols()

@Deprecated(
COL_SELECT_DSL_ALL_COLS_AFTER,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_AFTER_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allAfter(column: ColumnPath): ColumnSet<*> = allColsAfter(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_AFTER,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_AFTER_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allAfter(column: String): ColumnSet<*> = allColsAfter(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_AFTER,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_AFTER_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allAfter(column: AnyColumnReference): ColumnSet<*> = allColsAfter(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_BEFORE,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_BEFORE_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allBefore(column: ColumnPath): ColumnSet<*> = allColsBefore(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_BEFORE,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_BEFORE_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allBefore(column: String): ColumnSet<*> = allColsBefore(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_BEFORE,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_BEFORE_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allBefore(column: AnyColumnReference): ColumnSet<*> = allColsBefore(column)

@Deprecated(COL_SELECT_DSL_ALL_FROM, ReplaceWith(COL_SELECT_DSL_ALL_FROM_REPLACE), level = DeprecationLevel.ERROR)
public fun ColumnsSelectionDsl<*>.allSince(column: ColumnPath): ColumnSet<*> = allFrom(column)

@Deprecated(COL_SELECT_DSL_ALL_FROM, ReplaceWith(COL_SELECT_DSL_ALL_FROM_REPLACE), level = DeprecationLevel.ERROR)
public fun ColumnsSelectionDsl<*>.allSince(column: String): ColumnSet<*> = allFrom(column)

@Deprecated(COL_SELECT_DSL_ALL_FROM, ReplaceWith(COL_SELECT_DSL_ALL_FROM_REPLACE), level = DeprecationLevel.ERROR)
public fun ColumnsSelectionDsl<*>.allSince(column: AnyColumnReference): ColumnSet<*> = allFrom(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_FROM,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_FROM_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allSince(column: ColumnPath): ColumnSet<*> = allColsFrom(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_FROM,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_FROM_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allSince(column: String): ColumnSet<*> = allColsFrom(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_FROM,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_FROM_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allSince(column: AnyColumnReference): ColumnSet<*> = allColsFrom(column)

@Deprecated(COL_SELECT_DSL_ALL_UP_TO, ReplaceWith(COL_SELECT_DSL_ALL_UP_TO_REPLACE), level = DeprecationLevel.ERROR)
public fun ColumnsSelectionDsl<*>.allUntil(column: ColumnPath): ColumnSet<*> = allUpTo(column)

@Deprecated(COL_SELECT_DSL_ALL_UP_TO, ReplaceWith(COL_SELECT_DSL_ALL_UP_TO_REPLACE), level = DeprecationLevel.ERROR)
public fun ColumnsSelectionDsl<*>.allUntil(column: String): ColumnSet<*> = allUpTo(column)

@Deprecated(COL_SELECT_DSL_ALL_UP_TO, ReplaceWith(COL_SELECT_DSL_ALL_UP_TO_REPLACE), level = DeprecationLevel.ERROR)
public fun ColumnsSelectionDsl<*>.allUntil(column: AnyColumnReference): ColumnSet<*> = allUpTo(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_UP_TO,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_UP_TO_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allUntil(column: ColumnPath): ColumnSet<*> = allColsUpTo(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_UP_TO,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_UP_TO_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allUntil(column: String): ColumnSet<*> = allColsUpTo(column)

@Deprecated(
COL_SELECT_DSL_ALL_COLS_UP_TO,
ReplaceWith(COL_SELECT_DSL_ALL_COLS_UP_TO_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.allUntil(column: AnyColumnReference): ColumnSet<*> = allColsUpTo(column)

// endregion
}

/**
Expand Down
113 changes: 0 additions & 113 deletions core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_EXCEPT
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE_VARARG
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_EXCEPT
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_EXCEPT_REPLACE_RESOLVER
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_EXCEPT_REPLACE_SELECTOR
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_SINGLE_COL_EXCEPT
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHER
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHERS
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_RESOLVER
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_RESOLVERS
import org.jetbrains.kotlinx.dataframe.util.COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_SELECTOR
import kotlin.reflect.KProperty

// region ColumnsSelectionDsl
Expand Down Expand Up @@ -1017,110 +1008,6 @@ public interface AllExceptColumnsSelectionDsl {
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

// endregion

// region deprecated

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_SELECTOR),
level = DeprecationLevel.ERROR,
)
public infix fun <C> SingleColumn<DataRow<C>>.except(selector: ColumnsSelector<C, *>): ColumnSet<*> =
allColsExcept(selector)

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_RESOLVER),
level = DeprecationLevel.ERROR,
)
public infix fun SingleColumn<DataRow<*>>.except(other: ColumnsResolver<*>): ColumnSet<*> = allColsExcept { other }

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_RESOLVERS),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.except(vararg others: ColumnsResolver<*>): ColumnSet<*> =
allColsExcept { others.toColumnSet() }

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHER),
level = DeprecationLevel.ERROR,
)
public infix fun SingleColumn<DataRow<*>>.except(other: String): ColumnSet<*> = allColsExcept(other)

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHERS),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.except(vararg others: String): ColumnSet<*> = allColsExcept(*others)

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHER),
level = DeprecationLevel.ERROR,
)
public infix fun SingleColumn<DataRow<*>>.except(other: KProperty<*>): ColumnSet<*> = allColsExcept(other)

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHERS),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.except(vararg others: KProperty<*>): ColumnSet<*> = allColsExcept(*others)

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHER),
level = DeprecationLevel.ERROR,
)
public infix fun SingleColumn<DataRow<*>>.except(other: ColumnPath): ColumnSet<*> = allColsExcept(other)

@Deprecated(
message = COL_SELECT_DSL_SINGLE_COL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHERS),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.except(vararg others: ColumnPath): ColumnSet<*> = allColsExcept(*others)

@Deprecated(
message = COL_SELECT_DSL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_EXCEPT_REPLACE_SELECTOR),
level = DeprecationLevel.ERROR,
)
public fun <C> ColumnsSelectionDsl<C>.except(selector: ColumnsSelector<C, *>): ColumnSet<*> = allExcept(selector)

@Deprecated(
message = COL_SELECT_DSL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_EXCEPT_REPLACE_RESOLVER),
level = DeprecationLevel.ERROR,
)
public fun ColumnsSelectionDsl<*>.except(vararg others: ColumnsResolver<*>): ColumnSet<*> = allExcept(*others)

@Deprecated(
message = COL_SELECT_DSL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_EXCEPT_REPLACE_RESOLVER),
level = DeprecationLevel.ERROR,
)
public fun ColumnsSelectionDsl<*>.except(vararg others: String): ColumnSet<*> = allExcept(*others)

@Deprecated(
message = COL_SELECT_DSL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_EXCEPT_REPLACE_RESOLVER),
level = DeprecationLevel.ERROR,
)
public fun ColumnsSelectionDsl<*>.except(vararg others: KProperty<*>): ColumnSet<*> = allExcept(*others)

@Deprecated(
message = COL_SELECT_DSL_EXCEPT,
replaceWith = ReplaceWith(COL_SELECT_DSL_EXCEPT_REPLACE_RESOLVER),
level = DeprecationLevel.ERROR,
)
public fun ColumnsSelectionDsl<*>.except(vararg others: ColumnPath): ColumnSet<*> = allExcept(*others)

// endregion
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSe
import org.jetbrains.kotlinx.dataframe.documentation.Indent
import org.jetbrains.kotlinx.dataframe.documentation.LineBreak
import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet
import org.jetbrains.kotlinx.dataframe.util.COLS_SELECT_DSL_GROUP
import org.jetbrains.kotlinx.dataframe.util.COLS_SELECT_DSL_GROUP_REPLACE
import kotlin.reflect.KProperty

// region ColumnsSelectionDsl
Expand Down Expand Up @@ -171,36 +169,6 @@ public interface ColGroupsColumnsSelectionDsl {
*/
public fun ColumnPath.colGroups(filter: Predicate<ColumnGroup<*>> = { true }): TransformableColumnSet<AnyRow> =
columnGroup(this).colGroups(filter)

// region deprecated

@Deprecated(COLS_SELECT_DSL_GROUP, ReplaceWith(COLS_SELECT_DSL_GROUP_REPLACE), DeprecationLevel.ERROR)
public fun ColumnSet<*>.groups(filter: Predicate<ColumnGroup<*>> = { true }): TransformableColumnSet<AnyRow> =
columnGroupsInternal(filter)

@Deprecated(COLS_SELECT_DSL_GROUP, ReplaceWith(COLS_SELECT_DSL_GROUP_REPLACE), DeprecationLevel.ERROR)
public fun SingleColumn<DataRow<*>>.groups(
filter: Predicate<ColumnGroup<*>> = { true },
): TransformableColumnSet<AnyRow> = this.ensureIsColumnGroup().columnGroupsInternal(filter)

@Deprecated(COLS_SELECT_DSL_GROUP, ReplaceWith(COLS_SELECT_DSL_GROUP_REPLACE), DeprecationLevel.ERROR)
public fun ColumnsSelectionDsl<*>.groups(
filter: Predicate<ColumnGroup<*>> = { true },
): TransformableColumnSet<AnyRow> = this.asSingleColumn().columnGroupsInternal(filter)

@Deprecated(COLS_SELECT_DSL_GROUP, ReplaceWith(COLS_SELECT_DSL_GROUP_REPLACE), DeprecationLevel.ERROR)
public fun String.groups(filter: Predicate<ColumnGroup<*>> = { true }): TransformableColumnSet<AnyRow> =
columnGroup(this).colGroups(filter)

@Deprecated(COLS_SELECT_DSL_GROUP, ReplaceWith(COLS_SELECT_DSL_GROUP_REPLACE), DeprecationLevel.ERROR)
public fun KProperty<*>.groups(filter: Predicate<ColumnGroup<*>> = { true }): TransformableColumnSet<AnyRow> =
columnGroup(this).colGroups(filter)

@Deprecated(COLS_SELECT_DSL_GROUP, ReplaceWith(COLS_SELECT_DSL_GROUP_REPLACE), DeprecationLevel.ERROR)
public fun ColumnPath.groups(filter: Predicate<ColumnGroup<*>> = { true }): TransformableColumnSet<AnyRow> =
columnGroup(this).colGroups(filter)

// endregion
}

/**
Expand Down
Loading

0 comments on commit dfb46f1

Please sign in to comment.