Skip to content

Commit

Permalink
Run styler, delete func
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnic committed Aug 1, 2023
1 parent 82e151e commit 5c91719
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions r/R/filesystem.R
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ GcsFileSystem <- R6Class("GcsFileSystem",
# Convert from nanoseconds to POSIXct w/ UTC tz
if ("expiration" %in% names(out)) {
out$expiration <- as.POSIXct(
out$expiration / 1000000000, origin = "1970-01-01", tz = "UTC"
out$expiration / 1000000000,
origin = "1970-01-01", tz = "UTC"
)
}

Expand Down Expand Up @@ -580,8 +581,10 @@ GcsFileSystem$create <- function(anonymous = FALSE, retry_limit_seconds = 15, ..
stop(
paste(
"Option 'expiration' must be of class POSIXct, not",
class(options$expiration)[[1]]),
call. = FALSE)
class(options$expiration)[[1]]
),
call. = FALSE
)
}

options$retry_limit_seconds <- retry_limit_seconds
Expand Down Expand Up @@ -690,7 +693,7 @@ read_file_utf8 <- function(file) {
#' @param path A character vector of one or more paths
#' @param ... Additional arguments passed to [FileSelector$create()]
#' @export
fs_ls <- function(fs, path = ".", ...){
fs_ls <- function(fs, path = ".", ...) {
fs$ls(path, ...)
}

Expand All @@ -700,7 +703,7 @@ fs_ls <- function(fs, path = ".", ...){
#' @param path A character vector of one or more paths
#' @param recursive Create intermediate directories if they do not exist
#' @export
fs_create_dir <- function(fs, path, recursive = TRUE){
fs_create_dir <- function(fs, path, recursive = TRUE) {
fs$CreateDir(path, recursive = recursive)
}

Expand All @@ -709,7 +712,7 @@ fs_create_dir <- function(fs, path, recursive = TRUE){
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @export
fs_delete_dir <- function(fs, path){
fs_delete_dir <- function(fs, path) {
fs$DeleteDir(path)
}

Expand All @@ -719,27 +722,16 @@ fs_delete_dir <- function(fs, path){
#' @param src Source path
#' @param dest Destination path
#' @export
fs_copy_file <- function(fs, src, dest){
fs_copy_file <- function(fs, src, dest) {
fs$CopyFile(src, dest)
}

#' @export
fs_open_output_stream <- function(fs, path, append = FALSE){
if (append) {
fs$OpenAppendStream(path)
} else {
fs$OpenOutputStream(path)
}
}

# TODO: create method close.OutputStream (or whatever object returned from bucket$OpenAppendStream)

#' Delete a file from a file system
#'
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @export
fs_delete_file <- function(fs, path){
fs_delete_file <- function(fs, path) {
fs$DeleteFiles(path)
}

Expand All @@ -748,12 +740,12 @@ fs_delete_file <- function(fs, path){
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @export
fs_get_file_info <- function(fs, path){
fs_get_file_info <- function(fs, path) {
fs$GetFileInfo(path)
}

#' @export
fs_make_path <- function(fs, path){
fs_make_path <- function(fs, path) {
fs$path(path)
}

Expand All @@ -768,6 +760,6 @@ fs_make_path <- function(fs, path){
#' @param src Source path
#' @param dest Destination path
#' @export
fs_move_file <- function(fs, src, dest){
fs_move_file <- function(fs, src, dest) {
fs$Move(src, dest)
}

0 comments on commit 5c91719

Please sign in to comment.