Skip to content

Commit

Permalink
Remove deprecated methods (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher authored Nov 28, 2023
1 parent 1949248 commit 4e3da60
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 98 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- `$apply()` on an Expr or a Series is renamed `$map_elements()`, and `$map()`
is renamed `$map_batches()`. `$map()` and `$apply()` will be removed in 0.13.0 (#534).
- Removed `$days()`, `$hours()`, `$minutes()`, `$seconds()`, `$milliseconds()`,
`$microseconds()`, `$nanoseconds()`. Those were deprecated in 0.11.0 (#550).

## What's changed

Expand Down
50 changes: 0 additions & 50 deletions R/expr__datetime.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
11 changes: 0 additions & 11 deletions R/expr__expr.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1950,12 +1945,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
Expand Down
15 changes: 0 additions & 15 deletions R/functions__lazy.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down
3 changes: 0 additions & 3 deletions man/pl_max.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions man/pl_min.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions man/pl_sum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions tests/testthat/test-expr_datetime.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4e3da60

Please sign in to comment.