diff --git a/Cargo.lock b/Cargo.lock index 38775fd..f6760f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,9 +86,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "calamine" -version = "0.18.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86ca78da4bdce5ac0f0bdbc0218ad14232f1e668376e044233f64c527cf5abb" +checksum = "fe0ba51a659bb6c8bffd6f7c1c5ffafcafa0c97e4769411d841c3cc5c154ab47" dependencies = [ "byteorder", "codepage", @@ -175,6 +175,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + [[package]] name = "csv" version = "1.1.6" @@ -199,7 +208,7 @@ dependencies = [ [[package]] name = "drepr" -version = "1.2.0" +version = "1.2.1" dependencies = [ "chrono", "clap", @@ -641,9 +650,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.19.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d72d5477478f85bd00b6521780dfba1ec6cdaadcf90b8b181c36d7de561f9b" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" dependencies = [ "encoding_rs", "memchr", @@ -666,7 +675,7 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "readers" -version = "0.2.2" +version = "0.2.3" dependencies = [ "calamine", "clap", @@ -815,26 +824,6 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "time" version = "0.1.44" @@ -977,12 +966,12 @@ dependencies = [ [[package]] name = "zip" -version = "0.5.13" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" dependencies = [ "byteorder", "crc32fast", + "crossbeam-utils", "flate2", - "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index 4491017..f9476d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drepr" -version = "1.2.0" +version = "1.2.1" authors = ["Binh Vu "] edition = "2018" diff --git a/pyproject.toml b/pyproject.toml index 854ddcb..5bfbe26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "drepr" -version = "2.11.0" +version = "2.11.1" description = "Data Representation Language for Reading Heterogeneous Datasets" readme = "README.md" requires-python = ">=3.8" diff --git a/readers/Cargo.toml b/readers/Cargo.toml index 16fc84d..4be9e3a 100644 --- a/readers/Cargo.toml +++ b/readers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "readers" -version = "0.2.2" +version = "0.2.3" authors = ["Binh Vu "] edition = "2018" @@ -23,6 +23,6 @@ lazy_static = "1.4.0" netcdf = { version = "0.7.0", features = ["static"] } # for excel -calamine = "0.18.0" +calamine = "0.22.1" pyo3 = "0.16.5" diff --git a/readers/src/spreadsheet/spreadsheet_ra_reader.rs b/readers/src/spreadsheet/spreadsheet_ra_reader.rs index f1f7bf4..5e91c74 100644 --- a/readers/src/spreadsheet/spreadsheet_ra_reader.rs +++ b/readers/src/spreadsheet/spreadsheet_ra_reader.rs @@ -1,10 +1,9 @@ -use crate::prelude::{Index, Value, PathExpr, IndexIterator}; -use crate::ra_reader::{RAReader, default_iter_index}; +use crate::prelude::{Index, IndexIterator, PathExpr, Value}; +use crate::ra_reader::{default_iter_index, RAReader}; use calamine::{open_workbook_auto, DataType, Reader}; use hashbrown::HashMap; - #[derive(Debug)] pub struct SpreadsheetRAReader { sheets: Vec, @@ -33,6 +32,9 @@ impl SpreadsheetRAReader { DataType::Int(v) => Value::I64(*v), DataType::Float(v) => Value::F64(*v), DataType::DateTime(v) => Value::F64(*v), + DataType::Duration(v) => Value::F64(*v), + DataType::DateTimeIso(v) => Value::Str(v.to_owned()), + DataType::DurationIso(v) => Value::Str(v.to_owned()), DataType::Empty => Value::Str(String::new()), DataType::Error(_) => Value::Null, }) @@ -47,7 +49,11 @@ impl SpreadsheetRAReader { } } - return SpreadsheetRAReader { sheets, name2index, sheet_names }; + return SpreadsheetRAReader { + sheets, + name2index, + sheet_names, + }; } } @@ -60,7 +66,7 @@ impl RAReader for SpreadsheetRAReader { } else { self.sheets[*v] = val; } - }, + } Index::Str(v) => { if start_idx < index.len() - 1 { self.sheets[self.name2index[v]].set_value(index, start_idx + 1, val); @@ -79,7 +85,7 @@ impl RAReader for SpreadsheetRAReader { } else { &self.sheets[*v] } - }, + } Index::Str(v) => { if start_idx < index.len() - 1 { self.sheets[self.name2index[v]].get_value(index, start_idx + 1) @@ -98,7 +104,7 @@ impl RAReader for SpreadsheetRAReader { } else { &mut self.sheets[*v] } - }, + } Index::Str(v) => { if start_idx < index.len() - 1 { self.sheets[self.name2index[v]].get_mut_value(index, start_idx + 1) @@ -115,12 +121,8 @@ impl RAReader for SpreadsheetRAReader { fn remove(&mut self, index: &Index) { let sheet_index = match index { - Index::Idx(v) => { - *v - }, - Index::Str(v) => { - self.name2index[v] - } + Index::Idx(v) => *v, + Index::Str(v) => self.name2index[v], }; self.sheets.remove(sheet_index); @@ -138,4 +140,4 @@ impl RAReader for SpreadsheetRAReader { fn iter_index<'a>(&'a self, loc: &PathExpr) -> Box { default_iter_index(self, loc) } -} \ No newline at end of file +}