Skip to content

Commit 241a482

Browse files
committed
Add explicit namespace to non-base functions
1 parent 2abaffa commit 241a482

16 files changed

+56
-51
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ shiny 0.12.1.9xxx
2424
* Added two alias functions of `updateTabsetPanel()` to update the selected tab:
2525
`updateNavbarPage()` and `updateNavlistPanel()`. (#881)
2626

27+
* All non-base functions are now explicitly namespaced, to pass checks in
28+
R-devel.
29+
2730
shiny 0.12.1
2831
--------------------------------------------------------------------------------
2932

R/app.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ shinyApp <- function(ui=NULL, server=NULL, onStart=NULL, options=list(),
9191
#' file and either ui.R or www/index.html)
9292
#' @export
9393
shinyAppDir <- function(appDir, options=list()) {
94-
if (!file_test('-d', appDir)) {
94+
if (!utils::file_test('-d', appDir)) {
9595
stop("No Shiny application exists at the path \"", appDir, "\"")
9696
}
9797

R/graph.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ writeReactLog <- function(file=stdout()) {
3737
#'
3838
#' @export
3939
showReactLog <- function() {
40-
browseURL(renderReactLog())
40+
utils::browseURL(renderReactLog())
4141
}
4242

4343
renderReactLog <- function() {
@@ -91,7 +91,7 @@ renderReactLog <- function() {
9191
.graphAppend(list(
9292
action = 'valueChange',
9393
id = label,
94-
value = paste(capture.output(str(value)), collapse='\n')
94+
value = paste(utils::capture.output(utils::str(value)), collapse='\n')
9595
))
9696
}
9797

R/imageutils.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ plotPNG <- function(func, filename=tempfile(fileext='.png'),
3333
# Otherwise, if the Cairo package is installed, use CairoPNG().
3434
# Finally, if neither quartz nor Cairo, use png().
3535
if (capabilities("aqua")) {
36-
pngfun <- png
36+
pngfun <- grDevices::png
3737
} else if ((getOption('shiny.usecairo') %OR% TRUE) &&
3838
nchar(system.file(package = "Cairo"))) {
3939
pngfun <- Cairo::CairoPNG
4040
} else {
41-
pngfun <- png
41+
pngfun <- grDevices::png
4242
}
4343

4444
pngfun(filename=filename, width=width, height=height, res=res, ...)
@@ -49,10 +49,10 @@ plotPNG <- function(func, filename=tempfile(fileext='.png'),
4949
# by plot.new() with the default (large) margin. However, this does not
5050
# guarantee user's code in func() will not trigger the error -- they may have
5151
# to set par(mar = smaller_value) before they draw base graphics.
52-
op <- par(mar = rep(0, 4))
53-
tryCatch(plot.new(), finally = par(op))
54-
dv <- dev.cur()
55-
tryCatch(shinyCallingHandlers(func()), finally = dev.off(dv))
52+
op <- graphics::par(mar = rep(0, 4))
53+
tryCatch(graphics::plot.new(), finally = graphics::par(op))
54+
dv <- grDevices::dev.cur()
55+
tryCatch(shinyCallingHandlers(func()), finally = grDevices::dev.off(dv))
5656

5757
filename
5858
}

R/progress.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Progress <- R6Class(
8787
stop("'session' is not a ShinySession object.")
8888

8989
private$session <- session
90-
private$id <- paste(as.character(as.raw(runif(8, min=0, max=255))), collapse='')
90+
private$id <- paste(as.character(as.raw(stats::runif(8, min=0, max=255))), collapse='')
9191
private$min <- min
9292
private$max <- max
9393
private$value <- NULL

R/reactives.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@ reactiveValuesToList <- function(x, all.names=FALSE) {
307307
# x[['impl']].
308308
#' @export
309309
str.reactivevalues <- function(object, indent.str = " ", ...) {
310-
str(unclass(object), indent.str = indent.str, ...)
310+
utils::str(unclass(object), indent.str = indent.str, ...)
311311
# Need to manually print out the class field,
312312
cat(indent.str, '- attr(*, "class")=', sep = "")
313-
str(class(object))
313+
utils::str(class(object))
314314
}
315315

316316
# Observable ----------------------------------------------------------------

R/render-plot.R

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ renderPlot <- function(expr, width='auto', height='auto', res=72, ...,
9393

9494
# Special case for ggplot objects - need to capture coordmap
9595
if (inherits(result$value, "ggplot")) {
96-
capture.output(coordmap <<- getGgplotCoordmap(result$value, pixelratio))
96+
utils::capture.output(coordmap <<- getGgplotCoordmap(result$value, pixelratio))
9797
} else {
98-
capture.output(print(result$value))
98+
utils::capture.output(print(result$value))
9999
}
100100
}
101101

@@ -237,12 +237,12 @@ renderPlot <- function(expr, width='auto', height='auto', res=72, ...,
237237
# Requires width and height of output image, in pixels.
238238
# Must be called before the graphics device is closed.
239239
getPrevPlotCoordmap <- function(width, height) {
240-
usrCoords <- par('usr')
240+
usrCoords <- graphics::par('usr')
241241
usrBounds <- usrCoords
242-
if (par('xlog')) {
242+
if (graphics::par('xlog')) {
243243
usrBounds[c(1,2)] <- 10 ^ usrBounds[c(1,2)]
244244
}
245-
if (par('ylog')) {
245+
if (graphics::par('ylog')) {
246246
usrBounds[c(3,4)] <- 10 ^ usrBounds[c(3,4)]
247247
}
248248

@@ -257,14 +257,14 @@ getPrevPlotCoordmap <- function(width, height) {
257257
),
258258
# The bounds of the plot area, in DOM pixels
259259
range = list(
260-
left = grconvertX(usrBounds[1], 'user', 'nfc') * width,
261-
right = grconvertX(usrBounds[2], 'user', 'nfc') * width,
262-
bottom = (1-grconvertY(usrBounds[3], 'user', 'nfc')) * height - 1,
263-
top = (1-grconvertY(usrBounds[4], 'user', 'nfc')) * height - 1
260+
left = graphics::grconvertX(usrBounds[1], 'user', 'nfc') * width,
261+
right = graphics::grconvertX(usrBounds[2], 'user', 'nfc') * width,
262+
bottom = (1-graphics::grconvertY(usrBounds[3], 'user', 'nfc')) * height - 1,
263+
top = (1-graphics::grconvertY(usrBounds[4], 'user', 'nfc')) * height - 1
264264
),
265265
log = list(
266-
x = if (par('xlog')) 10 else NULL,
267-
y = if (par('ylog')) 10 else NULL
266+
x = if (graphics::par('xlog')) 10 else NULL,
267+
y = if (graphics::par('ylog')) 10 else NULL
268268
),
269269
# We can't extract the original variable names from a base graphic.
270270
# `mapping` is an empty _named_ list, so that it is converted to an object
@@ -304,7 +304,7 @@ getGgplotCoordmap <- function(p, pixelratio) {
304304
which_method <- function(generic, x) {
305305
classes <- class(x)
306306
method_names <- paste(generic, classes, sep = ".")
307-
idx <- which(method_names %in% methods(generic))
307+
idx <- which(method_names %in% utils::methods(generic))
308308

309309
if (length(idx) == 0)
310310
return(NULL)
@@ -539,7 +539,7 @@ getGgplotCoordmap <- function(p, pixelratio) {
539539
# the image has double size. In the latter case we don't have to scale the
540540
# numbers down.
541541
pix_ratio <- 1
542-
if (!grepl("^quartz", names(dev.cur()))) {
542+
if (!grepl("^quartz", names(grDevices::dev.cur()))) {
543543
pix_ratio <- pixelratio
544544
}
545545

R/run-url.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ runUrl <- function(url, filetype = NULL, subdir = NULL, destdir = NULL, ...) {
7171
untar2(filePath, exdir = fileDir)
7272

7373
} else if (fileext == ".zip") {
74-
first <- as.character(unzip(filePath, list=TRUE)$Name)[1]
75-
unzip(filePath, exdir = fileDir)
74+
first <- as.character(utils::unzip(filePath, list=TRUE)$Name)[1]
75+
utils::unzip(filePath, exdir = fileDir)
7676
}
7777

7878
if(is.null(destdir)){
7979
on.exit(unlink(fileDir, recursive = TRUE), add = TRUE)
8080
}
8181

8282
appdir <- file.path(fileDir, first)
83-
if (!file_test('-d', appdir)) appdir <- dirname(appdir)
83+
if (!utils::file_test('-d', appdir)) appdir <- dirname(appdir)
8484

8585
if (!is.null(subdir)) appdir <- file.path(appdir, subdir)
8686
runApp(appdir, ...)

R/server.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ runApp <- function(appDir=getwd(),
547547
# SHINY_SERVER_VERSION, those will return "" which is considered less than
548548
# any valid version.
549549
ver <- Sys.getenv('SHINY_SERVER_VERSION')
550-
if (compareVersion(ver, .shinyServerMinVersion) < 0) {
550+
if (utils::compareVersion(ver, .shinyServerMinVersion) < 0) {
551551
warning('Shiny Server v', .shinyServerMinVersion,
552552
' or later is required; please upgrade!')
553553
}

R/shiny.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ ShinySession <- R6Class(
499499
private$invalidatedOutputErrors$set(
500500
name,
501501
list(message = cond$message,
502-
call = capture.output(print(cond$call)),
502+
call = utils::capture.output(print(cond$call)),
503503
type = if (length(type)) type))
504504
}
505505
else

0 commit comments

Comments
 (0)