patchwork_csv_utils 0.1.16-aarch64-linux → 0.1.17-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/ext/csv_utils/src/utils/csv.rs +11 -1
- data/ext/csv_utils/src/utils/mod.rs +0 -9
- data/ext/csv_utils/src/utils/xls.rs +12 -2
- data/lib/csv_utils/2.7/csv_utils.so +0 -0
- data/lib/csv_utils/3.0/csv_utils.so +0 -0
- data/lib/csv_utils/3.1/csv_utils.so +0 -0
- data/lib/csv_utils/3.2/csv_utils.so +0 -0
- data/lib/csv_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87156b5f075414e4823da5e1d57b2f437bdbb399b16fa538a819f70d648635af
|
4
|
+
data.tar.gz: 3efad2ddb360387d71f9e70e03efa7e35f9cb898bf9f6f2bff7eee4b479f0249
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b960428a14467b037ef97587b872569e8cd5186a9fdbfac7d54eb66b42ea5dad7b6775b72f6eb47191ae3e923fce6fe084dac8c082fed1c0c7c8cc55713eb6ee
|
7
|
+
data.tar.gz: a0bb2bfd6855a7d331de2b3526e011f95c2393413aefc7cddcb60067e7306d8cac3424e317f2fba700987f98e4d0c5b4d31ba1559f9a7e7837c2daaaf26254c0
|
data/Gemfile.lock
CHANGED
@@ -4,7 +4,7 @@ use chrono::{NaiveDate, NaiveDateTime, NaiveTime, Utc};
|
|
4
4
|
use csv::{Reader, StringRecord, Writer};
|
5
5
|
use magnus::{Error, RArray, Ruby};
|
6
6
|
|
7
|
-
use crate::utils::{FileExtension, magnus_err, missing_header, to_datetime_error, check_mandatory_headers, create_header_map, missing_value, headers_as_byte_record, index_of_header_in_mandatory_list
|
7
|
+
use crate::utils::{FileExtension, magnus_err, missing_header, to_datetime_error, check_mandatory_headers, create_header_map, missing_value, headers_as_byte_record, index_of_header_in_mandatory_list};
|
8
8
|
|
9
9
|
pub fn transform_csv(ruby: &Ruby, csv_path: String,
|
10
10
|
target_path: String, exclusions: RArray,
|
@@ -87,6 +87,16 @@ pub fn transform_csv(ruby: &Ruby, csv_path: String,
|
|
87
87
|
Ok(())
|
88
88
|
}
|
89
89
|
|
90
|
+
|
91
|
+
fn validate_trust_name(ruby: &Ruby, expected_trust_name: &String, trust_name: &usize, ri: usize, i: usize, s: &String) -> magnus::error::Result<()> {
|
92
|
+
if i == *trust_name {
|
93
|
+
if s != &expected_trust_name.clone() {
|
94
|
+
return Err(magnus::Error::new(ruby.exception_standard_error(), format!("Trust actual name: '{}' is not as expected: '{}'", s, expected_trust_name)));
|
95
|
+
}
|
96
|
+
}
|
97
|
+
Ok(())
|
98
|
+
}
|
99
|
+
|
90
100
|
fn get_mandatory_records(ruby: &Ruby, csv: &mut Reader<File>, csv_header_list: &Vec<String>, mandatory_headers_list: &Vec<String>) -> magnus::error::Result<Vec<StringRecord>> {
|
91
101
|
let inverse_header_map: HashMap<usize, String> = csv_header_list.iter().enumerate().map(|(i, h)| (i, h.to_string())).collect();
|
92
102
|
|
@@ -9,15 +9,6 @@ pub mod csv;
|
|
9
9
|
pub mod dedup;
|
10
10
|
pub mod xls;
|
11
11
|
|
12
|
-
fn validate_trust_name(ruby: &Ruby, expected_trust_name: &String, trust_name: &usize, ri: usize, i: usize, s: &String) -> magnus::error::Result<()> {
|
13
|
-
if ri > 0 && i == *trust_name {
|
14
|
-
if s != &expected_trust_name.clone() {
|
15
|
-
return Err(magnus::Error::new(ruby.exception_standard_error(), format!("Trust actual name: '{}' is not as expected: '{}'", s, expected_trust_name)));
|
16
|
-
}
|
17
|
-
}
|
18
|
-
Ok(())
|
19
|
-
}
|
20
|
-
|
21
12
|
fn missing_header(ruby: &Ruby, header: &str) -> magnus::Error {
|
22
13
|
magnus::Error::new(ruby.exception_standard_error(), format!("Missing '{}' header", header))
|
23
14
|
}
|
@@ -6,7 +6,7 @@ use calamine::{Data, open_workbook, Range, Reader, Xls};
|
|
6
6
|
use chrono::{NaiveDateTime, Utc};
|
7
7
|
use magnus::{RArray, Ruby};
|
8
8
|
|
9
|
-
use crate::utils::{FileExtension, magnus_err, missing_header, to_datetime_error, check_mandatory_headers, missing_value, index_of_header_in_mandatory_list
|
9
|
+
use crate::utils::{FileExtension, magnus_err, missing_header, to_datetime_error, check_mandatory_headers, missing_value, index_of_header_in_mandatory_list};
|
10
10
|
|
11
11
|
pub fn to_csv(ruby: &Ruby, xls_path: String,
|
12
12
|
target_path: String,
|
@@ -69,6 +69,7 @@ fn write_csv<W: Write>(ruby: &Ruby, dest: &mut W, range: &Range<Data>,
|
|
69
69
|
if date_value_is_not_present(&date, &r) {
|
70
70
|
return Err(magnus::Error::new(ruby.exception_standard_error(), format!("Date value is not present in row: {}", ri)));
|
71
71
|
}
|
72
|
+
validate_trust_name(ruby, &expected_trust_name, trust_name, ri, &r)?;
|
72
73
|
|
73
74
|
for (i, c) in mandatory_headers.iter().enumerate() {
|
74
75
|
let column_index = header_map.get(c).ok_or(missing_header(ruby, c))?;
|
@@ -77,7 +78,6 @@ fn write_csv<W: Write>(ruby: &Ruby, dest: &mut W, range: &Range<Data>,
|
|
77
78
|
match *c {
|
78
79
|
Data::Empty => Ok(()),
|
79
80
|
Data::String(ref s) | Data::DateTimeIso(ref s) | Data::DurationIso(ref s) => {
|
80
|
-
validate_trust_name(ruby, &expected_trust_name, trust_name, ri, i, s)?;
|
81
81
|
handle_commas(dest, s)
|
82
82
|
}
|
83
83
|
Data::Float(ref f) => write!(dest, "{}", f),
|
@@ -103,6 +103,16 @@ fn write_csv<W: Write>(ruby: &Ruby, dest: &mut W, range: &Range<Data>,
|
|
103
103
|
Ok(())
|
104
104
|
}
|
105
105
|
|
106
|
+
fn validate_trust_name(ruby: &Ruby, expected_trust_name: &String, trust_name: &usize, ri: usize, r: &Vec<&Data>) -> magnus::error::Result<()> {
|
107
|
+
if ri > 0 {
|
108
|
+
let s = r[*trust_name].to_string();
|
109
|
+
if s != expected_trust_name.clone() {
|
110
|
+
return Err(magnus::Error::new(ruby.exception_standard_error(), format!("Trust actual name: '{}' is not as expected: '{}'", s, expected_trust_name)));
|
111
|
+
}
|
112
|
+
}
|
113
|
+
Ok(())
|
114
|
+
}
|
115
|
+
|
106
116
|
fn get_mandatory_records<'a>(ruby: &Ruby, range: &'a Range<Data>, csv_header_list: &Vec<String>, mandatory_headers_list: &Vec<String>) -> magnus::error::Result<Vec<Vec<&'a Data>>> {
|
107
117
|
let inverse_header_map: HashMap<usize, String> = csv_header_list.iter().enumerate().map(|(i, h)| (i, h.to_string())).collect();
|
108
118
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/csv_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patchwork_csv_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: aarch64-linux
|
6
6
|
authors:
|
7
7
|
- kingsley.hendrickse
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Deduplication of CSV files and XLS to CSV conversion.
|
14
14
|
email:
|