mirror of
https://github.com/sensebox/opensensmapr
synced 2025-02-20 20:23:58 +01:00
lint
This commit is contained in:
parent
e7203cea81
commit
909e4de36d
4 changed files with 8 additions and 7 deletions
|
@ -8,7 +8,7 @@ Imports:
|
|||
dplyr,
|
||||
httr,
|
||||
magrittr
|
||||
Suggests:
|
||||
Suggests:
|
||||
maps,
|
||||
maptools,
|
||||
readr,
|
||||
|
|
|
@ -29,7 +29,7 @@ dplyr_class_wrapper = function(callback) {
|
|||
#' the callstack. See https://stackoverflow.com/a/33108841
|
||||
#'
|
||||
#' @noRd
|
||||
isNonInteractive = function () {
|
||||
is_non_interactive = function () {
|
||||
ff <- sapply(sys.calls(), function(f) as.character(f[1]))
|
||||
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) {
|
||||
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(...))
|
||||
|
||||
if (httr::http_error(res)) {
|
||||
|
|
|
@ -106,9 +106,10 @@ parse_get_measurements_params = function (params) {
|
|||
if (is.null(params$phenomenon) | is.na(params$phenomenon))
|
||||
stop('Parameter "phenomenon" is required')
|
||||
|
||||
if ((!is.na(params$from) && is.na(params$to)) ||
|
||||
(!is.na(params$to) && is.na(params$from))
|
||||
) stop('specify "from" only together with "to"')
|
||||
if (
|
||||
(!is.na(params$from) && is.na(params$to)) ||
|
||||
(!is.na(params$to) && is.na(params$from))
|
||||
) stop('specify "from" only together with "to"')
|
||||
|
||||
if (
|
||||
(!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)
|
||||
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')
|
||||
|
||||
res
|
||||
|
|
Loading…
Add table
Reference in a new issue