<commit_before>#' Export stage for Syberia.
#' 
#' Precise behavior depends on adapter.
#'
#' @param modelenv an environment. The current modeling environment.
#' @param export_options a list. The available export options. Will differ
#'    depending on the adapter. (default is file adapter)
#' @export
export_stage <- function(modelenv, export_options) {
  export_options$adapter <- export_options$adapter %||% 'file'
  if (export_options$adapter == 's3') {
    require(s3mpi)
    stopifnot('file' %in% names(export_options))
    capture.output(s3store(modelenv$model_stage$model, export_options$file))
    NULL
  } else {
    stopifnot('file' %in% names(export_options))
    saveRDS(modelenv$model_stage$model, export_options$file)
  }

  if ('copy' %in% names(export_options$copy)) {
    stopifnot(is.character(export_options$copy))
    assign(export_options$copy, modelenv$model_stage$model, globalenv())
  }
  NULL<commit_msg>allow copy parameter in export stage<commit_after>#' Export stage for Syberia.
#' 
#' Precise behavior depends on adapter.
#'
#' @param modelenv an environment. The current modeling environment.
#' @param export_options a list. The available export options. Will differ
#'    depending on the adapter. (default is file adapter)
#' @export
export_stage <- function(modelenv, export_options) {
  export_options$adapter <- export_options$adapter %||% 'file'
  if (export_options$adapter == 's3') {
    require(s3mpi)
    stopifnot('file' %in% names(export_options))
    capture.output(s3store(modelenv$model_stage$model, export_options$file))
    NULL
  } else {
    stopifnot('file' %in% names(export_options))
    saveRDS(modelenv$model_stage$model, export_options$file)
  }

  if ('copy' %in% names(export_options)) {
    stopifnot(is.character(export_options$copy))
    assign(export_options$copy, modelenv$model_stage$model, globalenv())
  }
  NULL
{'fraction_non_alphanumeric': 0.12380446333687567, 'fraction_numerical': 0.003188097768331562, 'mean_word_length': 5.276666666666666, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1598022', 'n_tokens_mistral': 608, 'n_tokens_neox': 583, 'n_words': 140}