Skip to content

Commit

Permalink
colGroup except can no longer be infix to reduce confusion about scope.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Feb 11, 2025
1 parent 2a215af commit 5632878
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.changePath
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnSet
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.ALL_COLS_EXCEPT_REPLACE
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_EXCEPT_REPLACE_VARARG
import org.jetbrains.kotlinx.dataframe.util.EXCEPT_REPLACE
import org.jetbrains.kotlinx.dataframe.util.EXCEPT_REPLACE_VARARG
import kotlin.reflect.KProperty

// region ColumnsSelectionDsl
Expand Down Expand Up @@ -473,15 +475,15 @@ public interface AllExceptColumnsSelectionDsl {

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun SingleColumn<DataRow<*>>.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> =
allColsExcept { other }

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun SingleColumn<DataRow<*>>.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> =
Expand Down Expand Up @@ -535,20 +537,20 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun <C> SingleColumn<DataRow<C>>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
public fun <C> SingleColumn<DataRow<C>>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
exceptInternal(selector.toColumns())

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { other }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public infix fun <C> SingleColumn<DataRow<C>>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
public fun <C> SingleColumn<DataRow<C>>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
except { other }

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun <C> SingleColumn<DataRow<C>>.except(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
Expand All @@ -557,7 +559,7 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun <C> SingleColumn<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
public fun <C> SingleColumn<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
exceptInternal(column<Any?>(other))

/**
Expand All @@ -570,7 +572,7 @@ public interface AllExceptColumnsSelectionDsl {
* @include [ExperimentalExceptDocs]
*/
@AccessApiOverload
public infix fun <C> SingleColumn<DataRow<C>>.except(other: KProperty<C>): SingleColumn<DataRow<C>> =
public fun <C> SingleColumn<DataRow<C>>.except(other: KProperty<C>): SingleColumn<DataRow<C>> =
exceptInternal(column(other))

/**
Expand All @@ -583,7 +585,7 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun <C> SingleColumn<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
public fun <C> SingleColumn<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
exceptInternal(column<Any?>(other))

/**
Expand All @@ -595,20 +597,20 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun String.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
public fun String.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
columnGroup(this).except(selector)

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { other }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public infix fun String.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
public fun String.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
except { other }

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun String.except(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
Expand All @@ -617,7 +619,7 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun String.except(other: String): SingleColumn<DataRow<*>> =
public fun String.except(other: String): SingleColumn<DataRow<*>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -630,7 +632,7 @@ public interface AllExceptColumnsSelectionDsl {
* @include [ExperimentalExceptDocs]
*/
@AccessApiOverload
public infix fun String.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
public fun String.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptInternal(column(other))

/**
Expand All @@ -643,7 +645,7 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun String.except(other: ColumnPath): SingleColumn<DataRow<*>> =
public fun String.except(other: ColumnPath): SingleColumn<DataRow<*>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -656,21 +658,21 @@ public interface AllExceptColumnsSelectionDsl {
* @include [ExperimentalExceptDocs]
*/
@AccessApiOverload
public infix fun <C> KProperty<C>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
public fun <C> KProperty<C>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptInternal(selector.toColumns())

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { other }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
@AccessApiOverload
public infix fun KProperty<*>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
public fun KProperty<*>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
except { other }

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
@AccessApiOverload
Expand All @@ -681,7 +683,7 @@ public interface AllExceptColumnsSelectionDsl {
* @include [ExperimentalExceptDocs]
*/
@AccessApiOverload
public infix fun <C> KProperty<C>.except(other: String): SingleColumn<DataRow<C>> =
public fun <C> KProperty<C>.except(other: String): SingleColumn<DataRow<C>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -697,7 +699,7 @@ public interface AllExceptColumnsSelectionDsl {
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
@AccessApiOverload
public infix fun <C> KProperty<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
public fun <C> KProperty<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -713,7 +715,7 @@ public interface AllExceptColumnsSelectionDsl {
* @include [ExperimentalExceptDocs]
*/
@AccessApiOverload
public infix fun <C> KProperty<C>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
public fun <C> KProperty<C>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptInternal(column(other))

/**
Expand All @@ -729,7 +731,7 @@ public interface AllExceptColumnsSelectionDsl {
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
@AccessApiOverload
public infix fun <C> KProperty<DataRow<C>>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
public fun <C> KProperty<DataRow<C>>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptInternal(column(other))

/**
Expand All @@ -745,7 +747,7 @@ public interface AllExceptColumnsSelectionDsl {
* @include [ExperimentalExceptDocs]
*/
@AccessApiOverload
public infix fun <C> KProperty<C>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
public fun <C> KProperty<C>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -761,7 +763,7 @@ public interface AllExceptColumnsSelectionDsl {
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
@AccessApiOverload
public infix fun <C> KProperty<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
public fun <C> KProperty<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -776,20 +778,20 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun ColumnPath.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
public fun ColumnPath.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptInternal(selector.toColumns<Any?, Any?>())

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { other }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public infix fun ColumnPath.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
public fun ColumnPath.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
except { other }

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun ColumnPath.except(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
Expand All @@ -798,7 +800,7 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun ColumnPath.except(other: String): SingleColumn<DataRow<*>> =
public fun ColumnPath.except(other: String): SingleColumn<DataRow<*>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -811,7 +813,7 @@ public interface AllExceptColumnsSelectionDsl {
* @include [ExperimentalExceptDocs]
*/
@AccessApiOverload
public infix fun ColumnPath.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
public fun ColumnPath.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptInternal(column(other))

@AccessApiOverload
Expand All @@ -821,7 +823,7 @@ public interface AllExceptColumnsSelectionDsl {
/**
* @include [ExperimentalExceptDocs]
*/
public infix fun ColumnPath.except(other: ColumnPath): SingleColumn<DataRow<*>> =
public fun ColumnPath.except(other: ColumnPath): SingleColumn<DataRow<*>> =
columnGroup(this).exceptInternal(column<Any?>(other))

/**
Expand All @@ -845,15 +847,15 @@ public interface AllExceptColumnsSelectionDsl {

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun String.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> =
allColsExcept { other }

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun String.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> =
Expand Down Expand Up @@ -899,7 +901,7 @@ public interface AllExceptColumnsSelectionDsl {

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
@AccessApiOverload
Expand All @@ -908,7 +910,7 @@ public interface AllExceptColumnsSelectionDsl {

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
@AccessApiOverload
Expand Down Expand Up @@ -956,15 +958,15 @@ public interface AllExceptColumnsSelectionDsl {

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun ColumnPath.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> =
allColsExcept { other }

@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun ColumnPath.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ internal const val COL_REPLACE = "col"

internal const val ALL_COLS_EXCEPT =
"This overload is blocked to prevent issues with column accessors. Use the `{}` overload instead."
internal const val ALL_COLS_REPLACE = "allColsExcept { other }"
internal const val ALL_COLS_REPLACE_VARARG = "allColsExcept { others.toColumnSet() }"

internal const val ALL_COLS_EXCEPT_REPLACE = "this.allColsExcept { other }"
internal const val ALL_COLS_EXCEPT_REPLACE_VARARG = "this.allColsExcept { others.toColumnSet() }"
internal const val EXCEPT_REPLACE = "this.except { other }"
internal const val EXCEPT_REPLACE_VARARG = "this.except { others.toColumnSet() }"
// endregion
Loading

0 comments on commit 5632878

Please sign in to comment.