Binary files /tmp/tmp1pVN8S/1nNoqGo1gv/r-bioc-biocfilecache-1.8.0+dfsg/build/vignette.rds and /tmp/tmp1pVN8S/0xGHKvNkT6/r-bioc-biocfilecache-1.10.2+dfsg/build/vignette.rds differ diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/changelog r-bioc-biocfilecache-1.10.2+dfsg/debian/changelog --- r-bioc-biocfilecache-1.8.0+dfsg/debian/changelog 2019-08-18 08:08:45.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/changelog 2019-11-13 06:46:15.000000000 +0000 @@ -1,3 +1,22 @@ +r-bioc-biocfilecache (1.10.2+dfsg-1) unstable; urgency=medium + + * Team upload. + * New upstream version + + -- Dylan Aïssi Wed, 13 Nov 2019 07:46:15 +0100 + +r-bioc-biocfilecache (1.10.0+dfsg-1) unstable; urgency=medium + + * Team upload. + * New upstream release + * debhelper-compat 12 + * Standards-Version: 4.4.0 + * Trim trailing whitespace. + * Set upstream metadata fields: Bug-Database. + * Remove test that needed network access + + -- Michael R. Crusoe Tue, 12 Nov 2019 14:07:51 +0100 + r-bioc-biocfilecache (1.8.0+dfsg-2) unstable; urgency=medium * Team upload diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/compat r-bioc-biocfilecache-1.10.2+dfsg/debian/compat --- r-bioc-biocfilecache-1.8.0+dfsg/debian/compat 2019-08-18 08:08:32.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -12 diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/control r-bioc-biocfilecache-1.10.2+dfsg/debian/control --- r-bioc-biocfilecache-1.8.0+dfsg/debian/control 2019-08-18 08:08:32.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/control 2019-11-13 06:46:15.000000000 +0000 @@ -4,7 +4,7 @@ Section: gnu-r Testsuite: autopkgtest-pkg-r Priority: optional -Build-Depends: debhelper (>= 12~), +Build-Depends: debhelper-compat (= 12), dh-r, r-base-dev, r-cran-dbplyr, @@ -14,7 +14,7 @@ r-cran-rappdirs, r-cran-curl, r-cran-httr -Standards-Version: 4.3.0 +Standards-Version: 4.4.1 Vcs-Browser: https://salsa.debian.org/r-pkg-team/r-bioc-biocfilecache Vcs-Git: https://salsa.debian.org/r-pkg-team/r-bioc-biocfilecache.git Homepage: https://bioconductor.org/packages/BiocFileCache/ diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/patches/remove_download_test r-bioc-biocfilecache-1.10.2+dfsg/debian/patches/remove_download_test --- r-bioc-biocfilecache-1.8.0+dfsg/debian/patches/remove_download_test 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/patches/remove_download_test 2019-11-13 06:46:15.000000000 +0000 @@ -0,0 +1,77 @@ +Author: Michael R. Crusoe +Description: delete a test that depends on an unavailable external URL +Forwarded: https://github.com/Bioconductor/BiocFileCache/issues/20 +--- a/tests/testthat/test_BiocFileCache_class.R ++++ b/tests/testthat/test_BiocFileCache_class.R +@@ -453,9 +453,7 @@ test_that("bfcneedsupdate works", { + # test expires and last modified not available + link = "http://httpbin.org/get" + bfcupdate(bfc, rid3, fpath=link, ask=FALSE) +- expect_true(is.na(bfcneedsupdate(bfc, rid3))) + expect_true(is.na(as.data.frame(bfcinfo(bfc,rid3))$last_modified_time)) +- expect_true(is.na(as.data.frame(bfcinfo(bfc,rid3))$expires)) + + # remove those that aren't web + expect_identical( +@@ -500,38 +498,6 @@ test_that("bfcneedsupdate works", { + expect_true(bfcneedsupdate(bfc, rid3)) + }) + +-test_that("bfcdownload works", { +- response <- .biocfilecache_flags$set_ask_response(FALSE) +- +- time1 <- file.info(.sql_get_rpath(bfc, rid3))[["ctime"]] +- temp <- bfcdownload(bfc, rid3, ask=TRUE) +- time2 <- file.info(.sql_get_rpath(bfc, rid3))[["ctime"]] +- expect_identical(time1, time2) +- +- temp <- bfcdownload(bfc, rid3, ask=FALSE) +- time3 <- file.info(.sql_get_rpath(bfc, rid3))[["ctime"]] +- expect_true(time1 < time3) +- expect_error(bfcdownload(bfc, rid1)) +- +- url <- "http://bioconductor.org/packages/stats/bioc/BiocFileCache/BiocFileCache_stats.tab" +- headFile <- +- function(url, file) +- { +- dat <- readLines(url) +- dat <- head(dat, n=3L) +- writeLines(dat, file) +- TRUE +- } +- rid <- names(bfcadd(bfc, rname="testFun", fpath=url, download=FALSE)) +- temp <- bfcdownload(bfc, rid, FUN=headFile) +- file <- readLines(temp) +- expect_identical(length(file), 3L) +- +- expect_error(bfcdownload(bfc, rid, ask=FALSE, FUN=rnorm)) +- +- .biocfilecache_flags$set_ask_response(response) +-}) +- + test_that("exportbfc and importbfc works",{ + + bfc <- BiocFileCache(tempfile(), ask = FALSE) +--- a/tests/testthat/test_httr.R ++++ b/tests/testthat/test_httr.R +@@ -5,7 +5,6 @@ test_that("internal .httr_get_cache_info + # example neither + url <- "http://httpbin.org/get" + info <- .httr_get_cache_info(url) +- expect_true(all(is.na(info))) + expect_identical(length(info), 3L) + expect_identical(names(info), c("etag", "modified", "expires")) + +--- a/tests/testthat/test_sql.R ++++ b/tests/testthat/test_sql.R +@@ -131,10 +131,5 @@ test_that(".sql_add_resource() changes r + bfname <- basename(url) + bfname <- curl::curl_escape(bfname) + rpath <- sprintf("%s_%s%s", rpath, bfname, ext) +- id1 <- bfcadd(bfc, url) +- expect_identical(unname(.sql_get_rname(bfc, names(id1))), url) +- expect_identical(unname(.sql_get_fpath(bfc, names(id1))), url) +- # can't do identical because different random identifier +- expect_true(grepl(bfname, basename(unname(.sql_get_rpath(bfc, names(id1)))))) + + }) diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/patches/series r-bioc-biocfilecache-1.10.2+dfsg/debian/patches/series --- r-bioc-biocfilecache-1.8.0+dfsg/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/patches/series 2019-11-13 06:46:15.000000000 +0000 @@ -0,0 +1 @@ +remove_download_test diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/rules r-bioc-biocfilecache-1.10.2+dfsg/debian/rules --- r-bioc-biocfilecache-1.8.0+dfsg/debian/rules 2019-08-18 08:08:32.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/rules 2019-11-13 06:46:15.000000000 +0000 @@ -2,4 +2,3 @@ %: dh $@ --buildsystem R - diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/upstream/metadata r-bioc-biocfilecache-1.10.2+dfsg/debian/upstream/metadata --- r-bioc-biocfilecache-1.8.0+dfsg/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/upstream/metadata 2019-11-13 06:46:15.000000000 +0000 @@ -0,0 +1 @@ +Bug-Database: https://github.com/Bioconductor/BiocFileCache/issues diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/debian/watch r-bioc-biocfilecache-1.10.2+dfsg/debian/watch --- r-bioc-biocfilecache-1.8.0+dfsg/debian/watch 2019-08-18 08:08:32.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/debian/watch 2019-11-13 06:46:15.000000000 +0000 @@ -1,3 +1,3 @@ version=4 -opts="downloadurlmangle=s?^(.*)\.\.?https:$1packages/release/bioc?,repacksuffix=+dfsg,dversionmangle=s/\+dfsg[0-9]*//g,repack,compression=xz" \ +opts="downloadurlmangle=s?^(.*)\.\.?https://bioconductor.org/packages/release/bioc?,repacksuffix=+dfsg,dversionmangle=s/\+dfsg[0-9]*//g,repack,compression=xz" \ https://bioconductor.org/packages/release/bioc/html/BiocFileCache.html .*/BiocFileCache_(.*).tar.gz diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/DESCRIPTION r-bioc-biocfilecache-1.10.2+dfsg/DESCRIPTION --- r-bioc-biocfilecache-1.8.0+dfsg/DESCRIPTION 2019-05-03 02:30:24.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/DESCRIPTION 2019-11-09 03:18:50.000000000 +0000 @@ -1,6 +1,6 @@ Package: BiocFileCache Title: Manage Files Across Sessions -Version: 1.8.0 +Version: 1.10.2 Authors@R: c(person("Lori", "Shepherd", email = "lori.shepherd@roswellpark.org", role = c("aut", "cre")), @@ -20,17 +20,17 @@ License: Artistic-2.0 Encoding: UTF-8 LazyData: true -RoxygenNote: 6.1.0 +RoxygenNote: 6.1.1 biocViews: DataImport VignetteBuilder: knitr Suggests: testthat, knitr, BiocStyle, rmarkdown, rtracklayer git_url: https://git.bioconductor.org/packages/BiocFileCache -git_branch: RELEASE_3_9 -git_last_commit: 0e3542b -git_last_commit_date: 2019-05-02 -Date/Publication: 2019-05-02 +git_branch: RELEASE_3_10 +git_last_commit: e6d2a47 +git_last_commit_date: 2019-11-08 +Date/Publication: 2019-11-08 NeedsCompilation: no -Packaged: 2019-05-03 02:30:24 UTC; biocbuild +Packaged: 2019-11-09 03:18:50 UTC; biocbuild Author: Lori Shepherd [aut, cre], Martin Morgan [aut] Maintainer: Lori Shepherd diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/inst/doc/BiocFileCache.R r-bioc-biocfilecache-1.10.2+dfsg/inst/doc/BiocFileCache.R --- r-bioc-biocfilecache-1.8.0+dfsg/inst/doc/BiocFileCache.R 2019-05-03 02:30:23.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/inst/doc/BiocFileCache.R 2019-11-09 03:18:48.000000000 +0000 @@ -324,7 +324,7 @@ # load the cache path <- file.path(tempdir(), "tempCacheDir") -bfc <- BiocFileCache(path) +bfc <- BiocFileCache(path, ask=FALSE) # the web resources of interest url <- "ftp://ftp.ensembl.org/pub/release-71/gtf/homo_sapiens/Homo_sapiens.GRCh37.71.gtf.gz" diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/inst/doc/BiocFileCache.Rmd r-bioc-biocfilecache-1.10.2+dfsg/inst/doc/BiocFileCache.Rmd --- r-bioc-biocfilecache-1.8.0+dfsg/inst/doc/BiocFileCache.Rmd 2019-05-02 21:12:48.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/inst/doc/BiocFileCache.Rmd 2019-10-29 20:35:38.000000000 +0000 @@ -785,7 +785,7 @@ # load the cache path <- file.path(tempdir(), "tempCacheDir") -bfc <- BiocFileCache(path) +bfc <- BiocFileCache(path, ask=FALSE) # the web resources of interest url <- "ftp://ftp.ensembl.org/pub/release-71/gtf/homo_sapiens/Homo_sapiens.GRCh37.71.gtf.gz" diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/man/BiocFileCache-class.Rd r-bioc-biocfilecache-1.10.2+dfsg/man/BiocFileCache-class.Rd --- r-bioc-biocfilecache-1.8.0+dfsg/man/BiocFileCache-class.Rd 2019-05-02 21:12:48.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/man/BiocFileCache-class.Rd 2019-11-08 21:52:51.000000000 +0000 @@ -39,7 +39,6 @@ \alias{bfcupdate} \alias{bfcmeta<-} \alias{bfcmeta<-,BiocFileCacheBase-method} -\alias{bfcmeta<-} \alias{bfcmetaremove,missing-method} \alias{bfcmetaremove,BiocFileCacheBase-method} \alias{bfcmetaremove} @@ -85,7 +84,8 @@ \alias{show,BiocFileCacheBase-method} \title{BiocFileCache class} \usage{ -BiocFileCache(cache = user_cache_dir(appname = "BiocFileCache"), ask = TRUE) +BiocFileCache(cache = user_cache_dir(appname = "BiocFileCache"), + ask = TRUE) \S4method{bfccache}{BiocFileCacheBase}(x) @@ -108,7 +108,8 @@ \S4method{[}{BiocFileCache,missing,missing}(x, i, j, ..., drop = TRUE) -\S4method{[}{BiocFileCacheReadOnly,missing,missing}(x, i, j, ..., drop = TRUE) +\S4method{[}{BiocFileCacheReadOnly,missing,missing}(x, i, j, ..., + drop = TRUE) \S4method{[[}{BiocFileCacheBase,character,missing}(x, i, j) @@ -118,18 +119,18 @@ \S4method{bfcnew}{missing}(x, rname, rtype = c("relative", "local"), ext = NA_character_) -\S4method{bfcnew}{BiocFileCache}(x, rname, rtype = c("relative", "local"), - ext = NA_character_) +\S4method{bfcnew}{BiocFileCache}(x, rname, rtype = c("relative", + "local"), ext = NA_character_) \S4method{bfcadd}{missing}(x, rname, fpath = rname, rtype = c("auto", "relative", "local", "web"), action = c("copy", "move", "asis"), - proxy = "", download = TRUE, config = list(), ext = NA_character_, - ...) + proxy = "", download = TRUE, config = list(), + ext = NA_character_, ...) -\S4method{bfcadd}{BiocFileCache}(x, rname, fpath = rname, rtype = c("auto", - "relative", "local", "web"), action = c("copy", "move", "asis"), - proxy = "", download = TRUE, config = list(), ext = NA_character_, - ...) +\S4method{bfcadd}{BiocFileCache}(x, rname, fpath = rname, + rtype = c("auto", "relative", "local", "web"), action = c("copy", + "move", "asis"), proxy = "", download = TRUE, config = list(), + ext = NA_character_, ...) \S4method{bfcinfo}{missing}(x, rids) @@ -143,12 +144,14 @@ \S4method{bfcrpath}{missing}(x, rnames, ..., rids, exact = TRUE) -\S4method{bfcrpath}{BiocFileCacheBase}(x, rnames, ..., rids, exact = TRUE) +\S4method{bfcrpath}{BiocFileCacheBase}(x, rnames, ..., rids, + exact = TRUE) \S4method{bfcupdate}{missing}(x, rids, value, ...) -\S4method{bfcupdate}{BiocFileCache}(x, rids, rname = NULL, rpath = NULL, - fpath = NULL, proxy = "", config = list(), ask = TRUE, ...) +\S4method{bfcupdate}{BiocFileCache}(x, rids, rname = NULL, + rpath = NULL, fpath = NULL, proxy = "", config = list(), + ask = TRUE, ...) bfcmeta(x, name, ...) <- value @@ -170,12 +173,12 @@ \S4method{bfcquerycols}{BiocFileCacheBase}(x) -\S4method{bfcquery}{missing}(x, query, field = c("rname", "rpath", "fpath"), - ..., exact = FALSE) - -\S4method{bfcquery}{BiocFileCacheBase}(x, query, field = c("rname", "rpath", +\S4method{bfcquery}{missing}(x, query, field = c("rname", "rpath", "fpath"), ..., exact = FALSE) +\S4method{bfcquery}{BiocFileCacheBase}(x, query, field = c("rname", + "rpath", "fpath"), ..., exact = FALSE) + \S4method{bfccount}{missing}(x) \S4method{bfccount}{BiocFileCacheBase}(x) @@ -189,8 +192,8 @@ \S4method{bfcdownload}{missing}(x, rid, proxy = "", config = list(), ask = TRUE, FUN, ...) -\S4method{bfcdownload}{BiocFileCache}(x, rid, proxy = "", config = list(), - ask = TRUE, FUN, ...) +\S4method{bfcdownload}{BiocFileCache}(x, rid, proxy = "", + config = list(), ask = TRUE, FUN, ...) \S4method{bfcremove}{missing}(x, rids) @@ -200,15 +203,16 @@ \S4method{bfcsync}{BiocFileCache}(x, verbose = TRUE, ask = TRUE) -\S4method{exportbfc}{missing}(x, rids, outputFile = "BiocFileCacheExport.tar", - outputMethod = c("tar", "zip"), verbose = TRUE, ...) +\S4method{exportbfc}{missing}(x, rids, + outputFile = "BiocFileCacheExport.tar", outputMethod = c("tar", + "zip"), verbose = TRUE, ...) \S4method{exportbfc}{BiocFileCacheBase}(x, rids, - outputFile = "BiocFileCacheExport.tar", outputMethod = c("tar", "zip"), - verbose = TRUE, ...) + outputFile = "BiocFileCacheExport.tar", outputMethod = c("tar", + "zip"), verbose = TRUE, ...) -\S4method{importbfc}{character}(filename, archiveMethod = c("untar", "unzip"), - exdir = ".", ...) +\S4method{importbfc}{character}(filename, archiveMethod = c("untar", + "unzip"), exdir = ".", ...) \S4method{cleanbfc}{missing}(x, days = 120, ask = TRUE) @@ -601,6 +605,7 @@ bfcremove(bfc0, rid3) bfcinfo(bfc0) bfcsync(bfc0) + if (!interactive()){ # in interactive mode, in the sync above # this was probably already removed diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/man/makeBiocFileCacheFromDataFrame.Rd r-bioc-biocfilecache-1.10.2+dfsg/man/makeBiocFileCacheFromDataFrame.Rd --- r-bioc-biocfilecache-1.8.0+dfsg/man/makeBiocFileCacheFromDataFrame.Rd 2019-05-02 21:12:48.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/man/makeBiocFileCacheFromDataFrame.Rd 2019-11-08 21:52:51.000000000 +0000 @@ -7,11 +7,12 @@ \title{Make BiocFileCache objects from an existing data.frame} \usage{ makeBiocFileCacheFromDataFrame(df, cache, actionLocal = c("move", "copy", - "asis"), actionWeb = c("move", "copy"), metadataName, ..., ask = TRUE) + "asis"), actionWeb = c("move", "copy"), metadataName, ..., + ask = TRUE) \S4method{makeBiocFileCacheFromDataFrame}{ANY}(df, cache, - actionLocal = c("move", "copy", "asis"), actionWeb = c("move", "copy"), - metadataName, ..., ask = TRUE) + actionLocal = c("move", "copy", "asis"), actionWeb = c("move", + "copy"), metadataName, ..., ask = TRUE) } \arguments{ \item{df}{data.frame or tibble to convert} diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/man/makeCachedActiveBinding.Rd r-bioc-biocfilecache-1.10.2+dfsg/man/makeCachedActiveBinding.Rd --- r-bioc-biocfilecache-1.8.0+dfsg/man/makeCachedActiveBinding.Rd 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/man/makeCachedActiveBinding.Rd 2019-11-08 21:52:51.000000000 +0000 @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/makeCachedActiveBinding.R +\name{makeCachedActiveBinding} +\alias{makeCachedActiveBinding} +\title{makeCachedActiveBinding} +\usage{ +makeCachedActiveBinding(sym, fun, env = .GlobalEnv, verbose = FALSE) +} +\arguments{ +\item{sym}{See \code{\link[base]{makeActiveBinding}} in +the \pkg{base} package.} + +\item{fun}{See \code{\link[base]{makeActiveBinding}} in +the \pkg{base} package.} + +\item{env}{See \code{\link[base]{makeActiveBinding}} in +the \pkg{base} package.} + +\item{verbose}{Set to TRUE to see caching in action (useful for +troubleshooting).} +} +\description{ +Like \code{\link[base]{makeActiveBinding}} but the value of the active +binding gets only evaluated once and is "remembered". +} +\examples{ +makeCachedActiveBinding("x", function() runif(1), verbose=TRUE) +x +x +} diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/NAMESPACE r-bioc-biocfilecache-1.10.2+dfsg/NAMESPACE --- r-bioc-biocfilecache-1.8.0+dfsg/NAMESPACE 2019-05-02 21:12:48.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/NAMESPACE 2019-11-08 21:52:51.000000000 +0000 @@ -24,6 +24,7 @@ export(exportbfc) export(importbfc) export(makeBiocFileCacheFromDataFrame) +export(makeCachedActiveBinding) export(removebfc) exportMethods("[") exportMethods("[[") diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/NEWS r-bioc-biocfilecache-1.10.2+dfsg/NEWS --- r-bioc-biocfilecache-1.8.0+dfsg/NEWS 2019-05-02 21:12:48.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/NEWS 2019-11-08 21:52:51.000000000 +0000 @@ -1,3 +1,19 @@ +CHANGES IN VERSION 1.11 +---------------------- + +BUG FIX + + o (1.11.2) Fixes run of examples. Different result manual vs interactive so + have conditional that will allow complete example if run by user rather than + run automatically through the checks. + +NEW FEATURES + + o (1.11.1) Add makeCachedActiveBinding(). Allows data to be cached during + ActiveBinding call. Avoids callback function executing data retrieval + everytime. + + CHANGES IN VERSION 1.7 ---------------------- diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/R/BiocFileCache-class.R r-bioc-biocfilecache-1.10.2+dfsg/R/BiocFileCache-class.R --- r-bioc-biocfilecache-1.8.0+dfsg/R/BiocFileCache-class.R 2019-05-02 21:12:48.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/R/BiocFileCache-class.R 2019-11-08 21:52:51.000000000 +0000 @@ -1133,7 +1133,14 @@ #' descriptive messages will also be included. #' @examples #' bfcsync(bfc0) -#' bfcremove(bfc0, "BFC1") +#' +#' if (!interactive()){ +#' # in interactive mode, in the sync above +#' # this was probably already removed +#' # noninteractive mode does not remove resources +#' # so can remove manually here +#' bfcremove(bfc0, "BFC1") +#' } #' bfcsync(bfc0, FALSE) #' @aliases bfcsync #' @importFrom utils capture.output diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/R/makeCachedActiveBinding.R r-bioc-biocfilecache-1.10.2+dfsg/R/makeCachedActiveBinding.R --- r-bioc-biocfilecache-1.8.0+dfsg/R/makeCachedActiveBinding.R 1970-01-01 00:00:00.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/R/makeCachedActiveBinding.R 2019-11-08 21:52:51.000000000 +0000 @@ -0,0 +1,47 @@ +#' makeCachedActiveBinding +#' +#' Like \code{\link[base]{makeActiveBinding}} but the value of the active +#' binding gets only evaluated once and is "remembered". +#' +#' @param sym See \code{\link[base]{makeActiveBinding}} in +#' the \pkg{base} package. +#' @param fun See \code{\link[base]{makeActiveBinding}} in +#' the \pkg{base} package. +#' @param env See \code{\link[base]{makeActiveBinding}} in +#' the \pkg{base} package. +#' @param verbose Set to TRUE to see caching in action (useful for +#' troubleshooting). +#' +#' @name makeCachedActiveBinding +#' @aliases makeCachedActiveBinding +#' @export makeCachedActiveBinding +#' +#' @examples +#' makeCachedActiveBinding("x", function() runif(1), verbose=TRUE) +#' x +#' x +makeCachedActiveBinding <- function(sym, fun, env=.GlobalEnv, verbose=FALSE) +{ + caching_env <- new.env(parent=emptyenv()) + fun2 <- function(value) { + if (!missing(value)) + stop("assignment to active binding '", sym, "' is not allowed") + val <- try(get(sym, envir=caching_env, inherits=FALSE), silent=TRUE) + if (inherits(val, "try-error")) { + if (verbose) + cat("evaluating and caching value ", + "for active binding '", sym, "' ... ", sep="") + val <- fun() + assign(sym, val, envir=caching_env) + if (verbose) + cat("OK\n") + } else { + if (verbose) + cat("using cached value for active binding '", sym, "'\n", + sep="") + } + val + } + makeActiveBinding(sym, fun2, env=env) +} + diff -Nru r-bioc-biocfilecache-1.8.0+dfsg/vignettes/BiocFileCache.Rmd r-bioc-biocfilecache-1.10.2+dfsg/vignettes/BiocFileCache.Rmd --- r-bioc-biocfilecache-1.8.0+dfsg/vignettes/BiocFileCache.Rmd 2019-05-02 21:12:48.000000000 +0000 +++ r-bioc-biocfilecache-1.10.2+dfsg/vignettes/BiocFileCache.Rmd 2019-10-29 20:35:38.000000000 +0000 @@ -785,7 +785,7 @@ # load the cache path <- file.path(tempdir(), "tempCacheDir") -bfc <- BiocFileCache(path) +bfc <- BiocFileCache(path, ask=FALSE) # the web resources of interest url <- "ftp://ftp.ensembl.org/pub/release-71/gtf/homo_sapiens/Homo_sapiens.GRCh37.71.gtf.gz"