From 807e4d93194fbf5912c2ca8db251722f3fc5c234 Mon Sep 17 00:00:00 2001 From: Etienne Bacher <52219252+etiennebacher@users.noreply.github.com> Date: Mon, 27 Nov 2023 20:01:09 +0100 Subject: [PATCH] remove deprecated methods --- NEWS.md | 5 +++ R/expr__datetime.R | 50 ----------------------------- R/expr__expr.R | 11 ------- R/functions__lazy.R | 15 --------- man/pl_max.Rd | 3 -- man/pl_min.Rd | 3 -- man/pl_sum.Rd | 3 -- tests/testthat/test-expr_datetime.R | 13 -------- 8 files changed, 5 insertions(+), 98 deletions(-) diff --git a/NEWS.md b/NEWS.md index 7f8ef1f95..9cb5dc2be 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # polars (development version) +## Breaking changes and deprecations + +- Removed `$days()`, `$hours()`, `$minutes()`, `$seconds()`, `$milliseconds()`, + `$microseconds()`, `$nanoseconds()`. Those were deprecated in 0.11.0. + # polars 0.11.0 ## BREAKING CHANGES DUE TO RUST-POLARS UPDATE diff --git a/R/expr__datetime.R b/R/expr__datetime.R index b5b03b2a8..986679dc7 100644 --- a/R/expr__datetime.R +++ b/R/expr__datetime.R @@ -780,14 +780,6 @@ ExprDT_replace_time_zone = function(tz, ambiguous = "raise") { unwrap("in $replace_time_zone():") } - - -duration_total_depr_warning = function(x) { - warning( - paste0("$dt$", x, "() is deprecated and will be removed in 0.12.0. Use $dt$total_", x, "() instead."), - call. = FALSE) -} - #' Days #' @description Extract the days from a Duration type. #' @name ExprDT_total_days @@ -810,12 +802,6 @@ ExprDT_total_days = function() { unwrap("in $dt$total_days():") } -ExprDT_days = function() { - duration_total_depr_warning("days") - .pr$Expr$dt_total_days(self) |> - unwrap("in $dt$days():") -} - #' Hours #' @description Extract the hours from a Duration type. #' @name ExprDT_total_hours @@ -838,12 +824,6 @@ ExprDT_total_hours = function() { unwrap("in $dt$total_hours():") } -ExprDT_hours = function() { - duration_total_depr_warning("hours") - .pr$Expr$dt_total_hours(self) |> - unwrap("in $dt$hours():") -} - #' Minutes #' @description Extract the minutes from a Duration type. #' @name ExprDT_total_minutes @@ -866,12 +846,6 @@ ExprDT_total_minutes = function() { unwrap("in $dt$total_minutes():") } -ExprDT_minutes = function() { - duration_total_depr_warning("minutes") - .pr$Expr$dt_total_minutes(self) |> - unwrap("in $dt$minutes():") -} - #' Seconds #' @description Extract the seconds from a Duration type. #' @name ExprDT_total_seconds @@ -892,12 +866,6 @@ ExprDT_total_seconds = function() { unwrap("in $dt$total_seconds():") } -ExprDT_seconds = function() { - duration_total_depr_warning("seconds") - .pr$Expr$dt_total_seconds(self) |> - unwrap("in $dt$seconds():") -} - #' milliseconds #' @description Extract the milliseconds from a Duration type. #' @name ExprDT_total_milliseconds @@ -918,12 +886,6 @@ ExprDT_total_milliseconds = function() { unwrap("in $dt$total_milliseconds():") } -ExprDT_milliseconds = function() { - duration_total_depr_warning("milliseconds") - .pr$Expr$dt_total_milliseconds(self) |> - unwrap("in $dt$milliseconds():") -} - #' microseconds #' @description Extract the microseconds from a Duration type. #' @name ExprDT_total_microseconds @@ -944,12 +906,6 @@ ExprDT_total_microseconds = function() { unwrap("in $dt$total_microseconds():") } -ExprDT_microseconds = function() { - duration_total_depr_warning("microseconds") - .pr$Expr$dt_total_microseconds(self) |> - unwrap("in $dt$microseconds():") -} - #' nanoseconds #' @description Extract the nanoseconds from a Duration type. #' @name ExprDT_total_nanoseconds @@ -970,12 +926,6 @@ ExprDT_total_nanoseconds = function() { unwrap("in $dt$total_nanoseconds():") } -ExprDT_nanoseconds = function() { - duration_total_depr_warning("nanoseconds") - .pr$Expr$dt_total_nanoseconds(self) |> - unwrap("in $dt$nanoseconds():") -} - #' Offset By #' @description Offset this date by a relative time offset. #' This differs from ``pl$col("foo_datetime_tu") + value_tu`` in that it can diff --git a/R/expr__expr.R b/R/expr__expr.R index 6cd9ab2c4..e5c9a2809 100644 --- a/R/expr__expr.R +++ b/R/expr__expr.R @@ -293,11 +293,6 @@ Expr_not = "use_extendr_wrapper" #' @param x Expr "!.Expr" = function(x) x$not() -Expr_is_not = function() { - warning("`$is_not()` is deprecated and will be removed in 0.12.0. Use `$not()` instead.") - .pr$Expr$not(self) -} - #' Check strictly lower inequality #' #' @inherit Expr_add description params return @@ -1918,12 +1913,6 @@ Expr_is_unique = "use_extendr_wrapper" #' with_columns(is_ufirst = pl$col("mpg")$is_first_distinct()) Expr_is_first_distinct = "use_extendr_wrapper" -Expr_is_first = function() { - warning("`$is_first()` is deprecated and will be removed in 0.12.0. Use `$is_first_distinct()` instead.") - .pr$Expr$is_first_distinct(self) -} - - #' Check whether each value is the last occurrence #' #' @return Expr diff --git a/R/functions__lazy.R b/R/functions__lazy.R index 5bbb86d8c..10dccdddd 100644 --- a/R/functions__lazy.R +++ b/R/functions__lazy.R @@ -463,8 +463,6 @@ pl$approx_n_unique = function(column) { #-> int or Expr #' - list of strings(column names) or expressions to add up as expr1 + expr2 + expr3 + ... #' #' If several args, then wrapped in a list and handled as above. -#' @param verbose Show the deprecation message when several columns or Expr are -#' passed in `...`. Will be removed in 0.12.0. #' #' @return Expr #' @keywords Expr_new @@ -493,9 +491,6 @@ pl$sum = function(..., verbose = TRUE) { return(pl$lit(column)$sum()) } if (is.list(column)) { - if (verbose) { - warning("This usage of `pl$sum()` used to compute the sum rowwise. This is now deprecated, use `pl$sum_horizontal()` instead. This message will be removed in 0.12.0. Set `verbose = FALSE` to remove this message.") - } return(pl$col(column)$sum()) } stop("pl$sum: this input is not supported") @@ -513,8 +508,6 @@ pl$sum = function(..., verbose = TRUE) { #' - numeric, same as `pl$lit(column)$sum()` #' - list of strings(column names) or expressions to add up as expr1 + expr2 + expr3 + ... #' If several args, then wrapped in a list and handled as above. -#' @param verbose Show the deprecation message when several columns or Expr are -#' passed in `...`. Will be removed in 0.12.0. #' #' @return Expr #' @keywords Expr_new @@ -542,9 +535,6 @@ pl$min = function(..., verbose = TRUE) { return(pl$lit(column)$min()) } if (is.list(column)) { - if (verbose) { - warning("This usage of `pl$min()` used to find the minimum value rowwise. This is now deprecated, use `pl$min_horizontal()` instead. This message will be removed in 0.12.0. Set `verbose = FALSE` to remove this message.") - } return(pl$col(column)$min()) } stop("pl$min: this input is not supported") @@ -566,8 +556,6 @@ pl$min = function(..., verbose = TRUE) { #' - list of strings(column names) or expressions to add up as expr1 + expr2 + expr3 + ... #' #' If several args, then wrapped in a list and handled as above. -#' @param verbose Show the deprecation message when several columns or Expr are -#' passed in `...`. Will be removed in 0.12.0. #' #' @return Expr #' @keywords Expr_new @@ -595,9 +583,6 @@ pl$max = function(..., verbose = TRUE) { return(pl$lit(column)$max()) } if (is.list(column)) { - if (verbose) { - warning("This usage of `pl$max()` used to find the maximum value rowwise. This is now deprecated, use `pl$max_horizontal()` instead. This message will be removed in 0.12.0. Set `verbose = FALSE` to remove this message.") - } return(pl$col(column)$max()) } stop("pl$max: this input is not supported") diff --git a/man/pl_max.Rd b/man/pl_max.Rd index 0ef0ebd7f..ea6fc5980 100644 --- a/man/pl_max.Rd +++ b/man/pl_max.Rd @@ -14,9 +14,6 @@ If one arg: } If several args, then wrapped in a list and handled as above.} - -\item{verbose}{Show the deprecation message when several columns or Expr are -passed in \code{...}. Will be removed in 0.12.0.} } \value{ Expr diff --git a/man/pl_min.Rd b/man/pl_min.Rd index b7393666a..5e25f8eef 100644 --- a/man/pl_min.Rd +++ b/man/pl_min.Rd @@ -13,9 +13,6 @@ If one arg: \item list of strings(column names) or expressions to add up as expr1 + expr2 + expr3 + ... If several args, then wrapped in a list and handled as above. }} - -\item{verbose}{Show the deprecation message when several columns or Expr are -passed in \code{...}. Will be removed in 0.12.0.} } \value{ Expr diff --git a/man/pl_sum.Rd b/man/pl_sum.Rd index 157712cdc..a20833264 100644 --- a/man/pl_sum.Rd +++ b/man/pl_sum.Rd @@ -14,9 +14,6 @@ If one arg: } If several args, then wrapped in a list and handled as above.} - -\item{verbose}{Show the deprecation message when several columns or Expr are -passed in \code{...}. Will be removed in 0.12.0.} } \value{ Expr diff --git a/tests/testthat/test-expr_datetime.R b/tests/testthat/test-expr_datetime.R index 4d06d8615..921574c9a 100644 --- a/tests/testthat/test-expr_datetime.R +++ b/tests/testthat/test-expr_datetime.R @@ -832,19 +832,6 @@ test_that("dt$days, dt$hours, dt$mminutes, dt$seconds, + ms, us, ns", { expect_identical(df$diff, bit64::as.integer64(c(NA, diffy2(df$date, "secs")) * 1E9)) }) -# TODO: remove when preparing 0.12.0 -test_that("$dt$days() and friends deprecation warning", { - expect_warning( - pl$DataFrame(date = pl$date_range( - start = as.Date("2020-3-1"), end = as.Date("2020-5-1"), interval = "1mo" - ))$select( - pl$col("date")$diff()$dt$days() - ), - "is deprecated and will be removed in 0.12.0." - ) -}) - - test_that("$dt$time()", { df = pl$DataFrame( dates = pl$date_range(