Skip to content

Commit 6b70c67

Browse files
committed
Merge branch 'r-1.1.0.9002' into production
2 parents eb97c17 + 4c73b5b commit 6b70c67

File tree

11 files changed

+377
-39
lines changed

11 files changed

+377
-39
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.Rproj.user
22
.Rhistory
33
.RData
4+
/.drake

API

-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,4 @@ c.blob(x, ...)
2121
format.blob(x, ...)
2222
is.na.blob(x)
2323
is.na<-.blob(x, value)
24-
is_vector_s3.blob(x)
25-
obj_sum.blob(x)
26-
pillar_shaft.blob(x, ...)
2724
print.blob(x, ...)
28-
type_sum.blob(x)

DESCRIPTION

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: blob
22
Title: A Simple S3 Class for Representing Vectors of Binary Data ('BLOBS')
3-
Version: 1.1.0.9001
3+
Version: 1.1.0.9002
44
Authors@R: c(
55
person("Hadley", "Wickham", role = c("aut")),
66
person("Kirill", "Müller", , "krlmlr+r@mailbox.org", role = c("cre")),
@@ -10,17 +10,17 @@ Description: R's raw vector is useful for storing a single binary object.
1010
What if you want to put a vector of them in a data frame? The 'blob'
1111
package provides the blob object, a list of raw vectors, suitable for
1212
use as a column in data frame.
13-
Imports:
13+
License: GPL-3
14+
URL: https://github.com/tidyverse/blob
15+
BugReports: https://github.com/tidyverse/blob/issues
16+
Imports:
1417
methods,
15-
pillar,
1618
prettyunits
17-
License: GPL-3
19+
Suggests:
20+
covr,
21+
pillar (>= 1.2.1),
22+
testthat
1823
Encoding: UTF-8
1924
LazyData: true
20-
URL: https://github.com/hadley/blob
21-
BugReports: https://github.com/hadley/blob/issues
22-
Suggests:
23-
testthat,
24-
covr
2525
Roxygen: list(markdown = TRUE, roclets = c("collate", "namespace", "rd", "pkgapi::api_roclet"))
26-
RoxygenNote: 6.0.1
26+
RoxygenNote: 6.0.1.9000

NAMESPACE

-8
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@ S3method(as.data.frame,blob)
1313
S3method(c,blob)
1414
S3method(format,blob)
1515
S3method(is.na,blob)
16-
S3method(is_vector_s3,blob)
17-
S3method(obj_sum,blob)
18-
S3method(pillar_shaft,blob)
1916
S3method(print,blob)
20-
S3method(type_sum,blob)
2117
export(as.blob)
2218
export(blob)
2319
export(new_blob)
2420
importFrom(methods,setOldClass)
25-
importFrom(pillar,is_vector_s3)
26-
importFrom(pillar,obj_sum)
27-
importFrom(pillar,pillar_shaft)
28-
importFrom(pillar,type_sum)

NEWS.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### blob 1.1.0.9002 (2018-03-24)
2+
3+
- The *pillar* package is now suggested only, using dynamic method registration (#9).
4+
15
### blob 1.1.0.9001 (2017-11-30)
26

37
- Now using the prettyunits package to format data sizes.

R/format.R

+4-8
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,25 @@ print.blob <- function(x, ...) {
1515
}
1616
}
1717

18-
#' @export
19-
#' @importFrom pillar type_sum
18+
# Dynamically exported, see zzz.R
2019
type_sum.blob <- function(x) {
2120
"blob"
2221
}
2322

24-
#' @export
25-
#' @importFrom pillar obj_sum
23+
# Dynamically exported, see zzz.R
2624
obj_sum.blob <- function(x) {
2725
format(x, trim = FALSE)
2826
}
2927

30-
#' @export
31-
#' @importFrom pillar is_vector_s3
28+
# Dynamically exported, see zzz.R
3229
is_vector_s3.blob <- function(x) TRUE
3330

3431
blob_size <- function(x, digits = 3, trim = TRUE, ...) {
3532
x <- vapply(x, length, numeric(1))
3633
prettyunits::pretty_bytes(x)
3734
}
3835

39-
#' @importFrom pillar pillar_shaft
40-
#' @export
36+
# Dynamically exported, see zzz.R
4137
pillar_shaft.blob <- function(x, ...) {
4238
out <- ifelse(
4339
is.na(x),

R/zzz.R

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# nocov start
2+
.onLoad <- function(...) {
3+
register_s3_method("pillar", "pillar_shaft", "blob")
4+
register_s3_method("pillar", "is_vector_s3", "blob")
5+
register_s3_method("pillar", "type_sum", "blob")
6+
register_s3_method("pillar", "obj_sum", "blob")
7+
8+
invisible()
9+
}
10+
11+
register_s3_method <- function(pkg, generic, class, fun = NULL) {
12+
stopifnot(is.character(pkg), length(pkg) == 1)
13+
stopifnot(is.character(generic), length(generic) == 1)
14+
stopifnot(is.character(class), length(class) == 1)
15+
16+
if (is.null(fun)) {
17+
fun <- get(paste0(generic, ".", class), envir = parent.frame())
18+
} else {
19+
stopifnot(is.function(fun))
20+
}
21+
22+
if (pkg %in% loadedNamespaces()) {
23+
registerS3method(generic, class, fun, envir = asNamespace(pkg))
24+
}
25+
26+
# Always register hook in case package is later unloaded & reloaded
27+
setHook(
28+
packageEvent(pkg, "onLoad"),
29+
function(...) {
30+
registerS3method(generic, class, fun, envir = asNamespace(pkg))
31+
}
32+
)
33+
}
34+
# nocov end

revdep/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.cache.rds
2+
/libs
3+
/download

revdep/drake-base.R

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
library(drake)
2+
library(tidyverse)
3+
library(glue)
4+
5+
options(repos = revdepcheck:::get_repos(TRUE))
6+
7+
get_this_pkg <- function() {
8+
desc::desc_get("Package") %>% unname()
9+
}
10+
11+
get_base_pkgs <- function() {
12+
rownames(installed.packages(priority = "base"))
13+
}
14+
15+
flatten <- . %>% unname() %>% unlist() %>% unique()
16+
17+
retry <- function(code, N = 1) {
18+
quo <- rlang::enquo(code)
19+
20+
for (i in seq_len(N)) {
21+
ret <- tryCatch(rlang::eval_tidy(quo), error = identity)
22+
if (!inherits(ret, "error")) return(ret)
23+
Sys.sleep(runif(1) * 2)
24+
}
25+
26+
stop(ret)
27+
}
28+
29+
get_plan_deps <- function() {
30+
plan_deps <- drake_plan(
31+
available = available.packages(),
32+
this_pkg = get_this_pkg(),
33+
revdeps = tools::package_dependencies(this_pkg, available, 'most', reverse = TRUE) %>% flatten(),
34+
first_level_deps = tools::package_dependencies(revdeps, available, 'most'),
35+
all_level_deps = tools::package_dependencies(first_level_deps %>% flatten(), available, recursive = TRUE),
36+
base_pkgs = get_base_pkgs(),
37+
deps = c(revdeps, first_level_deps, all_level_deps) %>% flatten() %>% tools::package_dependencies(recursive = TRUE) %>% .[!(names(.) %in% base_pkgs)],
38+
strings_in_dots = "literals"
39+
)
40+
41+
plan_deps
42+
}

0 commit comments

Comments
 (0)