Skip to content

Commit

Permalink
strip out strcat
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed May 30, 2024
1 parent b18bd1f commit 1a8b114
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 19 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ importFrom(nanonext,set_promise_context)
importFrom(nanonext,socket)
importFrom(nanonext,stat)
importFrom(nanonext,stop_aio)
importFrom(nanonext,strcat)
importFrom(nanonext,tls_config)
importFrom(nanonext,unresolved)
importFrom(nanonext,until)
Expand Down
6 changes: 3 additions & 3 deletions R/daemons.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ daemons <- function(n, url = NULL, remote = NULL, dispatcher = TRUE, ...,
dots <- parse_dots(...)
output <- attr(dots, "output")
urld <- local_url()
urlc <- strcat(urld, "c")
urlc <- sprintf("%s%s", urld, "c")
sock <- req_socket(urld)
sockc <- req_socket(urlc)
launch_and_sync_daemon(sock, wa5(urld, dots, n, urlc, url), output, tls, pass) || stop(._[["sync_timeout"]])
Expand Down Expand Up @@ -348,7 +348,7 @@ daemons <- function(n, url = NULL, remote = NULL, dispatcher = TRUE, ...,
if (dispatcher) {
cv <- cv()
sock <- req_socket(urld)
urlc <- strcat(urld, "c")
urlc <- sprintf("%s%s", urld, "c")
sockc <- req_socket(urlc)
launch_and_sync_daemon(sock, wa4(urld, dots, envir[["stream"]], n, urlc), output) || stop(._[["sync_timeout"]])
for (i in seq_len(n)) next_stream(envir)
Expand Down Expand Up @@ -577,7 +577,7 @@ parse_dots <- function(...) {
for (dot in dots)
is.numeric(dot) || is.logical(dot) || stop(._[["wrong_dots"]])
dnames <- names(dots)
out <- strcat(",", paste(dnames, dots, sep = "=", collapse = ","))
out <- sprintf(",%s", paste(dnames, dots, sep = "=", collapse = ","))
pos <- dnames == "output"
any(pos) && as.logical(dots[pos])[1L] && return(`attr<-`(out, "output", ""))
out
Expand Down
2 changes: 1 addition & 1 deletion R/launchers.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ host_url <- function(ws = FALSE, tls = FALSE, port = 0)
#' @rdname host_url
#' @export
#'
local_url <- function() strcat(.urlscheme, random(12L))
local_url <- function() sprintf("%s%s", .urlscheme, random(12L))

#' @export
#'
Expand Down
2 changes: 1 addition & 1 deletion R/mirai-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#' @importFrom nanonext collect_aio collect_aio_ call_aio call_aio_ .context cv
#' cv_value dial is_error_value listen lock mclock msleep next_config
#' nng_error opt opt<- parse_url pipe_notify random reap recv recv_aio
#' request send set_promise_context socket stat stop_aio strcat tls_config
#' request send set_promise_context socket stat stop_aio tls_config
#' unresolved until wait write_cert
#' @importFrom stats rexp
#' @importFrom utils .DollarNames
Expand Down
4 changes: 2 additions & 2 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ print.mirai <- function(x, ...) {
#'
print.miraiError <- function(x, ...) {

cat(strcat("'miraiError' chr ", x), file = stdout())
cat(sprintf("'miraiError' chr %s", x), file = stdout())
invisible(x)

}
Expand Down Expand Up @@ -565,7 +565,7 @@ mk_mirai_error <- function(e, sc) {
msg <- if (is.null(call) || call == "eval(expr = ._mirai_.[[\".expr\"]], envir = ._mirai_., enclos = NULL)")
sprintf("Error: %s", .subset2(e, "message")) else
sprintf("Error in %s: %s", call, .subset2(e, "message"))
cat(strcat(msg, "\n"), file = stderr())
cat(sprintf("%s\n", msg), file = stderr())
idx <- which(as.logical(lapply(sc, identical, quote(eval(expr = ._mirai_.[[".expr"]], envir = ._mirai_., enclos = NULL)))))
sc <- sc[(length(sc) - 1L):(idx + 1L)]
if (sc[[1L]][[1L]] == ".handleSimpleError")
Expand Down
6 changes: 1 addition & 5 deletions R/parallel.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,7 @@ print.miraiNode <- function(x, ...) {
#' function relies on iis currently only available in R-devel (4.5).
#'
#' @examples
#' tryCatch(
#'
#' mirai::register_cluster()
#'
#' , error = identity)
#' tryCatch(mirai::register_cluster(), error = identity)
#'
#' @keywords internal
#' @export
Expand Down
6 changes: 1 addition & 5 deletions man/register_cluster.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ connection && .Platform[["OS.type"]] != "windows" && {
mirai_map(1:3, rnorm, .args = list(mean = 20, 2), .compute = "ml")[.progress]
})
nanotest(is.list(m) && length(m) == 3L && all(as.logical(lapply(m, is.numeric))))
nanotestp(mp <- mirai_map(list(x = "a"), function(...) do(...), do = nanonext::strcat, .args = list("b")))
nanotestp(mp <- mirai_map(list(x = "a"), function(...) do(...), do = function(x, y) sprintf("%s%s", x, y), .args = list("b")))
nanotesti(collect_mirai(mp)[["x"]], "ab")
nanotesti(call_mirai(mp)[["x"]][["data"]], "ab")
Sys.sleep(2.5)
Expand Down

0 comments on commit 1a8b114

Please sign in to comment.