Skip to content

Commit

Permalink
refactor: remove namespace prefix for purrr function that are imported
Browse files Browse the repository at this point in the history
  • Loading branch information
m-muecke committed Dec 29, 2024
1 parent 9652d15 commit 4ebbfb1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion R/markdown-state.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local_markdown <- function(env = parent.frame()) {
markdown_activate <- function(tags) {
## markdown on/off based on global flag and presence of @md & @nomd

names <- purrr::map_chr(tags, "tag")
names <- map_chr(tags, "tag")
has_md <- "md" %in% names
has_nomd <- "noMd" %in% names

Expand Down
16 changes: 8 additions & 8 deletions R/rd-r6.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ r6_fields <- function(block, r6data) {
fields <- self$name[self$type == "field"]
active <- self$name[self$type == "active"]

tags <- purrr::keep(
tags <- keep(
block$tags,
function(t) t$tag == "field" && ! t$val$name %in% active
)
Expand Down Expand Up @@ -165,7 +165,7 @@ r6_active_bindings <- function(block, r6data) {
fields <- self$name[self$type == "field"]
active <- self$name[self$type == "active"]

tags <- purrr::keep(
tags <- keep(
block$tags,
function(t) t$tag == "field" && ! t$val$name %in% fields
)
Expand Down Expand Up @@ -313,7 +313,7 @@ r6_method_begin <- function(block, method) {
}

r6_method_description <- function(block, method) {
det <- purrr::keep(method$tags[[1]], function(t) t$tag == "description")
det <- keep(method$tags[[1]], function(t) t$tag == "description")
# Add an empty line between @description tags, if there isn't one
# there already
txt <- map_chr(det, "val")
Expand All @@ -340,7 +340,7 @@ r6_method_usage <- function(block, method) {
}

r6_method_details <- function(block, method) {
det <- purrr::keep(method$tags[[1]], function(t) t$tag == "details")
det <- keep(method$tags[[1]], function(t) t$tag == "details")
# Add an empty line between @details tags, if there isn't one
# there already
txt <- map_chr(det, "val")
Expand All @@ -354,7 +354,7 @@ r6_method_details <- function(block, method) {
}

r6_method_params <- function(block, method) {
par <- purrr::keep(method$tags[[1]], function(t) t$tag == "param")
par <- keep(method$tags[[1]], function(t) t$tag == "param")
nms <- gsub(",", ", ", map_chr(par, c("val", "name")))

# Each arg should appear exactly once
Expand Down Expand Up @@ -414,7 +414,7 @@ r6_method_params <- function(block, method) {
}

r6_method_return <- function(block, method) {
ret <- purrr::keep(method$tags[[1]], function(t) t$tag == "return")
ret <- keep(method$tags[[1]], function(t) t$tag == "return")
if (length(ret) == 0) return()
if (length(ret) > 1) {
warn_roxy_block(block, "Must use one @return per R6 method")
Expand All @@ -428,7 +428,7 @@ r6_method_return <- function(block, method) {
}

r6_method_examples <- function(block, method) {
exa <- purrr::keep(method$tags[[1]], function(t) t$tag == "examples")
exa <- keep(method$tags[[1]], function(t) t$tag == "examples")
if (length(exa) == 0) return()

txt <- map_chr(exa, "val")
Expand All @@ -455,7 +455,7 @@ r6_all_examples <- function(block, methods) {
unlist(lapply(
seq_len(nrow(methods)),
function(i) {
exa <- purrr::keep(methods$tags[[i]], function(t) t$tag == "examples")
exa <- keep(methods$tags[[i]], function(t) t$tag == "examples")
if (length(exa) == 0) return()
name <- paste0(block$object$alias, "$", r6_show_name(methods$name[i]))
c(
Expand Down
2 changes: 1 addition & 1 deletion R/rd.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ roclet_output.roclet_rd <- function(x, results, base_path, ..., is_first = FALSE
roclet_clean.roclet_rd <- function(x, base_path) {
rd <- dir(file.path(base_path, "man"), full.names = TRUE)
rd <- rd[!file.info(rd)$isdir]
unlink(purrr::keep(rd, made_by_roxygen))
unlink(keep(rd, made_by_roxygen))

Check warning on line 92 in R/rd.R

View check run for this annotation

Codecov / codecov/patch

R/rd.R#L92

Added line #L92 was not covered by tests
}

# Does this block get an Rd file?
Expand Down
2 changes: 1 addition & 1 deletion R/roxygenize.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ roxygenize <- function(package.dir = ".",
base_path = base_path
)

out <- purrr::map2(
out <- map2(
roclets, results,
roclet_output,
base_path = base_path,
Expand Down

0 comments on commit 4ebbfb1

Please sign in to comment.