@damurka/jovian 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +175 -0
- package/docs/api/README.md +55 -0
- package/docs/api/session.md +143 -0
- package/docs/api/types.md +120 -0
- package/docs/architecture/overview.md +218 -0
- package/docs/cpp-usage.md +60 -0
- package/docs/development.md +105 -0
- package/docs/getting-started.md +127 -0
- package/docs/guides/comms.md +70 -0
- package/docs/guides/environments.md +80 -0
- package/docs/guides/history.md +44 -0
- package/docs/guides/interactive-input.md +48 -0
- package/docs/guides/interrupting.md +45 -0
- package/docs/guides/playground.md +33 -0
- package/docs/guides/sessions-lifecycle.md +70 -0
- package/docs/kernels.md +117 -0
- package/docs/protocol.md +135 -0
- package/docs/releasing.md +73 -0
- package/docs/troubleshooting.md +110 -0
- package/lib/execution/execution-queue.d.ts +20 -0
- package/lib/execution/execution-queue.js +256 -0
- package/lib/handlers/display-handler.d.ts +7 -0
- package/lib/handlers/display-handler.js +10 -0
- package/lib/handlers/error-handler.d.ts +7 -0
- package/lib/handlers/error-handler.js +8 -0
- package/lib/handlers/result-handler.d.ts +7 -0
- package/lib/handlers/result-handler.js +10 -0
- package/lib/handlers/stream-handler.d.ts +7 -0
- package/lib/handlers/stream-handler.js +8 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +5 -0
- package/lib/messaging/message-parser.d.ts +6 -0
- package/lib/messaging/message-parser.js +33 -0
- package/lib/messaging/message-router.d.ts +14 -0
- package/lib/messaging/message-router.js +41 -0
- package/lib/middleware/index.d.ts +5 -0
- package/lib/middleware/index.js +5 -0
- package/lib/middleware/middleware-chain.d.ts +7 -0
- package/lib/middleware/middleware-chain.js +14 -0
- package/lib/middleware/middleware.d.ts +5 -0
- package/lib/middleware/middleware.js +2 -0
- package/lib/middleware/plugins/logging-plugin.d.ts +6 -0
- package/lib/middleware/plugins/logging-plugin.js +9 -0
- package/lib/middleware/plugins/metrics-plugin.d.ts +8 -0
- package/lib/middleware/plugins/metrics-plugin.js +13 -0
- package/lib/session/comm.d.ts +39 -0
- package/lib/session/comm.js +58 -0
- package/lib/session/native-paths.d.ts +48 -0
- package/lib/session/native-paths.js +108 -0
- package/lib/session/session-manager.d.ts +229 -0
- package/lib/session/session-manager.js +842 -0
- package/lib/session/supervisor-client.d.ts +36 -0
- package/lib/session/supervisor-client.js +147 -0
- package/lib/types/engine.d.ts +269 -0
- package/lib/types/engine.js +2 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +3 -0
- package/lib/types/messages.d.ts +68 -0
- package/lib/types/messages.js +2 -0
- package/lib/utils/logger.d.ts +12 -0
- package/lib/utils/logger.js +58 -0
- package/lib/utils/network.d.ts +11 -0
- package/lib/utils/network.js +50 -0
- package/package.json +57 -0
- package/packages/hera/DESCRIPTION +29 -0
- package/packages/hera/LICENSE +2 -0
- package/packages/hera/LICENSE.md +21 -0
- package/packages/hera/NAMESPACE +32 -0
- package/packages/hera/NEWS.md +7 -0
- package/packages/hera/R/cell_options.R +13 -0
- package/packages/hera/R/comm.R +228 -0
- package/packages/hera/R/completion.R +54 -0
- package/packages/hera/R/execute.R +199 -0
- package/packages/hera/R/inspect.R +73 -0
- package/packages/hera/R/log.R +14 -0
- package/packages/hera/R/mime_bundle.R +65 -0
- package/packages/hera/R/routines.R +86 -0
- package/packages/hera/R/utils.R +32 -0
- package/packages/hera/R/zzz.R +128 -0
- package/packages/hera/man/Comm.Rd +179 -0
- package/packages/hera/man/CommManager.Rd +215 -0
- package/packages/hera/man/View.Rd +22 -0
- package/packages/hera/man/cell_options.Rd +20 -0
- package/packages/hera/man/clear_output.Rd +23 -0
- package/packages/hera/man/complete.Rd +23 -0
- package/packages/hera/man/display_data.Rd +22 -0
- package/packages/hera/man/is_elara.Rd +18 -0
- package/packages/hera/man/mime_bundle.Rd +25 -0
- package/packages/hera/man/mime_types.Rd +22 -0
- package/packages/hera/man/reexports.Rd +16 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
inspect <- function(code, cursor_pos, eval_env = rlang::global_env()) {
|
|
2
|
+
# This is the approach used in IRkernel, it would perhaps
|
|
3
|
+
# be better to use parsing instead, e.g. with the internal R
|
|
4
|
+
# parser, but the expression has to be complete, or a more
|
|
5
|
+
# forgiving parser, e.g. tree-sitter and the grammar for R:
|
|
6
|
+
# https://github.com/r-lib/tree-sitter-r/tree/next
|
|
7
|
+
|
|
8
|
+
# Get token under the `cursor_pos`.
|
|
9
|
+
# Since `.guessTokenFromLine()` does not check the characters after `cursor_pos`
|
|
10
|
+
# check them by a loop. Use get since R CMD check does not like :::
|
|
11
|
+
token <- ''
|
|
12
|
+
for (i in seq(cursor_pos, nchar(code))) {
|
|
13
|
+
token_candidate <- utils___guessTokenFromLine(code, i)
|
|
14
|
+
if (nchar(token_candidate) == 0) break
|
|
15
|
+
token <- token_candidate
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# Function to add a section to content.
|
|
19
|
+
title_templates <- list(
|
|
20
|
+
'text/plain' = '# %s:\n',
|
|
21
|
+
'text/html' = '<h1>%s:</h1>\n'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
add_new_section <- function(data, section_name, new_data) {
|
|
25
|
+
for (mime in names(title_templates)) {
|
|
26
|
+
new_content <- new_data[[mime]]
|
|
27
|
+
if (is.null(new_content)) next
|
|
28
|
+
title <- sprintf(title_templates[[mime]], section_name)
|
|
29
|
+
# use paste0 since sprintf cannot deal with format strings > 8192 bytes
|
|
30
|
+
data[[mime]] <- paste0(data[[mime]], title, new_content, '\n', sep = '\n')
|
|
31
|
+
}
|
|
32
|
+
return(data)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
data <- namedlist()
|
|
36
|
+
if (nchar(token) != 0) {
|
|
37
|
+
# In many cases `get(token)` works, but it does not
|
|
38
|
+
# in the cases such as `token` is a numeric constant or a reserved word.
|
|
39
|
+
# Therefore `eval()` is used here.
|
|
40
|
+
obj <- tryCatch(eval(parse(text = token), envir = eval_env), error = function(e) NULL)
|
|
41
|
+
class_data <- if (!is.null(obj)) IRdisplay::prepare_mimebundle(class(obj))$data
|
|
42
|
+
print_data <- if (!is.null(obj)) IRdisplay::prepare_mimebundle(obj)$data
|
|
43
|
+
|
|
44
|
+
# `help(token)` is not used here because it does not works
|
|
45
|
+
# in the cases `token` is in `pkg::topic`or `pkg:::topic` form.
|
|
46
|
+
help_data <- tryCatch({
|
|
47
|
+
help_obj <- eval(parse(text = paste0('?', token)))
|
|
48
|
+
if (length(help_obj) > 0) {
|
|
49
|
+
IRdisplay::prepare_mimebundle(help_obj)$data
|
|
50
|
+
}
|
|
51
|
+
}, error = function(e) NULL)
|
|
52
|
+
|
|
53
|
+
# only show help if we have a function
|
|
54
|
+
if ('function' %in% class(obj) && !is.null(help_data)) {
|
|
55
|
+
data <- help_data
|
|
56
|
+
} else {
|
|
57
|
+
# any of those that are NULL are automatically skipped
|
|
58
|
+
data <- add_new_section(data, 'Class attribute', class_data)
|
|
59
|
+
data <- add_new_section(data, 'Printed form', print_data)
|
|
60
|
+
data <- add_new_section(data, 'Help document', help_data)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (mime in names(data)) {
|
|
65
|
+
data[[mime]] <- unbox(data[[mime]])
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
list(found = length(data) > 0L,
|
|
69
|
+
# data = toJSON(data, auto_unbox = TRUE),
|
|
70
|
+
data = enc2utf8(toJSON(data, auto_unbox = TRUE)),
|
|
71
|
+
metadata = NULL
|
|
72
|
+
)
|
|
73
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
logger <- function(level, name) {
|
|
3
|
+
function(...) {
|
|
4
|
+
if (isTRUE(getOption('jupyter.log_level') >= level)) {
|
|
5
|
+
msg <- glue(...)
|
|
6
|
+
hera_dot_call("elara_log", name, msg)
|
|
7
|
+
}
|
|
8
|
+
invisible(NULL)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
log_debug <- logger(3L, 'DEBUG')
|
|
13
|
+
log_info <- logger(2L, 'INFO')
|
|
14
|
+
log_error <- logger(1L, 'ERROR')
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#' MIME types supported by an object
|
|
2
|
+
#'
|
|
3
|
+
#' @param x an object
|
|
4
|
+
#'
|
|
5
|
+
#' @examples
|
|
6
|
+
#' mime_types(letters)
|
|
7
|
+
#' mime_types(mtcars)
|
|
8
|
+
#'
|
|
9
|
+
#' @return a character vector of its supported mime types
|
|
10
|
+
#' @export
|
|
11
|
+
mime_types <- function(x) {
|
|
12
|
+
UseMethod("mime_types")
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#' @export
|
|
16
|
+
mime_types.default <- function(x) {
|
|
17
|
+
"text/plain"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#' @export
|
|
21
|
+
mime_types.htmlwidget <- function(x) {
|
|
22
|
+
c("text/plain", "text/html")
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#' @export
|
|
26
|
+
mime_types.shiny.tag.list <- function(x) {
|
|
27
|
+
c("text/plain", "text/html")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#' @export
|
|
31
|
+
mime_types.shiny.tag <- function(x) {
|
|
32
|
+
c("text/plain", "text/html")
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# R help objects. Without this, mime_types.default returns "text/plain", which
|
|
36
|
+
# repr::repr_text renders via tools::Rd2txt. Rd2txt emits nroff overstrike
|
|
37
|
+
# ("_\bX" underline, "X\bX" bold), and Jupyter's stdout stream does not
|
|
38
|
+
# interpret backspaces, so ?lm displays raw "_ l_ m" garbage. Advertising
|
|
39
|
+
# text/html lets the frontend pick the HTML rendering instead.
|
|
40
|
+
#' @export
|
|
41
|
+
mime_types.help_files_with_topic <- function(x) {
|
|
42
|
+
c("text/plain", "text/html")
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#' bundle an object
|
|
46
|
+
#'
|
|
47
|
+
#' @param x an object
|
|
48
|
+
#' @param mimetypes mime types
|
|
49
|
+
#' @param ... extra currently unused parameters
|
|
50
|
+
#'
|
|
51
|
+
#' @examples
|
|
52
|
+
#' mime_bundle(letters)
|
|
53
|
+
#'
|
|
54
|
+
#' @seealso IRdisplay::prepare_mimebundle which this currently wraps around
|
|
55
|
+
#'
|
|
56
|
+
#' @export
|
|
57
|
+
mime_bundle <- function(x, mimetypes = mime_types(x), ...) {
|
|
58
|
+
UseMethod("mime_bundle")
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#' @importFrom IRdisplay prepare_mimebundle
|
|
62
|
+
#' @export
|
|
63
|
+
mime_bundle.default <- function(x, mimetypes = mime_types(x), ...) {
|
|
64
|
+
prepare_mimebundle(x, mimetypes = mimetypes, ...)
|
|
65
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
publish_stream <- function(name, text) {
|
|
2
|
+
hera_dot_call("elara_publish_stream", name, text)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
# jsonlite::toJSON() base64-encodes raw vectors (e.g. plot image bytes) via
|
|
6
|
+
# jsonlite::base64_enc(), which always MIME-wraps its output with embedded
|
|
7
|
+
# newlines and offers no argument to disable it. Those newlines survive
|
|
8
|
+
# JSON string-escaping as literal "\n" sequences and, once unescaped by a
|
|
9
|
+
# downstream JSON parser, produce a base64 payload containing real newline
|
|
10
|
+
# characters -- which a strict (non-whitespace-tolerant) base64 decoder on
|
|
11
|
+
# the receiving end will reject. Recursively re-encode any raw elements
|
|
12
|
+
# with jsonlite's own encoder and strip the wrapping newlines before they
|
|
13
|
+
# ever reach toJSON(), so raw data becomes a plain, unwrapped base64 string.
|
|
14
|
+
sanitize_raw_for_json <- function(x) {
|
|
15
|
+
if (is.raw(x)) {
|
|
16
|
+
gsub("\n", "", jsonlite::base64_enc(x), fixed = TRUE)
|
|
17
|
+
} else if (is.list(x)) {
|
|
18
|
+
lapply(x, sanitize_raw_for_json)
|
|
19
|
+
} else {
|
|
20
|
+
x
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#' Display data
|
|
25
|
+
#'
|
|
26
|
+
#' @param data data to display
|
|
27
|
+
#' @param metadata potential metadata
|
|
28
|
+
#'
|
|
29
|
+
#' @examples
|
|
30
|
+
#' \dontrun{
|
|
31
|
+
#' display_data(mtcars)
|
|
32
|
+
#' }
|
|
33
|
+
#'
|
|
34
|
+
#' @export
|
|
35
|
+
display_data <- function(data = NULL, metadata = NULL) {
|
|
36
|
+
invisible(hera_dot_call("elara_display_data",
|
|
37
|
+
enc2utf8(toJSON(sanitize_raw_for_json(data), auto_unbox = TRUE)),
|
|
38
|
+
enc2utf8(toJSON(metadata, auto_unbox = TRUE))))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
update_display_data <- function(data = NULL, metadata = NULL) {
|
|
42
|
+
invisible(hera_dot_call("elara_update_display_data",
|
|
43
|
+
enc2utf8(toJSON(sanitize_raw_for_json(data), auto_unbox = TRUE)),
|
|
44
|
+
enc2utf8(toJSON(metadata, auto_unbox = TRUE))))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
kernel_info_request <- function() {
|
|
48
|
+
hera_dot_call("elara_kernel_info_request")
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
#' Clear output
|
|
53
|
+
#'
|
|
54
|
+
#' @param wait Should this wait
|
|
55
|
+
#'
|
|
56
|
+
#' @examples
|
|
57
|
+
#' \dontrun{
|
|
58
|
+
#' clear_output()
|
|
59
|
+
#' }
|
|
60
|
+
#'
|
|
61
|
+
#' @return NULL invisibly
|
|
62
|
+
#' @export
|
|
63
|
+
clear_output <- function(wait = FALSE) {
|
|
64
|
+
invisible(hera_dot_call("elara_clear_output", isTRUE(wait)))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
is_complete_request <- function(code) {
|
|
68
|
+
hera_dot_call("elara_is_complete_request", code)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#' View
|
|
72
|
+
#'
|
|
73
|
+
#' @param x something to display
|
|
74
|
+
#' @param title title of the display
|
|
75
|
+
#'
|
|
76
|
+
#' @examples
|
|
77
|
+
#' \dontrun{
|
|
78
|
+
#' View(mtcars)
|
|
79
|
+
#' }
|
|
80
|
+
#'
|
|
81
|
+
#' @export
|
|
82
|
+
View <- function(x, title) {
|
|
83
|
+
if (!missing(title)) IRdisplay::display_text(title)
|
|
84
|
+
IRdisplay::display(x)
|
|
85
|
+
invisible(x)
|
|
86
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# borrowed from IRkernel
|
|
2
|
+
get_os <- function() {
|
|
3
|
+
switch(.Platform$OS.type,
|
|
4
|
+
windows = 'win',
|
|
5
|
+
unix = if (identical(Sys.info()[['sysname']], 'Darwin')) 'osx'
|
|
6
|
+
else 'unix'
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
namedlist <- function() {
|
|
11
|
+
`names<-`(list(), character())
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
set_last_value <- function(obj, visible) {
|
|
15
|
+
the$last_visible <- visible
|
|
16
|
+
|
|
17
|
+
get("unlockBinding", envir = baseenv())(".Last.value", .BaseNamespaceEnv)
|
|
18
|
+
assign(".Last.value", obj, .BaseNamespaceEnv)
|
|
19
|
+
get("lockBinding", envir = baseenv())(".Last.value", .BaseNamespaceEnv)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# borrowed from IRkernel
|
|
23
|
+
plot_builds_upon <- function(prev, current) {
|
|
24
|
+
if (is.null(prev)) {
|
|
25
|
+
return(TRUE)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
lprev <- length(prev[[1]])
|
|
29
|
+
lcurrent <- length(current[[1]])
|
|
30
|
+
|
|
31
|
+
lcurrent >= lprev && identical(current[[1]][1:lprev], prev[[1]][1:lprev])
|
|
32
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#' @importFrom grDevices pdf png
|
|
2
|
+
#' @importFrom jsonlite toJSON unbox fromJSON
|
|
3
|
+
#' @importFrom utils head tail capture.output
|
|
4
|
+
#' @importFrom R6 R6Class
|
|
5
|
+
#' @importFrom rlang caller_env
|
|
6
|
+
#' @import glue
|
|
7
|
+
NULL
|
|
8
|
+
|
|
9
|
+
print_vignette <- function(x, ...) {
|
|
10
|
+
file <- x$PDF
|
|
11
|
+
if (nzchar(file) == 0) {
|
|
12
|
+
warning(gettextf("vignette %s has no PDF/HTML", sQuote(x$Topic)), call. = FALSE, domain = NA)
|
|
13
|
+
return(invisible(x))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
ext <- tolower(tools::file_ext(file))
|
|
17
|
+
if (ext == "pdf") {
|
|
18
|
+
warning("can't display pdf vignette yet")
|
|
19
|
+
return(invisible(x))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (ext == "html") {
|
|
23
|
+
html <- readLines(file.path(x$Dir, "doc", file))
|
|
24
|
+
|
|
25
|
+
display_data(
|
|
26
|
+
data = list(
|
|
27
|
+
"text/html" = paste(html, collapse = "\n")
|
|
28
|
+
),
|
|
29
|
+
metadata = list(
|
|
30
|
+
"text/html" = list(isolated = TRUE)
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
invisible(x)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
NAMESPACE <- environment()
|
|
39
|
+
the <- NULL
|
|
40
|
+
|
|
41
|
+
.onLoad <- function(libname, pkgname) {
|
|
42
|
+
# Elara verification/handshake now happens via is_elara()/hera_dot_call()
|
|
43
|
+
# below, not here -- this used to be a bare TODO for that, predating
|
|
44
|
+
# those functions.
|
|
45
|
+
NAMESPACE$the <- new.env()
|
|
46
|
+
the$frame_cell_execute <- NULL
|
|
47
|
+
the$last_plot <- NULL
|
|
48
|
+
the$last_visible <- TRUE
|
|
49
|
+
the$last_error <- NULL
|
|
50
|
+
|
|
51
|
+
ns_utils <- asNamespace("utils")
|
|
52
|
+
get("unlockBinding", envir = baseenv())("print.vignette", ns_utils)
|
|
53
|
+
|
|
54
|
+
assign("print.vignette", print_vignette, ns_utils)
|
|
55
|
+
get("lockBinding", envir = baseenv())("print.vignette", ns_utils)
|
|
56
|
+
|
|
57
|
+
NAMESPACE$CommManager <- CommManagerClass$new()
|
|
58
|
+
|
|
59
|
+
init_options()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
init_options <- function() {
|
|
63
|
+
options(
|
|
64
|
+
device = get_null_device(),
|
|
65
|
+
cli.num_colors = 256L,
|
|
66
|
+
jupyter.plot_mimetypes = c('text/plain', 'image/png'),
|
|
67
|
+
jupyter.plot_scale = 2,
|
|
68
|
+
|
|
69
|
+
jupyter.rich_display = TRUE,
|
|
70
|
+
jupyter.base_display_func = display_data,
|
|
71
|
+
jupyter.clear_output_func = clear_output
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
repos <- getOption('repos')
|
|
75
|
+
if (identical(repos, c(CRAN = '@CRAN@'))) {
|
|
76
|
+
repos[['CRAN']] <- 'https://cran.r-project.org'
|
|
77
|
+
options(repos = repos)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
NAMESPACE <- environment()
|
|
82
|
+
hera_call <- function(fn, ...) {
|
|
83
|
+
get(fn, envir = NAMESPACE)(...)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
hera_new <- function(class, xp, ...) {
|
|
87
|
+
get(class, envir = NAMESPACE)$new(xp, ...)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#' Is this a running Elara jupyter kernel
|
|
91
|
+
#'
|
|
92
|
+
#' @return TRUE if the current session is running in an Elara kernel
|
|
93
|
+
#'
|
|
94
|
+
#' @examples
|
|
95
|
+
#' is_elara()
|
|
96
|
+
#'
|
|
97
|
+
#' @export
|
|
98
|
+
is_elara <- function() {
|
|
99
|
+
embedding <- getLoadedDLLs()[["(embedding)"]]
|
|
100
|
+
!is.null(embedding) && "elara_kernel_info_request" %in% names(getDLLRegisteredRoutines(embedding)$.Call)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
hera_dot_call <- function(fn, ..., error_call = caller_env()) {
|
|
104
|
+
call <- rlang::call2(".Call", fn, ..., PACKAGE = "(embedding)")
|
|
105
|
+
|
|
106
|
+
if (!is_elara()) {
|
|
107
|
+
cli::cli_abort(c(
|
|
108
|
+
"The {.val {fn}} routine must be called inside an Elara kernel.",
|
|
109
|
+
i = "Full internal call to the Elara routine:",
|
|
110
|
+
" " = "{deparse(call)}"
|
|
111
|
+
), call = error_call)
|
|
112
|
+
}
|
|
113
|
+
eval.parent(call)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get_null_device <- function() {
|
|
117
|
+
os <- get_os()
|
|
118
|
+
|
|
119
|
+
ok_device <- switch(os, win = png, osx = pdf, unix = png)
|
|
120
|
+
null_filename <- switch(os, win = 'NUL', osx = NULL, unix = '/dev/null')
|
|
121
|
+
|
|
122
|
+
null_device <- function(filename = null_filename, ...) ok_device(filename, ...)
|
|
123
|
+
null_device
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#' @importFrom IRdisplay display
|
|
127
|
+
#' @export
|
|
128
|
+
IRdisplay::display
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
% Generated by roxygen2: do not edit by hand
|
|
2
|
+
% Please edit documentation in R/comm.R
|
|
3
|
+
\name{Comm}
|
|
4
|
+
\alias{Comm}
|
|
5
|
+
\title{Comm class}
|
|
6
|
+
\description{
|
|
7
|
+
Comm class
|
|
8
|
+
}
|
|
9
|
+
\section{Active bindings}{
|
|
10
|
+
\if{html}{\out{<div class="r6-active-bindings">}}
|
|
11
|
+
\describe{
|
|
12
|
+
\item{\code{id}}{id of the comm. read only.}
|
|
13
|
+
|
|
14
|
+
\item{\code{target_name}}{name of the target for this comm}
|
|
15
|
+
}
|
|
16
|
+
\if{html}{\out{</div>}}
|
|
17
|
+
}
|
|
18
|
+
\section{Methods}{
|
|
19
|
+
\subsection{Public methods}{
|
|
20
|
+
\itemize{
|
|
21
|
+
\item \href{#method-Comm-initialize}{\code{Comm$new()}}
|
|
22
|
+
\item \href{#method-Comm-open}{\code{Comm$open()}}
|
|
23
|
+
\item \href{#method-Comm-close}{\code{Comm$close()}}
|
|
24
|
+
\item \href{#method-Comm-send}{\code{Comm$send()}}
|
|
25
|
+
\item \href{#method-Comm-on_close}{\code{Comm$on_close()}}
|
|
26
|
+
\item \href{#method-Comm-on_message}{\code{Comm$on_message()}}
|
|
27
|
+
\item \href{#method-Comm-print}{\code{Comm$print()}}
|
|
28
|
+
\item \href{#method-Comm-clone}{\code{Comm$clone()}}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
\if{html}{\out{<hr>}}
|
|
32
|
+
\if{html}{\out{<a id="method-Comm-initialize"></a>}}
|
|
33
|
+
\if{latex}{\out{\hypertarget{method-Comm-initialize}{}}}
|
|
34
|
+
\subsection{\code{Comm$new()}}{
|
|
35
|
+
\subsection{Usage}{
|
|
36
|
+
\if{html}{\out{<div class="r">}}
|
|
37
|
+
\preformatted{Comm$new(xp, description = "")}
|
|
38
|
+
\if{html}{\out{</div>}}
|
|
39
|
+
}
|
|
40
|
+
\subsection{Arguments}{
|
|
41
|
+
\if{html}{\out{<div class="arguments">}}
|
|
42
|
+
\describe{
|
|
43
|
+
\item{\code{xp}}{external pointer to an instance of the C++ class 'adrastea::Comm'}
|
|
44
|
+
\item{\code{description}}{description of this comm}
|
|
45
|
+
}
|
|
46
|
+
\if{html}{\out{</div>}}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
\if{html}{\out{<hr>}}
|
|
51
|
+
\if{html}{\out{<a id="method-Comm-open"></a>}}
|
|
52
|
+
\if{latex}{\out{\hypertarget{method-Comm-open}{}}}
|
|
53
|
+
\subsection{\code{Comm$open()}}{
|
|
54
|
+
\subsection{Usage}{
|
|
55
|
+
\if{html}{\out{<div class="r">}}
|
|
56
|
+
\preformatted{Comm$open(data = NULL, metadata = NULL, buffers = list())}
|
|
57
|
+
\if{html}{\out{</div>}}
|
|
58
|
+
}
|
|
59
|
+
\subsection{Arguments}{
|
|
60
|
+
\if{html}{\out{<div class="arguments">}}
|
|
61
|
+
\describe{
|
|
62
|
+
\item{\code{data}}{data}
|
|
63
|
+
\item{\code{metadata}}{metadata}
|
|
64
|
+
\item{\code{buffers}}{list of raw vectors to send as binary buffers}
|
|
65
|
+
}
|
|
66
|
+
\if{html}{\out{</div>}}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
\if{html}{\out{<hr>}}
|
|
71
|
+
\if{html}{\out{<a id="method-Comm-close"></a>}}
|
|
72
|
+
\if{latex}{\out{\hypertarget{method-Comm-close}{}}}
|
|
73
|
+
\subsection{\code{Comm$close()}}{
|
|
74
|
+
\subsection{Usage}{
|
|
75
|
+
\if{html}{\out{<div class="r">}}
|
|
76
|
+
\preformatted{Comm$close(data = NULL, metadata = NULL, buffers = list())}
|
|
77
|
+
\if{html}{\out{</div>}}
|
|
78
|
+
}
|
|
79
|
+
\subsection{Arguments}{
|
|
80
|
+
\if{html}{\out{<div class="arguments">}}
|
|
81
|
+
\describe{
|
|
82
|
+
\item{\code{data}}{data}
|
|
83
|
+
\item{\code{metadata}}{metadata}
|
|
84
|
+
\item{\code{buffers}}{list of raw vectors to send as binary buffers}
|
|
85
|
+
}
|
|
86
|
+
\if{html}{\out{</div>}}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
\if{html}{\out{<hr>}}
|
|
91
|
+
\if{html}{\out{<a id="method-Comm-send"></a>}}
|
|
92
|
+
\if{latex}{\out{\hypertarget{method-Comm-send}{}}}
|
|
93
|
+
\subsection{\code{Comm$send()}}{
|
|
94
|
+
\subsection{Usage}{
|
|
95
|
+
\if{html}{\out{<div class="r">}}
|
|
96
|
+
\preformatted{Comm$send(data = NULL, metadata = NULL, buffers = list())}
|
|
97
|
+
\if{html}{\out{</div>}}
|
|
98
|
+
}
|
|
99
|
+
\subsection{Arguments}{
|
|
100
|
+
\if{html}{\out{<div class="arguments">}}
|
|
101
|
+
\describe{
|
|
102
|
+
\item{\code{data}}{data}
|
|
103
|
+
\item{\code{metadata}}{metadata}
|
|
104
|
+
\item{\code{buffers}}{list of raw vectors to send as binary buffers}
|
|
105
|
+
}
|
|
106
|
+
\if{html}{\out{</div>}}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
\if{html}{\out{<hr>}}
|
|
111
|
+
\if{html}{\out{<a id="method-Comm-on_close"></a>}}
|
|
112
|
+
\if{latex}{\out{\hypertarget{method-Comm-on_close}{}}}
|
|
113
|
+
\subsection{\code{Comm$on_close()}}{
|
|
114
|
+
\subsection{Usage}{
|
|
115
|
+
\if{html}{\out{<div class="r">}}
|
|
116
|
+
\preformatted{Comm$on_close(handler)}
|
|
117
|
+
\if{html}{\out{</div>}}
|
|
118
|
+
}
|
|
119
|
+
\subsection{Arguments}{
|
|
120
|
+
\if{html}{\out{<div class="arguments">}}
|
|
121
|
+
\describe{
|
|
122
|
+
\item{\code{handler}}{function to call when the comm is closed}
|
|
123
|
+
}
|
|
124
|
+
\if{html}{\out{</div>}}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
\if{html}{\out{<hr>}}
|
|
129
|
+
\if{html}{\out{<a id="method-Comm-on_message"></a>}}
|
|
130
|
+
\if{latex}{\out{\hypertarget{method-Comm-on_message}{}}}
|
|
131
|
+
\subsection{\code{Comm$on_message()}}{
|
|
132
|
+
\subsection{Usage}{
|
|
133
|
+
\if{html}{\out{<div class="r">}}
|
|
134
|
+
\preformatted{Comm$on_message(handler)}
|
|
135
|
+
\if{html}{\out{</div>}}
|
|
136
|
+
}
|
|
137
|
+
\subsection{Arguments}{
|
|
138
|
+
\if{html}{\out{<div class="arguments">}}
|
|
139
|
+
\describe{
|
|
140
|
+
\item{\code{handler}}{function to call when receiving a message}
|
|
141
|
+
}
|
|
142
|
+
\if{html}{\out{</div>}}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
\if{html}{\out{<hr>}}
|
|
147
|
+
\if{html}{\out{<a id="method-Comm-print"></a>}}
|
|
148
|
+
\if{latex}{\out{\hypertarget{method-Comm-print}{}}}
|
|
149
|
+
\subsection{\code{Comm$print()}}{
|
|
150
|
+
\subsection{Usage}{
|
|
151
|
+
\if{html}{\out{<div class="r">}}
|
|
152
|
+
\preformatted{Comm$print()}
|
|
153
|
+
\if{html}{\out{</div>}}
|
|
154
|
+
}
|
|
155
|
+
\subsection{Returns}{
|
|
156
|
+
information about the comm
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
\if{html}{\out{<hr>}}
|
|
161
|
+
\if{html}{\out{<a id="method-Comm-clone"></a>}}
|
|
162
|
+
\if{latex}{\out{\hypertarget{method-Comm-clone}{}}}
|
|
163
|
+
\subsection{\code{Comm$clone()}}{
|
|
164
|
+
The objects of this class are cloneable with this method.
|
|
165
|
+
\subsection{Usage}{
|
|
166
|
+
\if{html}{\out{<div class="r">}}
|
|
167
|
+
\preformatted{Comm$clone(deep = FALSE)}
|
|
168
|
+
\if{html}{\out{</div>}}
|
|
169
|
+
}
|
|
170
|
+
\subsection{Arguments}{
|
|
171
|
+
\if{html}{\out{<div class="arguments">}}
|
|
172
|
+
\describe{
|
|
173
|
+
\item{\code{deep}}{Whether to make a deep clone.}
|
|
174
|
+
}
|
|
175
|
+
\if{html}{\out{</div>}}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
}
|