Skip to content

Post 0.15 deprecations update #1033

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

Merged
merged 4 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions core/api/core.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public interface DataColumn<out T> : BaseColumn<T> {
@Deprecated(
message = CREATE_FRAME_COLUMN,
replaceWith = ReplaceWith(CREATE_FRAME_COLUMN_REPLACE, CHUNKED_IMPL_IMPORT),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun <T> createFrameColumn(name: String, df: DataFrame<T>, startIndices: Iterable<Int>): FrameColumn<T> =
df.chunkedImpl(startIndices = startIndices, name = name)
Expand All @@ -236,7 +236,7 @@ public interface DataColumn<out T> : BaseColumn<T> {
CREATE_BY_INFERENCE_IMPORT,
TYPE_SUGGESTION_IMPORT,
),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun <T> createWithTypeInference(
name: String,
Expand All @@ -253,7 +253,7 @@ public interface DataColumn<out T> : BaseColumn<T> {
@Deprecated(
message = CREATE,
replaceWith = ReplaceWith(CREATE_REPLACE, CREATE_BY_TYPE_IMPORT),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun <T> create(
name: String,
Expand All @@ -271,7 +271,7 @@ public interface DataColumn<out T> : BaseColumn<T> {
@Deprecated(
message = CREATE,
replaceWith = ReplaceWith(CREATE_INLINE_REPLACE, CREATE_BY_TYPE_IMPORT),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public inline fun <reified T> create(name: String, values: List<T>, infer: Infer = Infer.None): DataColumn<T> =
createByType(name = name, values = values, type = typeOf<T>(), infer = infer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public fun AnyCol.isList(): Boolean = typeClass == List::class
@Deprecated(
message = IS_COMPARABLE,
replaceWith = ReplaceWith(IS_COMPARABLE_REPLACE, IS_INTER_COMPARABLE_IMPORT),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun AnyCol.isComparable(): Boolean = valuesAreComparable()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ import org.jetbrains.kotlinx.dataframe.documentation.ExcludeFromSources
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.COL_ENDS_WITH
import org.jetbrains.kotlinx.dataframe.util.COL_ENDS_WITH_REPLACE
import org.jetbrains.kotlinx.dataframe.util.COL_STARTS_WITH
import org.jetbrains.kotlinx.dataframe.util.COL_STARTS_WITH_REPLACE
import org.jetbrains.kotlinx.dataframe.util.ENDS_WITH
import org.jetbrains.kotlinx.dataframe.util.ENDS_WITH_REPLACE
import org.jetbrains.kotlinx.dataframe.util.STARTS_WITH
import org.jetbrains.kotlinx.dataframe.util.STARTS_WITH_REPLACE
import kotlin.reflect.KProperty

// region ColumnsSelectionDsl
Expand Down Expand Up @@ -501,57 +493,6 @@ public interface ColumnNameFiltersColumnsSelectionDsl {
): TransformableColumnSet<*> = columnGroup(this).colsNameEndsWith(suffix, ignoreCase)

// endregion

// region deprecations

@Deprecated(
message = STARTS_WITH,
replaceWith = ReplaceWith(STARTS_WITH_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun <C> ColumnSet<C>.startsWith(prefix: CharSequence): TransformableColumnSet<C> = nameStartsWith(prefix)

@Deprecated(
message = STARTS_WITH,
replaceWith = ReplaceWith(STARTS_WITH_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun ColumnsSelectionDsl<*>.startsWith(prefix: CharSequence): TransformableColumnSet<*> =
nameStartsWith(prefix)

@Deprecated(
message = COL_STARTS_WITH,
replaceWith = ReplaceWith(COL_STARTS_WITH_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.startsWith(prefix: CharSequence): TransformableColumnSet<*> =
colsNameStartsWith(prefix)

@Deprecated(
message = ENDS_WITH,
replaceWith = ReplaceWith(ENDS_WITH_REPLACE),
level = DeprecationLevel.ERROR,
)
@Suppress("UNCHECKED_CAST")
public fun <C> ColumnSet<C>.endsWith(suffix: CharSequence): TransformableColumnSet<C> =
colsInternal { it.name.endsWith(suffix) } as TransformableColumnSet<C>

@Deprecated(
message = ENDS_WITH,
replaceWith = ReplaceWith(ENDS_WITH_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun ColumnsSelectionDsl<*>.endsWith(suffix: CharSequence): TransformableColumnSet<*> = nameEndsWith(suffix)

@Deprecated(
message = COL_ENDS_WITH,
replaceWith = ReplaceWith(COL_ENDS_WITH_REPLACE),
level = DeprecationLevel.ERROR,
)
public fun SingleColumn<DataRow<*>>.endsWith(suffix: CharSequence): TransformableColumnSet<*> =
this.ensureIsColumnGroup().colsInternal { it.name.endsWith(suffix) }

// endregion
}

// endregion
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public fun <T> List<List<T>>.toDataFrame(containsColumns: Boolean = false): AnyF
@Deprecated(
message = IS_URL,
replaceWith = ReplaceWith(IS_URL_REPLACE, IS_URL_IMPORT),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun isURL(path: String): Boolean = isUrl(path)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public fun DataFrame.Companion.readDelimStr(
@Deprecated(
message = DF_READ_NO_CSV,
replaceWith = ReplaceWith(DF_READ_NO_CSV_REPLACE),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun DataFrame.Companion.read(
fileOrUrl: String,
Expand Down Expand Up @@ -248,7 +248,7 @@ private fun getCSVType(path: String): CSVType =
@Deprecated(
message = AS_URL,
replaceWith = ReplaceWith(AS_URL_REPLACE, AS_URL_IMPORT),
level = DeprecationLevel.WARNING,
level = DeprecationLevel.ERROR,
)
public fun asURL(fileOrUrl: String): URL = asUrl(fileOrUrl)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@ package org.jetbrains.kotlinx.dataframe.util
* Level.ERROR -> Remove
*/

// region WARNING in 0.14, ERROR in 0.15

private const val MESSAGE_0_15 = "Will be ERROR in 0.15."

internal const val STARTS_WITH = "Use nameStartsWith() instead. $MESSAGE_0_15"
internal const val STARTS_WITH_REPLACE = "this.nameStartsWith(prefix)"

internal const val COL_STARTS_WITH = "Use colsNameStartsWith() instead. $MESSAGE_0_15"
internal const val COL_STARTS_WITH_REPLACE = "this.colsNameStartsWith(prefix)"

internal const val ENDS_WITH = "Use nameEndsWith() instead. $MESSAGE_0_15"
internal const val ENDS_WITH_REPLACE = "this.nameEndsWith(suffix)"

internal const val COL_ENDS_WITH = "Use colsNameEndsWith() instead. $MESSAGE_0_15"
internal const val COL_ENDS_WITH_REPLACE = "this.colsNameEndsWith(suffix)"

// region WARNING in 0.15, ERROR in 0.16

private const val MESSAGE_0_16 = "Will be ERROR in 0.16."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fun SimpleFeatureCollection.toGeoDataFrame(): GeoDataFrame<*> {
}
}

val geometryColumn = DataColumn.create("geometry", geometries, Infer.Type)
val geometryColumn = DataColumn.createByType("geometry", geometries, Infer.Type)

@Suppress("UNCHECKED_CAST")
return GeoDataFrame((data.toDataFrame() + geometryColumn) as DataFrame<WithGeometry>, crs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import org.geotools.geojson.feature.FeatureJSON
import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.geo.GeoDataFrame
import org.jetbrains.kotlinx.dataframe.geo.geotools.toGeoDataFrame
import org.jetbrains.kotlinx.dataframe.io.asURL
import org.jetbrains.kotlinx.dataframe.io.asUrl
import java.net.URL

fun GeoDataFrame.Companion.readGeoJson(path: String): GeoDataFrame<*> = readGeoJson(asURL(path))
fun GeoDataFrame.Companion.readGeoJson(path: String): GeoDataFrame<*> = readGeoJson(asUrl(path))

fun GeoDataFrame.Companion.readGeoJson(url: URL): GeoDataFrame<*> =
url.openStream().use { inputStream ->
Expand All @@ -21,7 +21,7 @@ fun DataFrame.Companion.readGeoJson(path: String): GeoDataFrame<*> = GeoDataFram

fun DataFrame.Companion.readGeoJson(url: URL): GeoDataFrame<*> = GeoDataFrame.readGeoJson(url)

fun GeoDataFrame.Companion.readShapefile(path: String): GeoDataFrame<*> = readShapefile(asURL(path))
fun GeoDataFrame.Companion.readShapefile(path: String): GeoDataFrame<*> = readShapefile(asUrl(path))

fun GeoDataFrame.Companion.readShapefile(url: URL): GeoDataFrame<*> {
val dataStore = ShapefileDataStoreFactory().createDataStore(url)
Expand Down
Loading