|
50 | 50 |
|
51 | 51 | Base.showable(::MIME"application/vnd.dataresource+json", source::CSVStream) = true |
52 | 52 |
|
53 | | -function fileio_load(f::FileIO.File{FileIO.format"CSV"}, deprecated_delim=nothing; delim=deprecated_delim===nothing ? ',' : deprecated_delim, args...) |
54 | | - if deprecated_delim!==nothing |
55 | | - deprecated_delim!=delim && error("deprecated_delim and delim can not both be used at the same time.") |
| 53 | +function fileio_load(f::FileIO.File{FileIO.format"CSV"}, deprecated_delim=nothing; delim=deprecated_delim === nothing ? ',' : deprecated_delim, args...) |
| 54 | + if deprecated_delim !== nothing |
| 55 | + deprecated_delim != delim && error("deprecated_delim and delim can not both be used at the same time.") |
56 | 56 | Base.depwarn("The positional `delim` keyword in the `load` function is deprecated. Instead use the keyword argument `delim`.", :CSVFiles) |
57 | 57 | end |
58 | 58 |
|
59 | 59 | return CSVFile(f.filename, delim, args) |
60 | 60 | end |
61 | 61 |
|
62 | | -function fileio_load(f::FileIO.File{FileIO.format"TSV"}, deprecated_delim=nothing; delim=deprecated_delim===nothing ? '\t' : deprecated_delim, args...) |
63 | | - if deprecated_delim!==nothing |
64 | | - deprecated_delim!=delim && error("deprecated_delim and delim can not both be used at the same time.") |
| 62 | +function fileio_load(f::FileIO.File{FileIO.format"TSV"}, deprecated_delim=nothing; delim=deprecated_delim === nothing ? '\t' : deprecated_delim, args...) |
| 63 | + if deprecated_delim !== nothing |
| 64 | + deprecated_delim != delim && error("deprecated_delim and delim can not both be used at the same time.") |
65 | 65 | Base.depwarn("The positional `delim` keyword in the `load` function is deprecated. Instead use the keyword argument `delim`.", :CSVFiles) |
66 | 66 | end |
67 | 67 |
|
68 | 68 | return CSVFile(f.filename, delim, args) |
69 | 69 | end |
70 | 70 |
|
71 | | -function fileio_load(s::FileIO.Stream{FileIO.format"CSV"}, deprecated_delim=nothing; delim=deprecated_delim===nothing ? ',' : deprecated_delim, args...) |
72 | | - if deprecated_delim!==nothing |
73 | | - deprecated_delim!=delim && error("deprecated_delim and delim can not both be used at the same time.") |
| 71 | +function fileio_load(s::FileIO.Stream{FileIO.format"CSV"}, deprecated_delim=nothing; delim=deprecated_delim === nothing ? ',' : deprecated_delim, args...) |
| 72 | + if deprecated_delim !== nothing |
| 73 | + deprecated_delim != delim && error("deprecated_delim and delim can not both be used at the same time.") |
74 | 74 | Base.depwarn("The positional `delim` keyword in the `load` function is deprecated. Instead use the keyword argument `delim`.", :CSVFiles) |
75 | 75 | end |
76 | 76 |
|
77 | 77 | return CSVStream(s.io, delim, args) |
78 | 78 | end |
79 | 79 |
|
80 | | -function fileio_load(s::FileIO.Stream{FileIO.format"TSV"}, deprecated_delim=nothing; delim=deprecated_delim===nothing ? '\t' : deprecated_delim, args...) |
81 | | - if deprecated_delim!==nothing |
82 | | - deprecated_delim!=delim && error("deprecated_delim and delim can not both be used at the same time.") |
| 80 | +function fileio_load(s::FileIO.Stream{FileIO.format"TSV"}, deprecated_delim=nothing; delim=deprecated_delim === nothing ? '\t' : deprecated_delim, args...) |
| 81 | + if deprecated_delim !== nothing |
| 82 | + deprecated_delim != delim && error("deprecated_delim and delim can not both be used at the same time.") |
83 | 83 | Base.depwarn("The positional `delim` keyword in the `load` function is deprecated. Instead use the keyword argument `delim`.", :CSVFiles) |
84 | 84 | end |
85 | 85 |
|
|
114 | 114 |
|
115 | 115 | function TableTraits.get_columns_copy_using_missing(file::CSVFile) |
116 | 116 | columns, colnames = _loaddata(file) |
117 | | - return NamedTuple{(Symbol.(colnames)...,), Tuple{typeof.(columns)...}}((columns...,)) |
| 117 | + return NamedTuple{(Symbol.(colnames)...,),Tuple{typeof.(columns)...}}((columns...,)) |
118 | 118 | end |
119 | 119 |
|
120 | 120 | function IteratorInterfaceExtensions.getiterator(s::CSVStream) |
|
127 | 127 |
|
128 | 128 | function TableTraits.get_columns_copy_using_missing(s::CSVStream) |
129 | 129 | columns, colnames = TextParse.csvread(s.io, s.delim; stringarraytype=Array, s.keywords...) |
130 | | - return NamedTuple{(Symbol.(colnames)...,), Tuple{typeof.(columns)...}}((columns...,)) |
| 130 | + return NamedTuple{(Symbol.(colnames)...,),Tuple{typeof.(columns)...}}((columns...,)) |
131 | 131 | end |
132 | 132 |
|
133 | 133 | function Base.collect(x::CSVFile) |
|
0 commit comments