csv-validation 0.0.18__tar.gz → 0.1.0__tar.gz

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.
@@ -83,7 +83,7 @@ dependencies = [
83
83
 
84
84
  [[package]]
85
85
  name = "csv_validation"
86
- version = "0.0.18"
86
+ version = "0.1.0"
87
87
  dependencies = [
88
88
  "csv",
89
89
  "flate2",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "csv_validation"
3
- version = "0.0.18"
3
+ version = "0.1.0"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -13,7 +13,8 @@ crate-type = ["cdylib"]
13
13
  csv = "1.3.1"
14
14
  flate2 = "1.1.0"
15
15
  log = "0.4.26"
16
- pyo3 = "0.23.3"
16
+ # abi3-py310 makes the wheels forward-compatible with 3.11, 3.12 ...
17
+ pyo3 = { version = "0.23.3", features = ["extension-module", "abi3-py310"] }
17
18
  pyo3-log = "0.12.1"
18
19
  regex = "1.11.1"
19
20
  simple_logger = "5.0.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csv_validation
3
- Version: 0.0.18
3
+ Version: 0.1.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -73,6 +73,29 @@ impl PartialEq for Validation {
73
73
  }
74
74
 
75
75
 
76
+ impl std::fmt::Display for Validation {
77
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
78
+ match self {
79
+ Validation::RegularExpression { alias, .. } if alias != "regex" => {
80
+ write!(f, "{}", alias)
81
+ }
82
+ Validation::RegularExpression { expression, .. } => {
83
+ write!(f, "regex: '{}'", expression)
84
+ }
85
+ Validation::Min(value) => write!(f, "min: {}", value),
86
+ Validation::Max(value) => write!(f, "max: {}", value),
87
+ Validation::Values(values) => {
88
+ let formatted_values = values.iter()
89
+ .map(|v| format!("'{}'", v))
90
+ .collect::<Vec<String>>()
91
+ .join(", ");
92
+ write!(f, "values: {}", formatted_values)
93
+ }
94
+ Validation::None => write!(f, "none"),
95
+ }
96
+ }
97
+ }
98
+
76
99
  #[derive(Clone)]
77
100
  struct ColumnValidations {
78
101
  column_name: String,
@@ -642,8 +665,8 @@ impl CSVValidator {
642
665
 
643
666
  let mut unique_validation_ok = true;
644
667
  // If there are duplicated keys, report them first
645
- if let Some(_) = &self.unique_key_columns {
646
- info!("UNIQUE KEY: column(s): {:?}", &self.unique_key_columns);
668
+ if let Some(unique_cols) = &self.unique_key_columns {
669
+ info!("UNIQUE KEY: column(s): {}", unique_cols.join(", "));
647
670
  if !duplicated_keys_pretty_counts.is_empty() {
648
671
  info!("");
649
672
  let total = duplicated_keys_pretty_counts.len();
@@ -674,7 +697,7 @@ impl CSVValidator {
674
697
  for column_validation_summary in &validation_process_summary.correct_columns {
675
698
  info!(" - {}: [✔] OK", column_validation_summary.column_name);
676
699
  for validation_summary in column_validation_summary.validation_summaries.iter() {
677
- info!(" ✔ - {:?}", validation_summary.validation);
700
+ info!(" ✔ - {}", validation_summary.validation);
678
701
  }
679
702
  }
680
703
 
@@ -685,11 +708,11 @@ impl CSVValidator {
685
708
  info!(" - {}: [✖] FAIL", column_validation_summary.column_name);
686
709
  for validation_summary in column_validation_summary.validation_summaries.iter() {
687
710
  if validation_summary.wrong_rows > 0 {
688
- info!(" ✖ - {:?}", validation_summary.validation);
711
+ info!(" ✖ - {}", validation_summary.validation);
689
712
  info!(" {:?}", validation_summary.get_wrong_values_details());
690
713
  }
691
714
  else {
692
- info!(" ✔ - {:?}", validation_summary.validation);
715
+ info!(" ✔ - {}", validation_summary.validation);
693
716
  }
694
717
  }
695
718
  }
File without changes
File without changes