Skip to content

Commit ccaff4b

Browse files
committed
Modify a few more conditions + require rlang 1.2.0 as they started exporting the functions used.
1 parent 79fb379 commit ccaff4b

6 files changed

Lines changed: 15 additions & 23 deletions

File tree

r/DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Imports:
3939
methods,
4040
purrr,
4141
R6,
42-
rlang (>= 1.0.0),
42+
rlang (>= 1.2.0),
4343
stats,
4444
tidyselect (>= 1.0.0),
4545
utils,

r/R/csv.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -635,18 +635,18 @@ readr_to_csv_write_options <- function(
635635
#' write_csv_arrow(airquality, tf, write_options = csv_write_options(null_string = "-99"))
636636
#' @export
637637
csv_write_options <- function(
638-
include_header = TRUE,
639-
batch_size = 1024L,
640-
null_string = "",
641-
delimiter = ",",
642-
eol = "\n",
643-
quoting_style = c("Needed", "AllValid", "None")
638+
include_header = TRUE,
639+
batch_size = 1024L,
640+
null_string = "",
641+
delimiter = ",",
642+
eol = "\n",
643+
quoting_style = c("Needed", "AllValid", "None")
644644
) {
645645
quoting_style <- match.arg(quoting_style)
646646
quoting_style_opts <- c("Needed", "AllValid", "None")
647647
quoting_style <- match(quoting_style, quoting_style_opts) - 1L
648648

649-
assert_that(is.logical(include_header))
649+
check_bool(include_header)
650650
check_number_whole(batch_size, min = 1, allow_infinite = FALSE)
651651
check_string(delimiter)
652652
check_string(null_string, allow_na = FALSE)

r/R/dataset-factory.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ fsf_options <- function(factory_options, partitioning) {
285285
if (!is.null(factory_options$partition_base_dir)) {
286286
if (
287287
inherits(partitioning, "HivePartitioning") ||
288-
(inherits(partitioning, "PartitioningFactory") &&
289-
identical(partitioning$type_name, "hive"))
288+
(inherits(partitioning, "PartitioningFactory") &&
289+
identical(partitioning$type_name, "hive"))
290290
) {
291291
warning(
292292
"factory_options$partition_base_dir is not meaningful for Hive partitioning",

r/R/dataset-scan.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,8 @@ names.Scanner <- function(x) names(x$schema)
160160

161161
#' @export
162162
head.Scanner <- function(x, n = 6L, ...) {
163-
assert_is(n, c("numeric", "integer"))
164-
assert_that(length(n) == 1)
165163
# Negative n requires knowing nrow(x), which requires a scan itself
166-
assert_that(n >= 0)
164+
check_number_decimal(n, min = 0)
167165
if (!is.integer(n)) {
168166
n <- floor(n)
169167
}
@@ -176,10 +174,8 @@ tail.Scanner <- function(x, n = 6L, ...) {
176174
}
177175

178176
tail_from_batches <- function(batches, n) {
179-
assert_is(n, c("numeric", "integer"))
180-
assert_that(length(n) == 1)
181177
# Negative n requires knowing nrow(x), which requires a scan itself
182-
assert_that(n >= 0)
178+
check_number_decimal(n, min = 0)
183179
if (!is.integer(n)) {
184180
n <- floor(n)
185181
}

r/R/dplyr.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ as.data.frame.arrow_dplyr_query <- function(x, row.names = NULL, optional = FALS
230230

231231
#' @export
232232
head.arrow_dplyr_query <- function(x, n = 6L, ...) {
233-
assert_is(n, c("numeric", "integer"))
234-
assert_that(length(n) == 1)
233+
check_number_decimal(n)
235234
if (!is.integer(n)) {
236235
n <- floor(n)
237236
}
@@ -241,8 +240,7 @@ head.arrow_dplyr_query <- function(x, n = 6L, ...) {
241240

242241
#' @export
243242
tail.arrow_dplyr_query <- function(x, n = 6L, ...) {
244-
assert_is(n, c("numeric", "integer"))
245-
assert_that(length(n) == 1)
243+
check_number_decimal(n)
246244
if (!is.integer(n)) {
247245
n <- floor(n)
248246
}

r/R/record-batch-reader.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,8 @@ as.data.frame.RecordBatchReader <- function(x, row.names = NULL, optional = FALS
134134

135135
#' @export
136136
head.RecordBatchReader <- function(x, n = 6L, ...) {
137-
assert_is(n, c("numeric", "integer"))
138-
assert_that(length(n) == 1)
139137
# Negative n requires knowing nrow(x), which requires consuming the whole RBR
140-
assert_that(n >= 0)
138+
check_number_decimal(n, min = 0)
141139
if (!is.integer(n)) {
142140
n <- floor(n)
143141
}

0 commit comments

Comments
 (0)