Skip to content

Commit 2585501

Browse files
line breaks for readability
1 parent 0ab8397 commit 2585501

File tree

1 file changed

+58
-10
lines changed

1 file changed

+58
-10
lines changed

r/R/csv.R

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ csv_read_options <- function(use_threads = TRUE, block_size = 1048576L) {
5555
#' @param header_rows Number of header rows to skip (including the first row containing column names)
5656
#'
5757
#' @export
58-
csv_parse_options <- function(delimiter = ",", quoting = TRUE, quote_char = '"', double_quote = TRUE, escaping = FALSE, escape_char = '\\', newlines_in_values = FALSE, ignore_empty_lines = TRUE, header_rows = 1L){
58+
csv_parse_options <- function(
59+
delimiter = ",", quoting = TRUE, quote_char = '"',
60+
double_quote = TRUE, escaping = FALSE, escape_char = '\\',
61+
newlines_in_values = FALSE, ignore_empty_lines = TRUE,
62+
header_rows = 1L
63+
){
5964
shared_ptr(`arrow::csv::ParseOptions`, csv___ParseOptions__initialize(
6065
list(
6166
delimiter = delimiter,
@@ -93,34 +98,77 @@ csv_convert_options <- function(check_utf8 = TRUE){
9398
#' @param ... additional parameters.
9499
#'
95100
#' @export
96-
csv_table_reader <- function(file, read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ...){
101+
csv_table_reader <- function(file,
102+
read_options = csv_read_options(),
103+
parse_options = csv_parse_options(),
104+
convert_options = csv_convert_options(),
105+
...
106+
){
97107
UseMethod("csv_table_reader")
98108
}
99109

100110
#' @importFrom rlang abort
101111
#' @export
102-
csv_table_reader.default <- function(file, read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ...) {
112+
csv_table_reader.default <- function(file,
113+
read_options = csv_read_options(),
114+
parse_options = csv_parse_options(),
115+
convert_options = csv_convert_options(),
116+
...
117+
) {
103118
abort("unsupported")
104119
}
105120

106121
#' @export
107-
`csv_table_reader.character` <- function(file, read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ...){
108-
csv_table_reader(fs::path_abs(file), read_options = read_options, parse_options = parse_options, convert_options = convert_options, ...)
122+
`csv_table_reader.character` <- function(file,
123+
read_options = csv_read_options(),
124+
parse_options = csv_parse_options(),
125+
convert_options = csv_convert_options(),
126+
...
127+
){
128+
csv_table_reader(fs::path_abs(file),
129+
read_options = read_options,
130+
parse_options = parse_options,
131+
convert_options = convert_options,
132+
...
133+
)
109134
}
110135

111136
#' @export
112-
`csv_table_reader.fs_path` <- function(file, read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), mmap = TRUE, ...){
137+
`csv_table_reader.fs_path` <- function(file,
138+
read_options = csv_read_options(),
139+
parse_options = csv_parse_options(),
140+
convert_options = csv_convert_options(),
141+
mmap = TRUE,
142+
...
143+
){
113144
stream <- if (isTRUE(mmap)) mmap_open(file) else file_open(file)
114-
csv_table_reader(stream, read_options = read_options, parse_options = parse_options, convert_options = convert_options, ...)
145+
csv_table_reader(stream,
146+
read_options = read_options,
147+
parse_options = parse_options,
148+
convert_options = convert_options,
149+
...
150+
)
115151
}
116152

117153
#' @export
118-
`csv_table_reader.arrow::io::InputStream` <- function(file, read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ...){
119-
shared_ptr(`arrow::csv::TableReader`, csv___TableReader__Make(file, read_options, parse_options, convert_options))
154+
`csv_table_reader.arrow::io::InputStream` <- function(file,
155+
read_options = csv_read_options(),
156+
parse_options = csv_parse_options(),
157+
convert_options = csv_convert_options(),
158+
...
159+
){
160+
shared_ptr(`arrow::csv::TableReader`,
161+
csv___TableReader__Make(file, read_options, parse_options, convert_options)
162+
)
120163
}
121164

122165
#' @export
123-
`csv_table_reader.arrow::csv::TableReader` <- function(file, read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ...){
166+
`csv_table_reader.arrow::csv::TableReader` <- function(file,
167+
read_options = csv_read_options(),
168+
parse_options = csv_parse_options(),
169+
convert_options = csv_convert_options(),
170+
...
171+
){
124172
file
125173
}
126174

0 commit comments

Comments
 (0)