Skip to content

Commit 1bf6a4a

Browse files
committed
style fixes from code review
1 parent 3124944 commit 1bf6a4a

File tree

6 files changed

+38
-40
lines changed

6 files changed

+38
-40
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Depends:
2626
Imports:
2727
tools,
2828
scales,
29-
httr,
29+
httr (>= 1.3.0),
3030
jsonlite (>= 1.6),
3131
magrittr,
3232
digest,

R/api_exports.R

+9-10
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ api_download_file <- function(id, username, endpoint = "files", ...) {
170170

171171

172172
#' @rdname api
173-
#' @importFrom httr RETRY
174173
#' @export
175174
api <- function(endpoint = "/", verb = "GET", body = NULL, ...) {
176175
api_check_endpoint(endpoint)
@@ -189,15 +188,15 @@ api <- function(endpoint = "/", verb = "GET", body = NULL, ...) {
189188
}
190189

191190
resp <- httr::RETRY(
192-
verb = verb
193-
, url = url
194-
, api_headers()
195-
, api_auth()
196-
, body = body
197-
, times = 5
198-
, terminate_on = c(400, 401, 403, 404)
199-
, terminate_on_success = TRUE
200-
, ...
191+
verb = verb,
192+
url = url,
193+
api_headers(),
194+
api_auth(),
195+
body = body,
196+
times = 5,
197+
terminate_on = c(400, 401, 403, 404),
198+
terminate_on_success = TRUE
199+
...
201200
)
202201

203202
structure(process(resp), class = "api")

R/orca.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ orca_serve <- function(port = 5151, mathjax = FALSE, safe = FALSE, request_limit
193193
scale = scale
194194
)
195195
res <- httr::RETRY(
196-
verb = "POST"
197-
, url = paste0("http://127.0.0.1:", port)
198-
, body = to_JSON(bod)
199-
, times = 5
200-
, terminate_on = c(400, 401, 403, 404)
201-
, terminate_on_success = TRUE
196+
verb = "POST",
197+
url = paste0("http://127.0.0.1:", port),
198+
body = to_JSON(bod),
199+
times = 5,
200+
terminate_on = c(400, 401, 403, 404),
201+
terminate_on_success = TRUE
202202
)
203203
httr::stop_for_status(res)
204204
httr::warn_for_status(res)

R/plotly_IMAGE.R

+11-12
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#' @param format The desired image format 'png', 'jpeg', 'svg', 'pdf', 'eps', or 'webp'
1010
#' @param scale Both png and jpeg formats will be scaled beyond the specified width and height by this number.
1111
#' @param out_file A filename for writing the image to a file.
12-
#' @param ... arguments passed onto `httr::RETRY`
13-
#' @importFrom httr RETRY write_disk
12+
#' @param ... arguments passed onto `httr::RETRY`
1413
#' @export
1514
#' @examples \dontrun{
1615
#' p <- plot_ly(x = 1:10)
@@ -36,16 +35,16 @@ plotly_IMAGE <- function(x, width = 1000, height = 500, format = "png",
3635
)
3736
base_url <- file.path(get_domain("api"), "v2", "images")
3837
resp <- httr::RETRY(
39-
verb = "POST"
40-
, url = base_url
41-
, body = to_JSON(bod)
42-
, times = 5
43-
, terminate_on = c(400, 401, 403, 404)
44-
, terminate_on_success = TRUE
45-
, api_headers()
46-
, api_auth()
47-
, if (!missing(out_file)) httr::write_disk(out_file, overwrite = TRUE)
48-
, ...
38+
verb = "POST",
39+
url = base_url,
40+
body = to_JSON(bod),
41+
times = 5,
42+
terminate_on = c(400, 401, 403, 404),
43+
terminate_on_success = TRUE,
44+
api_headers(),
45+
api_auth(),
46+
if (!missing(out_file)) httr::write_disk(out_file, overwrite = TRUE),
47+
...
4948
)
5049
con <- process(append_class(resp, "api_image"))
5150
invisible(con)

R/signup.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ signup <- function(username, email, save = TRUE) {
4646
)
4747
base_url <- file.path(get_domain(), "apimkacct")
4848
resp <- httr::RETRY(
49-
verb = "POST"
50-
, base_url
51-
, body = bod
52-
, times = 5
53-
, terminate_on = c(400, 401, 403, 404)
54-
, terminate_on_success = TRUE
49+
verb = "POST",
50+
base_url,
51+
body = bod,
52+
times = 5,
53+
terminate_on = c(400, 401, 403, 404),
54+
terminate_on_success = TRUE
5555
)
5656
con <- process(append_class(resp, "signup"))
5757
if (save) {

inst/plotlyjs.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ library(httr)
22
# download latest GitHub release
33
# for a particular version: `zip <- "https://github.com/plotly/plotly.js/archive/v1.33.1.zip"`
44
x <- httr::RETRY(
5-
verb = "GET"
6-
, url = 'https://api.github.com/repos/plotly/plotly.js/releases/latest'
7-
, times = 5
8-
, terminate_on = c(400, 401, 403, 404)
9-
, terminate_on_success = TRUE
5+
verb = "GET",
6+
url = 'https://api.github.com/repos/plotly/plotly.js/releases/latest',
7+
times = 5,
8+
terminate_on = c(400, 401, 403, 404),
9+
terminate_on_success = TRUE
1010
)
1111
zip <- content(x)$zipball_url
1212
tmp <- tempfile(fileext = ".zip")

0 commit comments

Comments
 (0)