Skip to content

Commit 0af7cb2

Browse files
stopifnot() -> stop_if_not()
1 parent 2127528 commit 0af7cb2

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

R/make_progression_handler.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ make_progression_handler <- function(name, reporter = list(), handler = NULL, en
252252

253253
if (is.null(handler)) {
254254
handler <- function(p) {
255-
stopifnot(inherits(p, "progression"))
255+
stop_if_not(inherits(p, "progression"))
256256

257257
if (inherits(p, "control_progression")) {
258258
type <- p$type

R/progress.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ progress <- function(..., call = sys.call()) {
1616
args <- list(...)
1717
if (length(args) == 1L && inherits(args[[1L]], "condition")) {
1818
cond <- args[[1L]]
19-
stopifnot(inherits(cond, "progression"))
19+
stop_if_not(inherits(cond, "progression"))
2020
} else {
2121
cond <- progression(..., call = call)
2222
}

R/progress_aggregator.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ progress_aggregator <- function(progress) {
1515
max_steps <- environment(progress)$steps
1616

1717
handler <- function(p) {
18-
stopifnot(inherits(p, "progression"))
18+
stop_if_not(inherits(p, "progression"))
1919
type <- p$type
2020
debug <- getOption("progressr.debug", FALSE)
2121
if (debug) {

R/progression.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ progression <- function(message = character(0L), amount = 1.0, step = NULL, time
5252
nargs <- length(args)
5353
if (nargs > 0L) {
5454
names <- names(args)
55-
stopifnot(!is.null(names), all(nzchar(names)),
56-
length(unique(names)) == nargs)
55+
stop_if_not(!is.null(names), all(nzchar(names)),
56+
length(unique(names)) == nargs)
5757
}
5858

5959
structure(

R/with_progress.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ with_progress <- function(expr, handlers = progressr::handlers(), cleanup = TRUE
131131

132132
for (kk in seq_along(handlers)) {
133133
handler <- handlers[[kk]]
134-
stopifnot(is.function(handler))
134+
stop_if_not(is.function(handler))
135135
if (!inherits(handler, "progression_handler")) {
136136
handler <- handler()
137-
stopifnot(is.function(handler), inherits(handler, "progression_handler"))
137+
stop_if_not(is.function(handler),
138+
inherits(handler, "progression_handler"))
138139
handlers[[kk]] <- handler
139140
}
140141
}

0 commit comments

Comments
 (0)