csv-validation 0.0.1__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.
- csv_validation-0.0.1/.github/workflows/CI.yml +181 -0
- csv_validation-0.0.1/.gitignore +72 -0
- csv_validation-0.0.1/Cargo.lock +612 -0
- csv_validation-0.0.1/Cargo.toml +19 -0
- csv_validation-0.0.1/PKG-INFO +7 -0
- csv_validation-0.0.1/build.sh +1 -0
- csv_validation-0.0.1/pyproject.toml +15 -0
- csv_validation-0.0.1/src/lib.rs +140 -0
- csv_validation-0.0.1/test/test_file.csv +4 -0
- csv_validation-0.0.1/test/test_file.csv.gz +0 -0
- csv_validation-0.0.1/test/test_validations.yml +7 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.8.2
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
platform:
|
|
27
|
+
- runner: ubuntu-22.04
|
|
28
|
+
target: x86_64
|
|
29
|
+
- runner: ubuntu-22.04
|
|
30
|
+
target: x86
|
|
31
|
+
- runner: ubuntu-22.04
|
|
32
|
+
target: aarch64
|
|
33
|
+
- runner: ubuntu-22.04
|
|
34
|
+
target: armv7
|
|
35
|
+
- runner: ubuntu-22.04
|
|
36
|
+
target: s390x
|
|
37
|
+
- runner: ubuntu-22.04
|
|
38
|
+
target: ppc64le
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: 3.x
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.platform.target }}
|
|
48
|
+
args: --release --out dist --find-interpreter
|
|
49
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
50
|
+
manylinux: auto
|
|
51
|
+
- name: Upload wheels
|
|
52
|
+
uses: actions/upload-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
55
|
+
path: dist
|
|
56
|
+
|
|
57
|
+
musllinux:
|
|
58
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
59
|
+
strategy:
|
|
60
|
+
matrix:
|
|
61
|
+
platform:
|
|
62
|
+
- runner: ubuntu-22.04
|
|
63
|
+
target: x86_64
|
|
64
|
+
- runner: ubuntu-22.04
|
|
65
|
+
target: x86
|
|
66
|
+
- runner: ubuntu-22.04
|
|
67
|
+
target: aarch64
|
|
68
|
+
- runner: ubuntu-22.04
|
|
69
|
+
target: armv7
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
- uses: actions/setup-python@v5
|
|
73
|
+
with:
|
|
74
|
+
python-version: 3.x
|
|
75
|
+
- name: Build wheels
|
|
76
|
+
uses: PyO3/maturin-action@v1
|
|
77
|
+
with:
|
|
78
|
+
target: ${{ matrix.platform.target }}
|
|
79
|
+
args: --release --out dist --find-interpreter
|
|
80
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
81
|
+
manylinux: musllinux_1_2
|
|
82
|
+
- name: Upload wheels
|
|
83
|
+
uses: actions/upload-artifact@v4
|
|
84
|
+
with:
|
|
85
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
86
|
+
path: dist
|
|
87
|
+
|
|
88
|
+
windows:
|
|
89
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
90
|
+
strategy:
|
|
91
|
+
matrix:
|
|
92
|
+
platform:
|
|
93
|
+
- runner: windows-latest
|
|
94
|
+
target: x64
|
|
95
|
+
- runner: windows-latest
|
|
96
|
+
target: x86
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/checkout@v4
|
|
99
|
+
- uses: actions/setup-python@v5
|
|
100
|
+
with:
|
|
101
|
+
python-version: 3.x
|
|
102
|
+
architecture: ${{ matrix.platform.target }}
|
|
103
|
+
- name: Build wheels
|
|
104
|
+
uses: PyO3/maturin-action@v1
|
|
105
|
+
with:
|
|
106
|
+
target: ${{ matrix.platform.target }}
|
|
107
|
+
args: --release --out dist --find-interpreter
|
|
108
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
109
|
+
- name: Upload wheels
|
|
110
|
+
uses: actions/upload-artifact@v4
|
|
111
|
+
with:
|
|
112
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
113
|
+
path: dist
|
|
114
|
+
|
|
115
|
+
macos:
|
|
116
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
117
|
+
strategy:
|
|
118
|
+
matrix:
|
|
119
|
+
platform:
|
|
120
|
+
- runner: macos-13
|
|
121
|
+
target: x86_64
|
|
122
|
+
- runner: macos-14
|
|
123
|
+
target: aarch64
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v4
|
|
126
|
+
- uses: actions/setup-python@v5
|
|
127
|
+
with:
|
|
128
|
+
python-version: 3.x
|
|
129
|
+
- name: Build wheels
|
|
130
|
+
uses: PyO3/maturin-action@v1
|
|
131
|
+
with:
|
|
132
|
+
target: ${{ matrix.platform.target }}
|
|
133
|
+
args: --release --out dist --find-interpreter
|
|
134
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
135
|
+
- name: Upload wheels
|
|
136
|
+
uses: actions/upload-artifact@v4
|
|
137
|
+
with:
|
|
138
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
139
|
+
path: dist
|
|
140
|
+
|
|
141
|
+
sdist:
|
|
142
|
+
runs-on: ubuntu-latest
|
|
143
|
+
steps:
|
|
144
|
+
- uses: actions/checkout@v4
|
|
145
|
+
- name: Build sdist
|
|
146
|
+
uses: PyO3/maturin-action@v1
|
|
147
|
+
with:
|
|
148
|
+
command: sdist
|
|
149
|
+
args: --out dist
|
|
150
|
+
- name: Upload sdist
|
|
151
|
+
uses: actions/upload-artifact@v4
|
|
152
|
+
with:
|
|
153
|
+
name: wheels-sdist
|
|
154
|
+
path: dist
|
|
155
|
+
|
|
156
|
+
release:
|
|
157
|
+
name: Release
|
|
158
|
+
runs-on: ubuntu-latest
|
|
159
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
160
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
161
|
+
permissions:
|
|
162
|
+
# Use to sign the release artifacts
|
|
163
|
+
id-token: write
|
|
164
|
+
# Used to upload release artifacts
|
|
165
|
+
contents: write
|
|
166
|
+
# Used to generate artifact attestation
|
|
167
|
+
attestations: write
|
|
168
|
+
steps:
|
|
169
|
+
- uses: actions/download-artifact@v4
|
|
170
|
+
- name: Generate artifact attestation
|
|
171
|
+
uses: actions/attest-build-provenance@v1
|
|
172
|
+
with:
|
|
173
|
+
subject-path: 'wheels-*/*'
|
|
174
|
+
- name: Publish to PyPI
|
|
175
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
176
|
+
uses: PyO3/maturin-action@v1
|
|
177
|
+
env:
|
|
178
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
179
|
+
with:
|
|
180
|
+
command: upload
|
|
181
|
+
args: --non-interactive --skip-existing wheels-*/*
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "adler2"
|
|
7
|
+
version = "2.0.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "aho-corasick"
|
|
13
|
+
version = "1.1.3"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"memchr",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[[package]]
|
|
21
|
+
name = "arc-swap"
|
|
22
|
+
version = "1.7.1"
|
|
23
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
+
checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
|
|
25
|
+
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "arraydeque"
|
|
28
|
+
version = "0.5.1"
|
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
+
checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "autocfg"
|
|
34
|
+
version = "1.4.0"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
|
37
|
+
|
|
38
|
+
[[package]]
|
|
39
|
+
name = "cfg-if"
|
|
40
|
+
version = "1.0.0"
|
|
41
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
+
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
43
|
+
|
|
44
|
+
[[package]]
|
|
45
|
+
name = "colored"
|
|
46
|
+
version = "2.2.0"
|
|
47
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
48
|
+
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
|
49
|
+
dependencies = [
|
|
50
|
+
"lazy_static",
|
|
51
|
+
"windows-sys 0.59.0",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[[package]]
|
|
55
|
+
name = "crc32fast"
|
|
56
|
+
version = "1.4.2"
|
|
57
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
58
|
+
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
|
|
59
|
+
dependencies = [
|
|
60
|
+
"cfg-if",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[[package]]
|
|
64
|
+
name = "csv"
|
|
65
|
+
version = "1.3.1"
|
|
66
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
67
|
+
checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf"
|
|
68
|
+
dependencies = [
|
|
69
|
+
"csv-core",
|
|
70
|
+
"itoa",
|
|
71
|
+
"ryu",
|
|
72
|
+
"serde",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[[package]]
|
|
76
|
+
name = "csv-core"
|
|
77
|
+
version = "0.1.12"
|
|
78
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
79
|
+
checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d"
|
|
80
|
+
dependencies = [
|
|
81
|
+
"memchr",
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
[[package]]
|
|
85
|
+
name = "csv_validation"
|
|
86
|
+
version = "0.0.1"
|
|
87
|
+
dependencies = [
|
|
88
|
+
"csv",
|
|
89
|
+
"flate2",
|
|
90
|
+
"log",
|
|
91
|
+
"pyo3",
|
|
92
|
+
"pyo3-log",
|
|
93
|
+
"regex",
|
|
94
|
+
"simple_logger",
|
|
95
|
+
"yaml-rust2",
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[[package]]
|
|
99
|
+
name = "deranged"
|
|
100
|
+
version = "0.3.11"
|
|
101
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
102
|
+
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
|
|
103
|
+
dependencies = [
|
|
104
|
+
"powerfmt",
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
[[package]]
|
|
108
|
+
name = "encoding_rs"
|
|
109
|
+
version = "0.8.35"
|
|
110
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
111
|
+
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
|
|
112
|
+
dependencies = [
|
|
113
|
+
"cfg-if",
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
[[package]]
|
|
117
|
+
name = "flate2"
|
|
118
|
+
version = "1.1.0"
|
|
119
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
120
|
+
checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc"
|
|
121
|
+
dependencies = [
|
|
122
|
+
"crc32fast",
|
|
123
|
+
"miniz_oxide",
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[[package]]
|
|
127
|
+
name = "foldhash"
|
|
128
|
+
version = "0.1.4"
|
|
129
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
130
|
+
checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
|
|
131
|
+
|
|
132
|
+
[[package]]
|
|
133
|
+
name = "hashbrown"
|
|
134
|
+
version = "0.15.2"
|
|
135
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
136
|
+
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
|
|
137
|
+
dependencies = [
|
|
138
|
+
"foldhash",
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
[[package]]
|
|
142
|
+
name = "hashlink"
|
|
143
|
+
version = "0.10.0"
|
|
144
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
145
|
+
checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
|
|
146
|
+
dependencies = [
|
|
147
|
+
"hashbrown",
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
[[package]]
|
|
151
|
+
name = "heck"
|
|
152
|
+
version = "0.5.0"
|
|
153
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
154
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
155
|
+
|
|
156
|
+
[[package]]
|
|
157
|
+
name = "indoc"
|
|
158
|
+
version = "2.0.6"
|
|
159
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
160
|
+
checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
|
|
161
|
+
|
|
162
|
+
[[package]]
|
|
163
|
+
name = "itoa"
|
|
164
|
+
version = "1.0.15"
|
|
165
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
166
|
+
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
|
167
|
+
|
|
168
|
+
[[package]]
|
|
169
|
+
name = "lazy_static"
|
|
170
|
+
version = "1.5.0"
|
|
171
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
173
|
+
|
|
174
|
+
[[package]]
|
|
175
|
+
name = "libc"
|
|
176
|
+
version = "0.2.170"
|
|
177
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
178
|
+
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
|
|
179
|
+
|
|
180
|
+
[[package]]
|
|
181
|
+
name = "log"
|
|
182
|
+
version = "0.4.26"
|
|
183
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
184
|
+
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
|
185
|
+
|
|
186
|
+
[[package]]
|
|
187
|
+
name = "memchr"
|
|
188
|
+
version = "2.7.4"
|
|
189
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
190
|
+
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
|
191
|
+
|
|
192
|
+
[[package]]
|
|
193
|
+
name = "memoffset"
|
|
194
|
+
version = "0.9.1"
|
|
195
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
196
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
197
|
+
dependencies = [
|
|
198
|
+
"autocfg",
|
|
199
|
+
]
|
|
200
|
+
|
|
201
|
+
[[package]]
|
|
202
|
+
name = "miniz_oxide"
|
|
203
|
+
version = "0.8.5"
|
|
204
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
205
|
+
checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5"
|
|
206
|
+
dependencies = [
|
|
207
|
+
"adler2",
|
|
208
|
+
]
|
|
209
|
+
|
|
210
|
+
[[package]]
|
|
211
|
+
name = "num-conv"
|
|
212
|
+
version = "0.1.0"
|
|
213
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
214
|
+
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
|
215
|
+
|
|
216
|
+
[[package]]
|
|
217
|
+
name = "num_threads"
|
|
218
|
+
version = "0.1.7"
|
|
219
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
220
|
+
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
|
221
|
+
dependencies = [
|
|
222
|
+
"libc",
|
|
223
|
+
]
|
|
224
|
+
|
|
225
|
+
[[package]]
|
|
226
|
+
name = "once_cell"
|
|
227
|
+
version = "1.20.3"
|
|
228
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
229
|
+
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
|
|
230
|
+
|
|
231
|
+
[[package]]
|
|
232
|
+
name = "portable-atomic"
|
|
233
|
+
version = "1.11.0"
|
|
234
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
235
|
+
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
|
236
|
+
|
|
237
|
+
[[package]]
|
|
238
|
+
name = "powerfmt"
|
|
239
|
+
version = "0.2.0"
|
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
241
|
+
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|
242
|
+
|
|
243
|
+
[[package]]
|
|
244
|
+
name = "proc-macro2"
|
|
245
|
+
version = "1.0.94"
|
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
+
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
|
|
248
|
+
dependencies = [
|
|
249
|
+
"unicode-ident",
|
|
250
|
+
]
|
|
251
|
+
|
|
252
|
+
[[package]]
|
|
253
|
+
name = "pyo3"
|
|
254
|
+
version = "0.23.5"
|
|
255
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
256
|
+
checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
|
|
257
|
+
dependencies = [
|
|
258
|
+
"cfg-if",
|
|
259
|
+
"indoc",
|
|
260
|
+
"libc",
|
|
261
|
+
"memoffset",
|
|
262
|
+
"once_cell",
|
|
263
|
+
"portable-atomic",
|
|
264
|
+
"pyo3-build-config",
|
|
265
|
+
"pyo3-ffi",
|
|
266
|
+
"pyo3-macros",
|
|
267
|
+
"unindent",
|
|
268
|
+
]
|
|
269
|
+
|
|
270
|
+
[[package]]
|
|
271
|
+
name = "pyo3-build-config"
|
|
272
|
+
version = "0.23.5"
|
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
+
checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
|
|
275
|
+
dependencies = [
|
|
276
|
+
"once_cell",
|
|
277
|
+
"target-lexicon",
|
|
278
|
+
]
|
|
279
|
+
|
|
280
|
+
[[package]]
|
|
281
|
+
name = "pyo3-ffi"
|
|
282
|
+
version = "0.23.5"
|
|
283
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
284
|
+
checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
|
|
285
|
+
dependencies = [
|
|
286
|
+
"libc",
|
|
287
|
+
"pyo3-build-config",
|
|
288
|
+
]
|
|
289
|
+
|
|
290
|
+
[[package]]
|
|
291
|
+
name = "pyo3-log"
|
|
292
|
+
version = "0.12.1"
|
|
293
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
294
|
+
checksum = "be5bb22b77965a7b5394e9aae9897a0607b51df5167561ffc3b02643b4200bc7"
|
|
295
|
+
dependencies = [
|
|
296
|
+
"arc-swap",
|
|
297
|
+
"log",
|
|
298
|
+
"pyo3",
|
|
299
|
+
]
|
|
300
|
+
|
|
301
|
+
[[package]]
|
|
302
|
+
name = "pyo3-macros"
|
|
303
|
+
version = "0.23.5"
|
|
304
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
305
|
+
checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
|
|
306
|
+
dependencies = [
|
|
307
|
+
"proc-macro2",
|
|
308
|
+
"pyo3-macros-backend",
|
|
309
|
+
"quote",
|
|
310
|
+
"syn",
|
|
311
|
+
]
|
|
312
|
+
|
|
313
|
+
[[package]]
|
|
314
|
+
name = "pyo3-macros-backend"
|
|
315
|
+
version = "0.23.5"
|
|
316
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
317
|
+
checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
|
|
318
|
+
dependencies = [
|
|
319
|
+
"heck",
|
|
320
|
+
"proc-macro2",
|
|
321
|
+
"pyo3-build-config",
|
|
322
|
+
"quote",
|
|
323
|
+
"syn",
|
|
324
|
+
]
|
|
325
|
+
|
|
326
|
+
[[package]]
|
|
327
|
+
name = "quote"
|
|
328
|
+
version = "1.0.39"
|
|
329
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
330
|
+
checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801"
|
|
331
|
+
dependencies = [
|
|
332
|
+
"proc-macro2",
|
|
333
|
+
]
|
|
334
|
+
|
|
335
|
+
[[package]]
|
|
336
|
+
name = "regex"
|
|
337
|
+
version = "1.11.1"
|
|
338
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
339
|
+
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
|
340
|
+
dependencies = [
|
|
341
|
+
"aho-corasick",
|
|
342
|
+
"memchr",
|
|
343
|
+
"regex-automata",
|
|
344
|
+
"regex-syntax",
|
|
345
|
+
]
|
|
346
|
+
|
|
347
|
+
[[package]]
|
|
348
|
+
name = "regex-automata"
|
|
349
|
+
version = "0.4.9"
|
|
350
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
351
|
+
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
|
352
|
+
dependencies = [
|
|
353
|
+
"aho-corasick",
|
|
354
|
+
"memchr",
|
|
355
|
+
"regex-syntax",
|
|
356
|
+
]
|
|
357
|
+
|
|
358
|
+
[[package]]
|
|
359
|
+
name = "regex-syntax"
|
|
360
|
+
version = "0.8.5"
|
|
361
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
362
|
+
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
|
363
|
+
|
|
364
|
+
[[package]]
|
|
365
|
+
name = "ryu"
|
|
366
|
+
version = "1.0.20"
|
|
367
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
368
|
+
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
|
369
|
+
|
|
370
|
+
[[package]]
|
|
371
|
+
name = "serde"
|
|
372
|
+
version = "1.0.218"
|
|
373
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
374
|
+
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
|
375
|
+
dependencies = [
|
|
376
|
+
"serde_derive",
|
|
377
|
+
]
|
|
378
|
+
|
|
379
|
+
[[package]]
|
|
380
|
+
name = "serde_derive"
|
|
381
|
+
version = "1.0.218"
|
|
382
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
383
|
+
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
|
384
|
+
dependencies = [
|
|
385
|
+
"proc-macro2",
|
|
386
|
+
"quote",
|
|
387
|
+
"syn",
|
|
388
|
+
]
|
|
389
|
+
|
|
390
|
+
[[package]]
|
|
391
|
+
name = "simple_logger"
|
|
392
|
+
version = "5.0.0"
|
|
393
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
394
|
+
checksum = "e8c5dfa5e08767553704aa0ffd9d9794d527103c736aba9854773851fd7497eb"
|
|
395
|
+
dependencies = [
|
|
396
|
+
"colored",
|
|
397
|
+
"log",
|
|
398
|
+
"time",
|
|
399
|
+
"windows-sys 0.48.0",
|
|
400
|
+
]
|
|
401
|
+
|
|
402
|
+
[[package]]
|
|
403
|
+
name = "syn"
|
|
404
|
+
version = "2.0.99"
|
|
405
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
406
|
+
checksum = "e02e925281e18ffd9d640e234264753c43edc62d64b2d4cf898f1bc5e75f3fc2"
|
|
407
|
+
dependencies = [
|
|
408
|
+
"proc-macro2",
|
|
409
|
+
"quote",
|
|
410
|
+
"unicode-ident",
|
|
411
|
+
]
|
|
412
|
+
|
|
413
|
+
[[package]]
|
|
414
|
+
name = "target-lexicon"
|
|
415
|
+
version = "0.12.16"
|
|
416
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
417
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
418
|
+
|
|
419
|
+
[[package]]
|
|
420
|
+
name = "time"
|
|
421
|
+
version = "0.3.37"
|
|
422
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
423
|
+
checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21"
|
|
424
|
+
dependencies = [
|
|
425
|
+
"deranged",
|
|
426
|
+
"itoa",
|
|
427
|
+
"libc",
|
|
428
|
+
"num-conv",
|
|
429
|
+
"num_threads",
|
|
430
|
+
"powerfmt",
|
|
431
|
+
"serde",
|
|
432
|
+
"time-core",
|
|
433
|
+
"time-macros",
|
|
434
|
+
]
|
|
435
|
+
|
|
436
|
+
[[package]]
|
|
437
|
+
name = "time-core"
|
|
438
|
+
version = "0.1.2"
|
|
439
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
440
|
+
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
|
441
|
+
|
|
442
|
+
[[package]]
|
|
443
|
+
name = "time-macros"
|
|
444
|
+
version = "0.2.19"
|
|
445
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
446
|
+
checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de"
|
|
447
|
+
dependencies = [
|
|
448
|
+
"num-conv",
|
|
449
|
+
"time-core",
|
|
450
|
+
]
|
|
451
|
+
|
|
452
|
+
[[package]]
|
|
453
|
+
name = "unicode-ident"
|
|
454
|
+
version = "1.0.18"
|
|
455
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
456
|
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
|
457
|
+
|
|
458
|
+
[[package]]
|
|
459
|
+
name = "unindent"
|
|
460
|
+
version = "0.2.4"
|
|
461
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
462
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
463
|
+
|
|
464
|
+
[[package]]
|
|
465
|
+
name = "windows-sys"
|
|
466
|
+
version = "0.48.0"
|
|
467
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
468
|
+
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
|
469
|
+
dependencies = [
|
|
470
|
+
"windows-targets 0.48.5",
|
|
471
|
+
]
|
|
472
|
+
|
|
473
|
+
[[package]]
|
|
474
|
+
name = "windows-sys"
|
|
475
|
+
version = "0.59.0"
|
|
476
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
477
|
+
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
|
478
|
+
dependencies = [
|
|
479
|
+
"windows-targets 0.52.6",
|
|
480
|
+
]
|
|
481
|
+
|
|
482
|
+
[[package]]
|
|
483
|
+
name = "windows-targets"
|
|
484
|
+
version = "0.48.5"
|
|
485
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
486
|
+
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
|
487
|
+
dependencies = [
|
|
488
|
+
"windows_aarch64_gnullvm 0.48.5",
|
|
489
|
+
"windows_aarch64_msvc 0.48.5",
|
|
490
|
+
"windows_i686_gnu 0.48.5",
|
|
491
|
+
"windows_i686_msvc 0.48.5",
|
|
492
|
+
"windows_x86_64_gnu 0.48.5",
|
|
493
|
+
"windows_x86_64_gnullvm 0.48.5",
|
|
494
|
+
"windows_x86_64_msvc 0.48.5",
|
|
495
|
+
]
|
|
496
|
+
|
|
497
|
+
[[package]]
|
|
498
|
+
name = "windows-targets"
|
|
499
|
+
version = "0.52.6"
|
|
500
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
501
|
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
|
502
|
+
dependencies = [
|
|
503
|
+
"windows_aarch64_gnullvm 0.52.6",
|
|
504
|
+
"windows_aarch64_msvc 0.52.6",
|
|
505
|
+
"windows_i686_gnu 0.52.6",
|
|
506
|
+
"windows_i686_gnullvm",
|
|
507
|
+
"windows_i686_msvc 0.52.6",
|
|
508
|
+
"windows_x86_64_gnu 0.52.6",
|
|
509
|
+
"windows_x86_64_gnullvm 0.52.6",
|
|
510
|
+
"windows_x86_64_msvc 0.52.6",
|
|
511
|
+
]
|
|
512
|
+
|
|
513
|
+
[[package]]
|
|
514
|
+
name = "windows_aarch64_gnullvm"
|
|
515
|
+
version = "0.48.5"
|
|
516
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
517
|
+
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
|
518
|
+
|
|
519
|
+
[[package]]
|
|
520
|
+
name = "windows_aarch64_gnullvm"
|
|
521
|
+
version = "0.52.6"
|
|
522
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
523
|
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
|
524
|
+
|
|
525
|
+
[[package]]
|
|
526
|
+
name = "windows_aarch64_msvc"
|
|
527
|
+
version = "0.48.5"
|
|
528
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
529
|
+
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
|
530
|
+
|
|
531
|
+
[[package]]
|
|
532
|
+
name = "windows_aarch64_msvc"
|
|
533
|
+
version = "0.52.6"
|
|
534
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
535
|
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
|
536
|
+
|
|
537
|
+
[[package]]
|
|
538
|
+
name = "windows_i686_gnu"
|
|
539
|
+
version = "0.48.5"
|
|
540
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
541
|
+
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
|
542
|
+
|
|
543
|
+
[[package]]
|
|
544
|
+
name = "windows_i686_gnu"
|
|
545
|
+
version = "0.52.6"
|
|
546
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
547
|
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
|
548
|
+
|
|
549
|
+
[[package]]
|
|
550
|
+
name = "windows_i686_gnullvm"
|
|
551
|
+
version = "0.52.6"
|
|
552
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
553
|
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
|
554
|
+
|
|
555
|
+
[[package]]
|
|
556
|
+
name = "windows_i686_msvc"
|
|
557
|
+
version = "0.48.5"
|
|
558
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
559
|
+
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
|
560
|
+
|
|
561
|
+
[[package]]
|
|
562
|
+
name = "windows_i686_msvc"
|
|
563
|
+
version = "0.52.6"
|
|
564
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
565
|
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
|
566
|
+
|
|
567
|
+
[[package]]
|
|
568
|
+
name = "windows_x86_64_gnu"
|
|
569
|
+
version = "0.48.5"
|
|
570
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
571
|
+
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
|
572
|
+
|
|
573
|
+
[[package]]
|
|
574
|
+
name = "windows_x86_64_gnu"
|
|
575
|
+
version = "0.52.6"
|
|
576
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
577
|
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
|
578
|
+
|
|
579
|
+
[[package]]
|
|
580
|
+
name = "windows_x86_64_gnullvm"
|
|
581
|
+
version = "0.48.5"
|
|
582
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
583
|
+
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
|
584
|
+
|
|
585
|
+
[[package]]
|
|
586
|
+
name = "windows_x86_64_gnullvm"
|
|
587
|
+
version = "0.52.6"
|
|
588
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
589
|
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
|
590
|
+
|
|
591
|
+
[[package]]
|
|
592
|
+
name = "windows_x86_64_msvc"
|
|
593
|
+
version = "0.48.5"
|
|
594
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
595
|
+
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|
596
|
+
|
|
597
|
+
[[package]]
|
|
598
|
+
name = "windows_x86_64_msvc"
|
|
599
|
+
version = "0.52.6"
|
|
600
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
601
|
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
602
|
+
|
|
603
|
+
[[package]]
|
|
604
|
+
name = "yaml-rust2"
|
|
605
|
+
version = "0.10.0"
|
|
606
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
607
|
+
checksum = "232bdb534d65520716bef0bbb205ff8f2db72d807b19c0bc3020853b92a0cd4b"
|
|
608
|
+
dependencies = [
|
|
609
|
+
"arraydeque",
|
|
610
|
+
"encoding_rs",
|
|
611
|
+
"hashlink",
|
|
612
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "csv_validation"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
7
|
+
[lib]
|
|
8
|
+
name = "csv_validation"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
csv = "1.3.1"
|
|
13
|
+
flate2 = "1.1.0"
|
|
14
|
+
log = "0.4.26"
|
|
15
|
+
pyo3 = "0.23.3"
|
|
16
|
+
pyo3-log = "0.12.1"
|
|
17
|
+
regex = "1.11.1"
|
|
18
|
+
simple_logger = "5.0.0"
|
|
19
|
+
yaml-rust2 = "0.10.0"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: csv_validation
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Requires-Python: >=3.8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
maturin build --release
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.8,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "csv_validation"
|
|
7
|
+
requires-python = ">=3.8"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Programming Language :: Rust",
|
|
10
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
11
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
12
|
+
]
|
|
13
|
+
dynamic = ["version"]
|
|
14
|
+
[tool.maturin]
|
|
15
|
+
features = ["pyo3/extension-module"]
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
use std::fs;
|
|
2
|
+
use std::fs::File;
|
|
3
|
+
use std::io::{BufReader, Read};
|
|
4
|
+
use std::iter::zip;
|
|
5
|
+
use std::path::Path;
|
|
6
|
+
use csv::Reader;
|
|
7
|
+
use flate2::bufread::GzDecoder;
|
|
8
|
+
use log::info;
|
|
9
|
+
use pyo3::prelude::*;
|
|
10
|
+
use regex::Regex;
|
|
11
|
+
use yaml_rust2::YamlLoader;
|
|
12
|
+
|
|
13
|
+
struct ColumnValidation {
|
|
14
|
+
column_name: String,
|
|
15
|
+
validation: Regex
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// Validate that CSV file complies with validations definition
|
|
19
|
+
#[pyfunction]
|
|
20
|
+
fn validate(path: &str, definition_path: &str) -> PyResult<bool> {
|
|
21
|
+
info!("Validating file {} against definition {}", path, definition_path);
|
|
22
|
+
|
|
23
|
+
let validations = get_validations(definition_path);
|
|
24
|
+
|
|
25
|
+
// Build the CSV reader
|
|
26
|
+
let mut rdr = get_reader_from(path);
|
|
27
|
+
|
|
28
|
+
// First validation: Ensure column names and order are exactly as expected
|
|
29
|
+
if validate_column_names(&mut rdr, &validations) {
|
|
30
|
+
info!("Columns names and order are correct");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
info!("Expected columns != Real columns");
|
|
34
|
+
return Ok(false);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
for result in rdr.records() {
|
|
38
|
+
let record = result.unwrap();
|
|
39
|
+
for next_column in zip(record.iter(), validations.iter()) {
|
|
40
|
+
let value = next_column.0;
|
|
41
|
+
let column_name = &next_column.1.column_name;
|
|
42
|
+
let re = &next_column.1.validation;
|
|
43
|
+
if !re.is_match(value) {
|
|
44
|
+
info!("Column [{}] => Value {:?} doesn't match regex {:?}", column_name, value, re);
|
|
45
|
+
return Ok(false);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
info!("File matches the validations");
|
|
51
|
+
Ok(true)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Infers the file compression type and returns the corresponding buffered reader
|
|
55
|
+
fn get_reader_from(path: &str) -> Reader<Box<dyn Read>> {
|
|
56
|
+
let buf_reader = BufReader::new(File::open(Path::new(path)).unwrap());
|
|
57
|
+
if is_gzip_file(path) {
|
|
58
|
+
info!("File is gzipped");
|
|
59
|
+
let read_capacity = 10 * 1024_usize.pow(2);
|
|
60
|
+
let reader = BufReader::with_capacity(read_capacity, GzDecoder::new(buf_reader));
|
|
61
|
+
Reader::from_reader(Box::new(reader))
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
Reader::from_reader(Box::new(buf_reader))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
fn is_gzip_file(path: &str) -> bool {
|
|
69
|
+
let mut bytes = [0u8; 2];
|
|
70
|
+
File::open(Path::new(path)).unwrap().read_exact(&mut bytes).unwrap();
|
|
71
|
+
bytes[0] == 0x1f && bytes[1] == 0x8b
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fn get_validations(definition_path: &str) -> Vec<ColumnValidation> {
|
|
75
|
+
// Read the YAML definition with the validations
|
|
76
|
+
let config =
|
|
77
|
+
YamlLoader::load_from_str(fs::read_to_string(definition_path).unwrap().as_str()).unwrap();
|
|
78
|
+
// Get the column names list and each associated validation
|
|
79
|
+
let columns = &config[0]["columns"];
|
|
80
|
+
let mut column_names = vec![];
|
|
81
|
+
let mut validations = vec![];
|
|
82
|
+
for column in columns.as_vec().unwrap() {
|
|
83
|
+
let column_def = column.as_hash().unwrap();
|
|
84
|
+
let mut name = "";
|
|
85
|
+
let mut regex = "";
|
|
86
|
+
for validation in column_def.iter() {
|
|
87
|
+
let key = validation.0.as_str().unwrap();
|
|
88
|
+
let value = validation.1.as_str().unwrap();
|
|
89
|
+
|
|
90
|
+
if key == "name" {
|
|
91
|
+
name = value;
|
|
92
|
+
column_names.push(name);
|
|
93
|
+
}
|
|
94
|
+
if key == "regex" {
|
|
95
|
+
regex = value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
let new_validation = ColumnValidation { column_name: name.to_string(), validation: Regex::new(®ex).unwrap() };
|
|
99
|
+
validations.push(new_validation);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
validations
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
fn validate_column_names(reader: &mut Reader<Box<dyn Read>>, validations: &Vec<ColumnValidation>) -> bool {
|
|
106
|
+
let column_names = validations.iter()
|
|
107
|
+
.map(|v| v.column_name.clone())
|
|
108
|
+
.collect::<Vec<String>>();
|
|
109
|
+
info!("Expected Column Names: {:?}", column_names);
|
|
110
|
+
|
|
111
|
+
let headers: Vec<&str> = reader.headers().unwrap().iter().collect();
|
|
112
|
+
info!("Actual Column Names: {:?}", headers);
|
|
113
|
+
|
|
114
|
+
column_names == headers
|
|
115
|
+
}
|
|
116
|
+
/// A Python module implemented in Rust.
|
|
117
|
+
#[pymodule]
|
|
118
|
+
fn csv_validation(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
119
|
+
pyo3_log::init();
|
|
120
|
+
m.add_function(wrap_pyfunction!(validate, m)?)?;
|
|
121
|
+
Ok(())
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
#[cfg(test)]
|
|
126
|
+
mod tests {
|
|
127
|
+
use simple_logger::SimpleLogger;
|
|
128
|
+
use crate::validate;
|
|
129
|
+
|
|
130
|
+
#[test]
|
|
131
|
+
fn test_validate_csv() {
|
|
132
|
+
SimpleLogger::new().init().unwrap();
|
|
133
|
+
assert!(validate("test/test_file.csv", "test/test_validations.yml").unwrap());
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#[test]
|
|
137
|
+
fn test_validate_csv_gz() {
|
|
138
|
+
assert!(validate("test/test_file.csv.gz", "test/test_validations.yml").unwrap());
|
|
139
|
+
}
|
|
140
|
+
}
|
|
Binary file
|