Skip to content
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

Use non-deprecated obj_*() family #1150

Merged
merged 1 commit into from
Aug 21, 2024
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
4 changes: 2 additions & 2 deletions R/list-combine.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#'
#' list_cbind(x2)
list_c <- function(x, ..., ptype = NULL) {
vec_check_list(x)
obj_check_list(x)
check_dots_empty()

# For `list_c()`, we don't expose `list_unchop()`'s `name_spec` arg,
Expand Down Expand Up @@ -77,7 +77,7 @@ list_rbind <- function(x, ..., names_to = rlang::zap(), ptype = NULL) {


check_list_of_data_frames <- function(x, error_call = caller_env()) {
vec_check_list(x, call = error_call)
obj_check_list(x, call = error_call)

is_df_or_null <- map_lgl(x, function(x) is.data.frame(x) || is.null(x))

Expand Down
4 changes: 2 additions & 2 deletions R/list-flatten.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ list_flatten <- function(
name_spec = "{outer}_{inner}",
name_repair = c("minimal", "unique", "check_unique", "universal")
) {
vec_check_list(x)
obj_check_list(x)
check_dots_empty()
check_string(name_spec)

Expand All @@ -55,7 +55,7 @@ list_flatten <- function(

# Unclass S3 lists to avoid their coercion methods. Wrap atoms in a
# list of size 1 so the elements can be concatenated in a single list.
proxy <- map_if(proxy, vec_is_list, unclass, .else = list)
proxy <- map_if(proxy, obj_is_list, unclass, .else = list)

out <- list_unchop(
proxy,
Expand Down
4 changes: 2 additions & 2 deletions R/list-simplify.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#'
#' @param x A list.
#' @param strict What should happen if simplification fails? If `TRUE`
#' (the default) it will error. If `FALSE` and `ptype` is not supplied,
#' (the default) it will error. If `FALSE` and `ptype` is not supplied,
#' it will return `x` unchanged.
#' @param ptype An optional prototype to ensure that the output type is always
#' the same.
Expand Down Expand Up @@ -66,7 +66,7 @@ simplify_impl <- function(x,
ptype = NULL,
error_arg = caller_arg(x),
error_call = caller_env()) {
vec_check_list(x, arg = error_arg, call = error_call)
obj_check_list(x, arg = error_arg, call = error_call)

# Handle the cases where we definitely can't simplify
if (strict) {
Expand Down
4 changes: 2 additions & 2 deletions R/modify-tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' a node (by returning `TRUE`) or a leaf (by returning `FALSE`). The
#' default value, `NULL`, treats simple lists as nodes and everything else
#' (including richer objects like data frames and linear models) as leaves,
#' using [vctrs::vec_is_list()]. To recurse into all objects built on lists
#' using [vctrs::obj_is_list()]. To recurse into all objects built on lists
#' use [is.list()].
#' @param pre,post Functions applied to each node. `pre` is applied on the
#' way "down", i.e. before the leaves are transformed with `leaf`, while
Expand Down Expand Up @@ -62,7 +62,7 @@ modify_tree <- function(x,

as_is_node <- function(f, error_call = caller_env(), error_arg = caller_arg(f)) {
if (is.null(f)) {
vec_is_list
obj_is_list
} else {
is_node_f <- rlang::as_function(f, call = error_call, arg = error_arg)
as_predicate(
Expand Down
6 changes: 3 additions & 3 deletions R/modify.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
modify <- function(.x, .f, ...) {
.f <- as_mapper(.f, ...)

if (vec_is_list(.x)) {
if (obj_is_list(.x)) {
out <- map(vec_proxy(.x), .f, ...)
vec_restore(out, .x)
} else if (is.data.frame(.x)) {
Expand Down Expand Up @@ -137,7 +137,7 @@ modify_at <- function(.x, .at, .f, ...) {
modify2 <- function(.x, .y, .f, ...) {
.f <- as_mapper(.f, ...)

if (vec_is_list(.x)) {
if (obj_is_list(.x)) {
out <- map2(vec_proxy(.x), .y, .f, ...)
vec_restore(out, .x)
} else if (is.data.frame(.x)) {
Expand Down Expand Up @@ -172,7 +172,7 @@ imodify <- function(.x, .f, ...) {
# helpers -----------------------------------------------------------------

modify_where <- function(.x, .where, .f, ..., .purrr_error_call = caller_env()) {
if (vec_is_list(.x)) {
if (obj_is_list(.x)) {
out <- vec_proxy(.x)
out[.where] <- no_zap(map(out[.where], .f, ...), .purrr_error_call)
vec_restore(out, .x)
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ vctrs_list_compat <- function(x,
error_call = caller_env(),
error_arg = caller_arg(x)) {
out <- vctrs_vec_compat(x, user_env)
vec_check_list(out, call = error_call, arg = error_arg)
obj_check_list(out, call = error_call, arg = error_arg)
out
}

Expand Down
2 changes: 1 addition & 1 deletion man/list_assign.Rd

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

2 changes: 1 addition & 1 deletion man/map_depth.Rd

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

2 changes: 1 addition & 1 deletion man/modify_tree.Rd

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

Loading