mirror of
https://github.com/sensebox/opensensmapr
synced 2025-02-22 06:23:57 +01:00
lint
This commit is contained in:
parent
e7203cea81
commit
909e4de36d
4 changed files with 8 additions and 7 deletions
|
@ -29,7 +29,7 @@ dplyr_class_wrapper = function(callback) {
|
||||||
#' the callstack. See https://stackoverflow.com/a/33108841
|
#' the callstack. See https://stackoverflow.com/a/33108841
|
||||||
#'
|
#'
|
||||||
#' @noRd
|
#' @noRd
|
||||||
isNonInteractive = function () {
|
is_non_interactive = function () {
|
||||||
ff <- sapply(sys.calls(), function(f) as.character(f[1]))
|
ff <- sapply(sys.calls(), function(f) as.character(f[1]))
|
||||||
any(ff %in% c("knit2html", "render")) || !interactive()
|
any(ff %in% c("knit2html", "render")) || !interactive()
|
||||||
}
|
}
|
||||||
|
|
2
R/api.R
2
R/api.R
|
@ -60,7 +60,7 @@ get_stats_ = function (endpoint) {
|
||||||
}
|
}
|
||||||
|
|
||||||
osem_request_ = function (host, path, ..., type = 'parsed', progress) {
|
osem_request_ = function (host, path, ..., type = 'parsed', progress) {
|
||||||
progress = if (progress && !isNonInteractive()) httr::progress() else NULL
|
progress = if (progress && !is_non_interactive()) httr::progress() else NULL
|
||||||
res = httr::GET(host, progress, path = path, query = list(...))
|
res = httr::GET(host, progress, path = path, query = list(...))
|
||||||
|
|
||||||
if (httr::http_error(res)) {
|
if (httr::http_error(res)) {
|
||||||
|
|
|
@ -106,9 +106,10 @@ parse_get_measurements_params = function (params) {
|
||||||
if (is.null(params$phenomenon) | is.na(params$phenomenon))
|
if (is.null(params$phenomenon) | is.na(params$phenomenon))
|
||||||
stop('Parameter "phenomenon" is required')
|
stop('Parameter "phenomenon" is required')
|
||||||
|
|
||||||
if ((!is.na(params$from) && is.na(params$to)) ||
|
if (
|
||||||
(!is.na(params$to) && is.na(params$from))
|
(!is.na(params$from) && is.na(params$to)) ||
|
||||||
) stop('specify "from" only together with "to"')
|
(!is.na(params$to) && is.na(params$from))
|
||||||
|
) stop('specify "from" only together with "to"')
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!is.null(params$bbox) && !is.null(params$boxes)) ||
|
(!is.null(params$bbox) && !is.null(params$boxes)) ||
|
||||||
|
@ -161,7 +162,7 @@ paged_measurements_req = function (query) {
|
||||||
query$`to-date` = date_as_isostring(page$to)
|
query$`to-date` = date_as_isostring(page$to)
|
||||||
res = do.call(get_measurements_, query)
|
res = do.call(get_measurements_, query)
|
||||||
|
|
||||||
if (query$progress && !isNonInteractive())
|
if (query$progress && !is_non_interactive())
|
||||||
cat(paste(query$`from-date`, query$`to-date`, sep = ' - '), '\n')
|
cat(paste(query$`from-date`, query$`to-date`, sep = ' - '), '\n')
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
Loading…
Add table
Reference in a new issue