From 58695e86bce7bce53bb3961a3b3fb4e78abc4fc6 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Wed, 13 Nov 2024 12:23:31 +0100 Subject: [PATCH 1/2] fix --- R/teal_data-class.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/teal_data-class.R b/R/teal_data-class.R index 85ce9e3bc..404fd72bd 100644 --- a/R/teal_data-class.R +++ b/R/teal_data-class.R @@ -107,17 +107,17 @@ code2list <- function(code) { parsed_code <- parse(text = code, keep.source = TRUE) - if (length(parsed_code)) { + code_list <- if (length(parsed_code)) { lapply(split_code(code), function(current_code) { - attr(current_code, "id") <- sample.int(.Machine$integer.max, 1) parsed_code <- parse(text = current_code, keep.source = TRUE) attr(current_code, "dependency") <- extract_dependency(parsed_code) current_code }) } else { # empty code like "", or just comments - attr(code, "id") <- sample.int(.Machine$integer.max, size = 1) attr(code, "dependency") <- extract_dependency(parsed_code) # in case comment contains @linksto tag list(code) } + names(code_list) <- sample.int(.Machine$integer.max, length(code_list)) + code_list } From 2de3416597d4b520099ba143d5c3bc0e4d95d0d3 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Wed, 13 Nov 2024 13:11:06 +0100 Subject: [PATCH 2/2] inheritSection instead of duplicated content --- R/teal_data-class.R | 9 +-------- man/teal_data-class.Rd | 12 +++++++----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/R/teal_data-class.R b/R/teal_data-class.R index 404fd72bd..966e5016c 100644 --- a/R/teal_data-class.R +++ b/R/teal_data-class.R @@ -28,14 +28,7 @@ setOldClass("join_keys") #' proven to yield contents of `@.xData`. #' Used internally. See [`verify()`] for more details. #' -#' @section Code: -#' -#' Each code element is a character representing one call. Each element has possible attributes: -#' - `warnings` (`character`) the warnings output when evaluating the code element -#' - `messages` (`character`) the messages output when evaluating the code element -#' - `id (`integer`) random identifier of the code element to make sure uniqueness when joining -#' - `dependency` (`character`) names of objects that appear in this call and gets affected by this call, -#' separated by `<-` (objects on LHS of `<-` are affected by this line, and objects on RHS are affecting this line) +#' @inheritSection teal.code::`qenv-class` Code #' #' @import teal.code #' @keywords internal diff --git a/man/teal_data-class.Rd b/man/teal_data-class.Rd index 86da5a14c..c30540a8b 100644 --- a/man/teal_data-class.Rd +++ b/man/teal_data-class.Rd @@ -39,14 +39,16 @@ Used internally. See \code{\link[=verify]{verify()}} for more details.} \section{Code}{ -Each code element is a character representing one call. Each element has possible attributes: + +Each code element is a character representing one call. Each element is named with the random +identifier to make sure uniqueness when joining. Each element has possible attributes: \itemize{ -\item \code{warnings} (\code{character}) the warnings output when evaluating the code element -\item \code{messages} (\code{character}) the messages output when evaluating the code element -\item \verb{id (}integer`) random identifier of the code element to make sure uniqueness when joining +\item \code{warnings} (\code{character}) the warnings output when evaluating the code element. +\item \code{messages} (\code{character}) the messages output when evaluating the code element. \item \code{dependency} (\code{character}) names of objects that appear in this call and gets affected by this call, -separated by \verb{<-} (objects on LHS of \verb{<-} are affected by this line, and objects on RHS are affecting this line) +separated by \verb{<-} (objects on LHS of \verb{<-} are affected by this line, and objects on RHS are affecting this line). } + } \keyword{internal}