From 4b3db37e5991362513148ed25fbdce23f76d4532 Mon Sep 17 00:00:00 2001 From: Mark Keller <7525285+keller-mark@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:43:49 -0400 Subject: [PATCH] importFrom for %dopar%; update docs --- NAMESPACE | 9 ++------- R/numcodecs.R | 10 ++++------ R/options.R | 4 +--- R/stores.R | 1 - R/zarr-array.R | 2 +- man/ZarrArray.Rd | 8 +++++++- man/as_scalar.Rd | 4 +++- man/ensure_integer_vec.Rd | 14 ++++++++++++++ man/ensure_list.Rd | 14 ++++++++++++++ man/is_integer.Rd | 12 ++++++++++++ man/is_integer_list.Rd | 12 ++++++++++++ man/is_integer_scalar.Rd | 12 ++++++++++++ man/is_integer_vec.Rd | 14 ++++++++++++++ man/is_scalar.Rd | 4 ++-- man/pizzarr_option_defaults.Rd | 16 ++++++++++++++++ man/zb_slice.Rd | 4 ++-- 16 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 man/ensure_integer_vec.Rd create mode 100644 man/ensure_list.Rd create mode 100644 man/is_integer.Rd create mode 100644 man/is_integer_list.Rd create mode 100644 man/is_integer_scalar.Rd create mode 100644 man/is_integer_vec.Rd create mode 100644 man/pizzarr_option_defaults.Rd diff --git a/NAMESPACE b/NAMESPACE index b2ba27d..96c7983 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -27,6 +27,7 @@ export(is_key_error) export(is_scalar) export(is_slice) export(obj_list) +export(pizzarr_option_defaults) export(pizzarr_sample) export(slice) export(zarr_create) @@ -39,10 +40,4 @@ export(zarr_open_array) export(zarr_open_group) export(zarr_save_array) export(zb_slice) -importFrom(R6,R6Class) -importFrom(memoise,memoise) -importFrom(memoise,timeout) -importFrom(qs,lz4_compress_raw) -importFrom(qs,lz4_decompress_raw) -importFrom(qs,zstd_compress_raw) -importFrom(qs,zstd_decompress_raw) +importFrom(foreach,"%dopar%") diff --git a/R/numcodecs.R b/R/numcodecs.R index d39e6b6..99e1845 100644 --- a/R/numcodecs.R +++ b/R/numcodecs.R @@ -36,7 +36,6 @@ Codec <- R6::R6Class("Codec", #' ZSTD compressor for Zarr #' @title ZstdCodec Class #' @docType class -#' @importFrom qs zstd_compress_raw zstd_decompress_raw #' @description #' Class representing a ZSTD compressor @@ -62,7 +61,7 @@ ZstdCodec <- R6::R6Class("ZstdCodec", #' @return Compressed data. encode = function(buf, zarr_arr) { # Reference: https://github.com/traversc/qs/blob/84e30f4/R/RcppExports.R#L16 - result <- zstd_compress_raw(buf, self$level) + result <- qs::zstd_compress_raw(buf, self$level) return(result) }, #' @description @@ -71,7 +70,7 @@ ZstdCodec <- R6::R6Class("ZstdCodec", #' @param zarr_arr The ZarrArray instance. #' @return Un-compressed data. decode = function(buf, zarr_arr) { - result <- zstd_decompress_raw(buf) + result <- qs::zstd_decompress_raw(buf) return(result) }, #' @description @@ -89,7 +88,6 @@ ZstdCodec <- R6::R6Class("ZstdCodec", #' LZ4 compressor for Zarr #' @title Lz4Codec Class #' @docType class -#' @importFrom qs lz4_compress_raw lz4_decompress_raw #' @description #' Class representing a LZ4 compressor #' @@ -115,7 +113,7 @@ Lz4Codec <- R6::R6Class("Lz4Codec", #' @return Compressed data. encode = function(buf, zarr_arr) { # Reference: https://github.com/traversc/qs/blob/84e30f4/R/RcppExports.R#L24 - body <- lz4_compress_raw(buf, self$acceleration) + body <- qs::lz4_compress_raw(buf, self$acceleration) # The compressed output includes a 4-byte header storing the original size # of the decompressed data as a little-endian 32-bit integer. @@ -135,7 +133,7 @@ Lz4Codec <- R6::R6Class("Lz4Codec", decode = function(buf, zarr_arr) { body <- buf[5:length(buf)] - result <- lz4_decompress_raw(body) + result <- qs::lz4_decompress_raw(body) return(result) }, #' @description diff --git a/R/options.R b/R/options.R index 3e648a4..9612521 100644 --- a/R/options.R +++ b/R/options.R @@ -1,9 +1,6 @@ # Adapted from https://github.com/IRkernel/IRkernel/blob/master/R/options.r -#' @usage #' pizzarr_option_defaults -#' -#' @rdname pizzarr-package #' @export pizzarr_option_defaults <- list( pizzarr.http_store_cache_time_seconds = 3600, @@ -11,6 +8,7 @@ pizzarr_option_defaults <- list( pizzarr.parallel_write_enabled = FALSE ) +#' @keywords internal from_env <- list( PIZZARR_HTTP_STORE_CACHE_TIME_SECONDS = as.integer, PIZZARR_PARALLEL_READ_ENABLED = as.logical, diff --git a/R/stores.R b/R/stores.R index 052628f..80523ba 100644 --- a/R/stores.R +++ b/R/stores.R @@ -346,7 +346,6 @@ MemoryStore <- R6::R6Class("MemoryStore", #' HttpStore for Zarr #' @title HttpStore Class #' @docType class -#' @importFrom memoise memoise timeout #' @description #' Store class that uses HTTP requests. #' Read-only. Depends on the `crul` package. diff --git a/R/zarr-array.R b/R/zarr-array.R index 9533c07..f015e60 100644 --- a/R/zarr-array.R +++ b/R/zarr-array.R @@ -3,7 +3,7 @@ #' The Zarr Array class. #' @title ZarrArray Class #' @docType class -#' @importFrom R6 R6Class +#' @importFrom foreach %dopar% #' @description #' Instantiate an array from an initialized store. #' @param selection Selections are lists containing either scalars, strings, or Slice objects. Two character diff --git a/man/ZarrArray.Rd b/man/ZarrArray.Rd index df4d60f..9b69386 100644 --- a/man/ZarrArray.Rd +++ b/man/ZarrArray.Rd @@ -221,7 +221,13 @@ TODO TODO -TODO +For parallel usage + + +For parallel usage + + +For non-parallel usage TODO diff --git a/man/as_scalar.Rd b/man/as_scalar.Rd index 1708c1d..3f4a75d 100644 --- a/man/as_scalar.Rd +++ b/man/as_scalar.Rd @@ -2,7 +2,8 @@ % Please edit documentation in R/atomic.R \name{as_scalar} \alias{as_scalar} -\title{Convert a value to a scalar to opt-out of R default vector casting behavior.} +\title{Convert a value to a scalar to opt-out of R default vector casting behavior. +This uses the \code{jsonlite::unbox} function to "tag" the value as a scalar.} \usage{ as_scalar(obj) } @@ -14,4 +15,5 @@ The value wrapped as a scalar. } \description{ Convert a value to a scalar to opt-out of R default vector casting behavior. +This uses the \code{jsonlite::unbox} function to "tag" the value as a scalar. } diff --git a/man/ensure_integer_vec.Rd b/man/ensure_integer_vec.Rd new file mode 100644 index 0000000..752e1c8 --- /dev/null +++ b/man/ensure_integer_vec.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/atomic.R +\name{ensure_integer_vec} +\alias{ensure_integer_vec} +\title{Ensure that scalars and lists of integers are converted to +an R vector of integers.} +\usage{ +ensure_integer_vec(selection) +} +\description{ +Ensure that scalars and lists of integers are converted to +an R vector of integers. +} +\keyword{internal} diff --git a/man/ensure_list.Rd b/man/ensure_list.Rd new file mode 100644 index 0000000..ef1875d --- /dev/null +++ b/man/ensure_list.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/atomic.R +\name{ensure_list} +\alias{ensure_list} +\title{Ensure that scalars, single slices, and R integer vectors are converted +to a list containing either R integer vectors or slice instances as values.} +\usage{ +ensure_list(selection) +} +\description{ +Ensure that scalars, single slices, and R integer vectors are converted +to a list containing either R integer vectors or slice instances as values. +} +\keyword{internal} diff --git a/man/is_integer.Rd b/man/is_integer.Rd new file mode 100644 index 0000000..94d726c --- /dev/null +++ b/man/is_integer.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/atomic.R +\name{is_integer} +\alias{is_integer} +\title{Check if a value is an integer R vector or scalar.} +\usage{ +is_integer(s) +} +\description{ +Check if a value is an integer R vector or scalar. +} +\keyword{internal} diff --git a/man/is_integer_list.Rd b/man/is_integer_list.Rd new file mode 100644 index 0000000..54be216 --- /dev/null +++ b/man/is_integer_list.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/atomic.R +\name{is_integer_list} +\alias{is_integer_list} +\title{Check that a value is a list of one or more integers.} +\usage{ +is_integer_list(s) +} +\description{ +Check that a value is a list of one or more integers. +} +\keyword{internal} diff --git a/man/is_integer_scalar.Rd b/man/is_integer_scalar.Rd new file mode 100644 index 0000000..e3d5ef7 --- /dev/null +++ b/man/is_integer_scalar.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/atomic.R +\name{is_integer_scalar} +\alias{is_integer_scalar} +\title{Check if a value is both a scalar (tagged by as_scalar) and an integer.} +\usage{ +is_integer_scalar(s) +} +\description{ +Check if a value is both a scalar (tagged by as_scalar) and an integer. +} +\keyword{internal} diff --git a/man/is_integer_vec.Rd b/man/is_integer_vec.Rd new file mode 100644 index 0000000..65ae76c --- /dev/null +++ b/man/is_integer_vec.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/atomic.R +\name{is_integer_vec} +\alias{is_integer_vec} +\title{Check that a value is a vector of one or more integers and has not been +explicitly tagged as a scalar.} +\usage{ +is_integer_vec(s) +} +\description{ +Check that a value is a vector of one or more integers and has not been +explicitly tagged as a scalar. +} +\keyword{internal} diff --git a/man/is_scalar.Rd b/man/is_scalar.Rd index 49d8dab..9e1ae67 100644 --- a/man/is_scalar.Rd +++ b/man/is_scalar.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/atomic.R \name{is_scalar} \alias{is_scalar} -\title{Check if a value is a scalar.} +\title{Check if a value is a scalar (i.e., a one-element vector that was converted with as_scalar).} \usage{ is_scalar(s) } @@ -13,5 +13,5 @@ is_scalar(s) TRUE if the value is a scalar, FALSE otherwise. } \description{ -Check if a value is a scalar. +Check if a value is a scalar (i.e., a one-element vector that was converted with as_scalar). } diff --git a/man/pizzarr_option_defaults.Rd b/man/pizzarr_option_defaults.Rd new file mode 100644 index 0000000..2bca041 --- /dev/null +++ b/man/pizzarr_option_defaults.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/options.R +\docType{data} +\name{pizzarr_option_defaults} +\alias{pizzarr_option_defaults} +\title{pizzarr_option_defaults} +\format{ +An object of class \code{list} of length 3. +} +\usage{ +pizzarr_option_defaults +} +\description{ +pizzarr_option_defaults +} +\keyword{datasets} diff --git a/man/zb_slice.Rd b/man/zb_slice.Rd index f32517c..f4c0203 100644 --- a/man/zb_slice.Rd +++ b/man/zb_slice.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/slicing.R \name{zb_slice} \alias{zb_slice} -\title{Convenience function for the internal Sliceclass constructor +\title{Convenience function for the internal Slice class constructor with zero-based indexing and exclusive stop index.} \usage{ zb_slice(start, stop = NA, step = NA) @@ -15,6 +15,6 @@ zb_slice(start, stop = NA, step = NA) \item{step}{The step size.} } \description{ -Convenience function for the internal Sliceclass constructor +Convenience function for the internal Slice class constructor with zero-based indexing and exclusive stop index. }