prelude-parser 0.3.1__tar.gz → 0.3.2__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.
Files changed (33) hide show
  1. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/.github/workflows/testing.yml +1 -4
  2. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/Cargo.lock +78 -141
  3. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/Cargo.toml +1 -1
  4. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/PKG-INFO +1 -1
  5. prelude_parser-0.3.2/prelude_parser/_prelude_parser.pyi +20 -0
  6. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/prelude_parser/pandas.py +3 -2
  7. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/prelude_parser/parser.py +8 -4
  8. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/prelude_parser/polars.py +3 -2
  9. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/src/lib.rs +34 -18
  10. prelude_parser-0.3.2/tests/assets/test4.xml +14 -0
  11. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/conftest.py +5 -0
  12. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/test_pandas.py +12 -0
  13. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/test_parser.py +28 -0
  14. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/test_polars.py +11 -0
  15. prelude_parser-0.3.1/prelude_parser/_prelude_parser.pyi +0 -16
  16. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/.github/dependabot.yml +0 -0
  17. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/.github/release-draft-template.yml +0 -0
  18. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/.github/workflows/pypi_publish.yml +0 -0
  19. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/.github/workflows/release-drafter.yml +0 -0
  20. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/.gitignore +0 -0
  21. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/.pre-commit-config.yaml +0 -0
  22. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/CONTRIBUTING.md +0 -0
  23. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/LICENSE +0 -0
  24. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/README.md +0 -0
  25. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/justfile +0 -0
  26. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/prelude_parser/__init__.py +0 -0
  27. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/prelude_parser/py.typed +0 -0
  28. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/pyproject.toml +0 -0
  29. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/requirements-dev.txt +0 -0
  30. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/__init__.py +0 -0
  31. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/assets/test1.xml +0 -0
  32. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/assets/test2.xml +0 -0
  33. {prelude_parser-0.3.1 → prelude_parser-0.3.2}/tests/assets/test3.xml +0 -0
@@ -20,10 +20,7 @@ jobs:
20
20
  - name: Cache dependencies
21
21
  uses: Swatinem/rust-cache@v2.7.0
22
22
  - name: Run cargo clippy
23
- uses: actions-rs/cargo@v1
24
- with:
25
- command: clippy
26
- args: --all-targets -- --deny warnings
23
+ run: cargo clippy --all-targets -- --deny warnings
27
24
  fmt:
28
25
  name: Rustfmt
29
26
  runs-on: ubuntu-latest
@@ -31,15 +31,18 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
31
31
 
32
32
  [[package]]
33
33
  name = "bumpalo"
34
- version = "3.13.0"
34
+ version = "3.14.0"
35
35
  source = "registry+https://github.com/rust-lang/crates.io-index"
36
- checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
36
+ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
37
37
 
38
38
  [[package]]
39
39
  name = "cc"
40
- version = "1.0.79"
40
+ version = "1.0.83"
41
41
  source = "registry+https://github.com/rust-lang/crates.io-index"
42
- checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
42
+ checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
43
+ dependencies = [
44
+ "libc",
45
+ ]
43
46
 
44
47
  [[package]]
45
48
  name = "cfg-if"
@@ -58,7 +61,7 @@ dependencies = [
58
61
  "js-sys",
59
62
  "num-traits",
60
63
  "wasm-bindgen",
61
- "windows-targets 0.48.0",
64
+ "windows-targets",
62
65
  ]
63
66
 
64
67
  [[package]]
@@ -69,9 +72,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
69
72
 
70
73
  [[package]]
71
74
  name = "iana-time-zone"
72
- version = "0.1.56"
75
+ version = "0.1.57"
73
76
  source = "registry+https://github.com/rust-lang/crates.io-index"
74
- checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
77
+ checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
75
78
  dependencies = [
76
79
  "android_system_properties",
77
80
  "core-foundation-sys",
@@ -98,24 +101,24 @@ checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306"
98
101
 
99
102
  [[package]]
100
103
  name = "js-sys"
101
- version = "0.3.63"
104
+ version = "0.3.64"
102
105
  source = "registry+https://github.com/rust-lang/crates.io-index"
103
- checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790"
106
+ checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
104
107
  dependencies = [
105
108
  "wasm-bindgen",
106
109
  ]
107
110
 
108
111
  [[package]]
109
112
  name = "libc"
110
- version = "0.2.141"
113
+ version = "0.2.149"
111
114
  source = "registry+https://github.com/rust-lang/crates.io-index"
112
- checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
115
+ checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
113
116
 
114
117
  [[package]]
115
118
  name = "lock_api"
116
- version = "0.4.9"
119
+ version = "0.4.10"
117
120
  source = "registry+https://github.com/rust-lang/crates.io-index"
118
- checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
121
+ checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
119
122
  dependencies = [
120
123
  "autocfg",
121
124
  "scopeguard",
@@ -123,9 +126,9 @@ dependencies = [
123
126
 
124
127
  [[package]]
125
128
  name = "log"
126
- version = "0.4.18"
129
+ version = "0.4.20"
127
130
  source = "registry+https://github.com/rust-lang/crates.io-index"
128
- checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
131
+ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
129
132
 
130
133
  [[package]]
131
134
  name = "memoffset"
@@ -138,18 +141,18 @@ dependencies = [
138
141
 
139
142
  [[package]]
140
143
  name = "num-traits"
141
- version = "0.2.15"
144
+ version = "0.2.16"
142
145
  source = "registry+https://github.com/rust-lang/crates.io-index"
143
- checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
146
+ checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
144
147
  dependencies = [
145
148
  "autocfg",
146
149
  ]
147
150
 
148
151
  [[package]]
149
152
  name = "once_cell"
150
- version = "1.17.1"
153
+ version = "1.18.0"
151
154
  source = "registry+https://github.com/rust-lang/crates.io-index"
152
- checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
155
+ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
153
156
 
154
157
  [[package]]
155
158
  name = "parking_lot"
@@ -163,20 +166,20 @@ dependencies = [
163
166
 
164
167
  [[package]]
165
168
  name = "parking_lot_core"
166
- version = "0.9.7"
169
+ version = "0.9.8"
167
170
  source = "registry+https://github.com/rust-lang/crates.io-index"
168
- checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
171
+ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
169
172
  dependencies = [
170
173
  "cfg-if",
171
174
  "libc",
172
175
  "redox_syscall",
173
176
  "smallvec",
174
- "windows-sys",
177
+ "windows-targets",
175
178
  ]
176
179
 
177
180
  [[package]]
178
181
  name = "prelude-parser"
179
- version = "0.3.1"
182
+ version = "0.3.2"
180
183
  dependencies = [
181
184
  "chrono",
182
185
  "pyo3",
@@ -185,9 +188,9 @@ dependencies = [
185
188
 
186
189
  [[package]]
187
190
  name = "proc-macro2"
188
- version = "1.0.59"
191
+ version = "1.0.68"
189
192
  source = "registry+https://github.com/rust-lang/crates.io-index"
190
- checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
193
+ checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c"
191
194
  dependencies = [
192
195
  "unicode-ident",
193
196
  ]
@@ -254,18 +257,18 @@ dependencies = [
254
257
 
255
258
  [[package]]
256
259
  name = "quote"
257
- version = "1.0.28"
260
+ version = "1.0.33"
258
261
  source = "registry+https://github.com/rust-lang/crates.io-index"
259
- checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
262
+ checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
260
263
  dependencies = [
261
264
  "proc-macro2",
262
265
  ]
263
266
 
264
267
  [[package]]
265
268
  name = "redox_syscall"
266
- version = "0.2.16"
269
+ version = "0.3.5"
267
270
  source = "registry+https://github.com/rust-lang/crates.io-index"
268
- checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
271
+ checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
269
272
  dependencies = [
270
273
  "bitflags",
271
274
  ]
@@ -281,15 +284,15 @@ dependencies = [
281
284
 
282
285
  [[package]]
283
286
  name = "scopeguard"
284
- version = "1.1.0"
287
+ version = "1.2.0"
285
288
  source = "registry+https://github.com/rust-lang/crates.io-index"
286
- checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
289
+ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
287
290
 
288
291
  [[package]]
289
292
  name = "smallvec"
290
- version = "1.10.0"
293
+ version = "1.11.1"
291
294
  source = "registry+https://github.com/rust-lang/crates.io-index"
292
- checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
295
+ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
293
296
 
294
297
  [[package]]
295
298
  name = "syn"
@@ -304,9 +307,9 @@ dependencies = [
304
307
 
305
308
  [[package]]
306
309
  name = "syn"
307
- version = "2.0.18"
310
+ version = "2.0.38"
308
311
  source = "registry+https://github.com/rust-lang/crates.io-index"
309
- checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
312
+ checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
310
313
  dependencies = [
311
314
  "proc-macro2",
312
315
  "quote",
@@ -315,15 +318,15 @@ dependencies = [
315
318
 
316
319
  [[package]]
317
320
  name = "target-lexicon"
318
- version = "0.12.6"
321
+ version = "0.12.11"
319
322
  source = "registry+https://github.com/rust-lang/crates.io-index"
320
- checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5"
323
+ checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a"
321
324
 
322
325
  [[package]]
323
326
  name = "unicode-ident"
324
- version = "1.0.8"
327
+ version = "1.0.12"
325
328
  source = "registry+https://github.com/rust-lang/crates.io-index"
326
- checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
329
+ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
327
330
 
328
331
  [[package]]
329
332
  name = "unindent"
@@ -333,9 +336,9 @@ checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
333
336
 
334
337
  [[package]]
335
338
  name = "wasm-bindgen"
336
- version = "0.2.86"
339
+ version = "0.2.87"
337
340
  source = "registry+https://github.com/rust-lang/crates.io-index"
338
- checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73"
341
+ checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
339
342
  dependencies = [
340
343
  "cfg-if",
341
344
  "wasm-bindgen-macro",
@@ -343,24 +346,24 @@ dependencies = [
343
346
 
344
347
  [[package]]
345
348
  name = "wasm-bindgen-backend"
346
- version = "0.2.86"
349
+ version = "0.2.87"
347
350
  source = "registry+https://github.com/rust-lang/crates.io-index"
348
- checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb"
351
+ checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
349
352
  dependencies = [
350
353
  "bumpalo",
351
354
  "log",
352
355
  "once_cell",
353
356
  "proc-macro2",
354
357
  "quote",
355
- "syn 2.0.18",
358
+ "syn 2.0.38",
356
359
  "wasm-bindgen-shared",
357
360
  ]
358
361
 
359
362
  [[package]]
360
363
  name = "wasm-bindgen-macro"
361
- version = "0.2.86"
364
+ version = "0.2.87"
362
365
  source = "registry+https://github.com/rust-lang/crates.io-index"
363
- checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258"
366
+ checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
364
367
  dependencies = [
365
368
  "quote",
366
369
  "wasm-bindgen-macro-support",
@@ -368,22 +371,22 @@ dependencies = [
368
371
 
369
372
  [[package]]
370
373
  name = "wasm-bindgen-macro-support"
371
- version = "0.2.86"
374
+ version = "0.2.87"
372
375
  source = "registry+https://github.com/rust-lang/crates.io-index"
373
- checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8"
376
+ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
374
377
  dependencies = [
375
378
  "proc-macro2",
376
379
  "quote",
377
- "syn 2.0.18",
380
+ "syn 2.0.38",
378
381
  "wasm-bindgen-backend",
379
382
  "wasm-bindgen-shared",
380
383
  ]
381
384
 
382
385
  [[package]]
383
386
  name = "wasm-bindgen-shared"
384
- version = "0.2.86"
387
+ version = "0.2.87"
385
388
  source = "registry+https://github.com/rust-lang/crates.io-index"
386
- checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93"
389
+ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
387
390
 
388
391
  [[package]]
389
392
  name = "windows"
@@ -391,131 +394,65 @@ version = "0.48.0"
391
394
  source = "registry+https://github.com/rust-lang/crates.io-index"
392
395
  checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
393
396
  dependencies = [
394
- "windows-targets 0.48.0",
395
- ]
396
-
397
- [[package]]
398
- name = "windows-sys"
399
- version = "0.45.0"
400
- source = "registry+https://github.com/rust-lang/crates.io-index"
401
- checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
402
- dependencies = [
403
- "windows-targets 0.42.2",
397
+ "windows-targets",
404
398
  ]
405
399
 
406
400
  [[package]]
407
401
  name = "windows-targets"
408
- version = "0.42.2"
402
+ version = "0.48.5"
409
403
  source = "registry+https://github.com/rust-lang/crates.io-index"
410
- checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
404
+ checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
411
405
  dependencies = [
412
- "windows_aarch64_gnullvm 0.42.2",
413
- "windows_aarch64_msvc 0.42.2",
414
- "windows_i686_gnu 0.42.2",
415
- "windows_i686_msvc 0.42.2",
416
- "windows_x86_64_gnu 0.42.2",
417
- "windows_x86_64_gnullvm 0.42.2",
418
- "windows_x86_64_msvc 0.42.2",
419
- ]
420
-
421
- [[package]]
422
- name = "windows-targets"
423
- version = "0.48.0"
424
- source = "registry+https://github.com/rust-lang/crates.io-index"
425
- checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
426
- dependencies = [
427
- "windows_aarch64_gnullvm 0.48.0",
428
- "windows_aarch64_msvc 0.48.0",
429
- "windows_i686_gnu 0.48.0",
430
- "windows_i686_msvc 0.48.0",
431
- "windows_x86_64_gnu 0.48.0",
432
- "windows_x86_64_gnullvm 0.48.0",
433
- "windows_x86_64_msvc 0.48.0",
406
+ "windows_aarch64_gnullvm",
407
+ "windows_aarch64_msvc",
408
+ "windows_i686_gnu",
409
+ "windows_i686_msvc",
410
+ "windows_x86_64_gnu",
411
+ "windows_x86_64_gnullvm",
412
+ "windows_x86_64_msvc",
434
413
  ]
435
414
 
436
415
  [[package]]
437
416
  name = "windows_aarch64_gnullvm"
438
- version = "0.42.2"
417
+ version = "0.48.5"
439
418
  source = "registry+https://github.com/rust-lang/crates.io-index"
440
- checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
441
-
442
- [[package]]
443
- name = "windows_aarch64_gnullvm"
444
- version = "0.48.0"
445
- source = "registry+https://github.com/rust-lang/crates.io-index"
446
- checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
419
+ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
447
420
 
448
421
  [[package]]
449
422
  name = "windows_aarch64_msvc"
450
- version = "0.42.2"
423
+ version = "0.48.5"
451
424
  source = "registry+https://github.com/rust-lang/crates.io-index"
452
- checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
453
-
454
- [[package]]
455
- name = "windows_aarch64_msvc"
456
- version = "0.48.0"
457
- source = "registry+https://github.com/rust-lang/crates.io-index"
458
- checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
425
+ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
459
426
 
460
427
  [[package]]
461
428
  name = "windows_i686_gnu"
462
- version = "0.42.2"
429
+ version = "0.48.5"
463
430
  source = "registry+https://github.com/rust-lang/crates.io-index"
464
- checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
465
-
466
- [[package]]
467
- name = "windows_i686_gnu"
468
- version = "0.48.0"
469
- source = "registry+https://github.com/rust-lang/crates.io-index"
470
- checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
431
+ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
471
432
 
472
433
  [[package]]
473
434
  name = "windows_i686_msvc"
474
- version = "0.42.2"
475
- source = "registry+https://github.com/rust-lang/crates.io-index"
476
- checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
477
-
478
- [[package]]
479
- name = "windows_i686_msvc"
480
- version = "0.48.0"
481
- source = "registry+https://github.com/rust-lang/crates.io-index"
482
- checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
483
-
484
- [[package]]
485
- name = "windows_x86_64_gnu"
486
- version = "0.42.2"
435
+ version = "0.48.5"
487
436
  source = "registry+https://github.com/rust-lang/crates.io-index"
488
- checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
437
+ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
489
438
 
490
439
  [[package]]
491
440
  name = "windows_x86_64_gnu"
492
- version = "0.48.0"
441
+ version = "0.48.5"
493
442
  source = "registry+https://github.com/rust-lang/crates.io-index"
494
- checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
443
+ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
495
444
 
496
445
  [[package]]
497
446
  name = "windows_x86_64_gnullvm"
498
- version = "0.42.2"
447
+ version = "0.48.5"
499
448
  source = "registry+https://github.com/rust-lang/crates.io-index"
500
- checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
501
-
502
- [[package]]
503
- name = "windows_x86_64_gnullvm"
504
- version = "0.48.0"
505
- source = "registry+https://github.com/rust-lang/crates.io-index"
506
- checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
507
-
508
- [[package]]
509
- name = "windows_x86_64_msvc"
510
- version = "0.42.2"
511
- source = "registry+https://github.com/rust-lang/crates.io-index"
512
- checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
449
+ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
513
450
 
514
451
  [[package]]
515
452
  name = "windows_x86_64_msvc"
516
- version = "0.48.0"
453
+ version = "0.48.5"
517
454
  source = "registry+https://github.com/rust-lang/crates.io-index"
518
- checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
455
+ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
519
456
 
520
457
  [[package]]
521
458
  name = "xmlparser"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "prelude-parser"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "Parses XML files exported from Prelude EDC into formats usable by Python."
5
5
  edition = "2021"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prelude-parser
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: 3.8
@@ -0,0 +1,20 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from typing import Any
5
+
6
+ def _parse_flat_file_to_dict(
7
+ xml_file: str | Path, short_names: bool
8
+ ) -> dict[str, list[dict[str, Any]]]: ...
9
+ def _parse_flat_file_to_pandas_dict(
10
+ xml_file: str | Path, short_names: bool
11
+ ) -> dict[str, list[Any]]: ...
12
+
13
+ class FileNotFoundError(Exception):
14
+ pass
15
+
16
+ class InvalidFileTypeError(Exception):
17
+ pass
18
+
19
+ class ParsingError(Exception):
20
+ pass
@@ -19,7 +19,7 @@ except ImportError: # pragma: no cover
19
19
  raise ImportError("prelude-parser must be installed with the pandas or all extra to use pandas")
20
20
 
21
21
 
22
- def to_dataframe(xml_file: str | Path) -> pd.DataFrame:
22
+ def to_dataframe(xml_file: str | Path, *, short_names: bool = False) -> pd.DataFrame:
23
23
  """Parse a Prelude flat XML file into a Pandas DataFrame.
24
24
 
25
25
  This works for Prelude flat XML files that were exported with the "write tables to seperate
@@ -27,6 +27,7 @@ def to_dataframe(xml_file: str | Path) -> pd.DataFrame:
27
27
 
28
28
  Args:
29
29
  xml_file: The path to the XML file to parser.
30
+ short_names: Set to True if short names were used in the export.
30
31
 
31
32
  Returns:
32
33
  A Pandas DataFrame the data from the XML file.
@@ -35,5 +36,5 @@ def to_dataframe(xml_file: str | Path) -> pd.DataFrame:
35
36
  >>> from prelude_parser.pandas import to_dataframe
36
37
  >>> df = to_dataframe("physical_examination.xml")
37
38
  """
38
- data = _parse_flat_file_to_pandas_dict(xml_file)
39
+ data = _parse_flat_file_to_pandas_dict(xml_file, short_names)
39
40
  return pd.DataFrame.from_dict(data)
@@ -15,11 +15,14 @@ class _MetaCls(type):
15
15
  return super().__new__(cls, clsname, superclasses, attributedict)
16
16
 
17
17
 
18
- def parse_to_dict(xml_file: str | Path) -> dict[str, list[dict[str, Any]]]:
18
+ def parse_to_dict(
19
+ xml_file: str | Path, *, short_names: bool = False
20
+ ) -> dict[str, list[dict[str, Any]]]:
19
21
  """Parse a Prelude flat XML file into a dict.
20
22
 
21
23
  Args:
22
24
  xml_file: The path to the XML file to parser.
25
+ short_names: Set to True if short names were used in the export.
23
26
 
24
27
  Returns:
25
28
  A Python dictionary containing the data from the XML file.
@@ -28,10 +31,10 @@ def parse_to_dict(xml_file: str | Path) -> dict[str, list[dict[str, Any]]]:
28
31
  >>> from prelude_parser import parse_to_dict
29
32
  >>> data = parse_to_dict("physical_examination.xml")
30
33
  """
31
- return _parse_flat_file_to_dict(xml_file)
34
+ return _parse_flat_file_to_dict(xml_file, short_names)
32
35
 
33
36
 
34
- def parse_to_classes(xml_file: str | Path) -> list[Any]:
37
+ def parse_to_classes(xml_file: str | Path, short_names: bool = False) -> list[Any]:
35
38
  """Parse a Prelude flat XML file into a list of Python class.
36
39
 
37
40
  The name of the class is taken from the form name node in the XML file converted to pascal case.
@@ -40,6 +43,7 @@ def parse_to_classes(xml_file: str | Path) -> list[Any]:
40
43
 
41
44
  Args:
42
45
  xml_file: The path to the XML file to parser.
46
+ short_names: Set to True if short names were used in the export.
43
47
 
44
48
  Returns:
45
49
  A list of Python classes containing the data from the XML file.
@@ -48,7 +52,7 @@ def parse_to_classes(xml_file: str | Path) -> list[Any]:
48
52
  >>> from prelude_parser import parse_to_classes
49
53
  >>> data = parse_to_classes("physical_examination.xml")
50
54
  """
51
- parsed = parse_to_dict(xml_file)
55
+ parsed = parse_to_dict(xml_file, short_names=short_names)
52
56
  formatted: list[Any] = []
53
57
  for form, data in parsed.items():
54
58
  class_name = to_pascal(form)
@@ -10,7 +10,7 @@ except ImportError: # pragma: no cover
10
10
  raise ImportError("prelude-parser must be installed with the polars or all extra to use pandas")
11
11
 
12
12
 
13
- def to_dataframe(xml_file: str | Path) -> pl.DataFrame:
13
+ def to_dataframe(xml_file: str | Path, *, short_names: bool = False) -> pl.DataFrame:
14
14
  """Parse a Prelude flat XML file into a Polars DataFrame.
15
15
 
16
16
  This works for Prelude flat XML files that were exported with the "write tables to seperate
@@ -18,6 +18,7 @@ def to_dataframe(xml_file: str | Path) -> pl.DataFrame:
18
18
 
19
19
  Args:
20
20
  xml_file: The path to the XML file to parser.
21
+ short_names: Set to True if short names were used in the export.
21
22
 
22
23
  Returns:
23
24
  A Polars DataFrame the data from the XML file.
@@ -26,5 +27,5 @@ def to_dataframe(xml_file: str | Path) -> pl.DataFrame:
26
27
  >>> from prelude_parser.polars import to_dataframe
27
28
  >>> df = to_dataframe("physical_examination.xml")
28
29
  """
29
- data = _parse_flat_file_to_pandas_dict(xml_file)
30
+ data = _parse_flat_file_to_pandas_dict(xml_file, short_names)
30
31
  return pl.from_dict(data)
@@ -88,7 +88,7 @@ fn add_item<'py>(
88
88
  Ok(form_data)
89
89
  }
90
90
 
91
- fn parse_xml<'py>(py: Python<'py>, xml_file: &PathBuf) -> PyResult<&'py PyDict> {
91
+ fn parse_xml<'py>(py: Python<'py>, xml_file: &PathBuf, short_names: bool) -> PyResult<&'py PyDict> {
92
92
  let reader = read_to_string(xml_file);
93
93
 
94
94
  match reader {
@@ -97,13 +97,21 @@ fn parse_xml<'py>(py: Python<'py>, xml_file: &PathBuf) -> PyResult<&'py PyDict>
97
97
  let mut data: HashMap<String, Vec<&PyDict>> = HashMap::new();
98
98
  let tree = doc.root_element();
99
99
  for form in tree.children() {
100
- let form_name = to_snake(form.tag_name().name());
100
+ let form_name = if short_names {
101
+ form.tag_name().name().to_owned().to_lowercase()
102
+ } else {
103
+ to_snake(form.tag_name().name())
104
+ };
101
105
  if !form_name.is_empty() {
102
106
  if let Some(d) = data.get_mut(&form_name) {
103
107
  let form_data = PyDict::new(py);
104
108
  for child in form.children() {
105
109
  if child.is_element() && child.tag_name().name() != "" {
106
- let key = to_snake(child.tag_name().name());
110
+ let key = if short_names {
111
+ child.tag_name().name().to_owned().to_lowercase()
112
+ } else {
113
+ to_snake(child.tag_name().name())
114
+ };
107
115
  add_item(py, &key, child.text(), form_data)?;
108
116
  };
109
117
  }
@@ -113,7 +121,11 @@ fn parse_xml<'py>(py: Python<'py>, xml_file: &PathBuf) -> PyResult<&'py PyDict>
113
121
  let form_data = PyDict::new(py);
114
122
  for child in form.children() {
115
123
  if child.is_element() && child.tag_name().name() != "" {
116
- let key = to_snake(child.tag_name().name());
124
+ let key = if short_names {
125
+ child.tag_name().name().to_owned().to_lowercase()
126
+ } else {
127
+ to_snake(child.tag_name().name())
128
+ };
117
129
  add_item(py, &key, child.text(), form_data)?;
118
130
  }
119
131
  }
@@ -136,20 +148,27 @@ fn parse_xml<'py>(py: Python<'py>, xml_file: &PathBuf) -> PyResult<&'py PyDict>
136
148
  }
137
149
  }
138
150
 
139
- fn parse_xml_pandas<'py>(py: Python<'py>, xml_file: &PathBuf) -> PyResult<&'py PyDict> {
151
+ fn parse_xml_pandas<'py>(
152
+ py: Python<'py>,
153
+ xml_file: &PathBuf,
154
+ short_names: bool,
155
+ ) -> PyResult<&'py PyDict> {
140
156
  let reader = read_to_string(xml_file);
141
157
 
142
158
  match reader {
143
159
  Ok(r) => match Document::parse(&r) {
144
160
  Ok(doc) => {
145
- // let mut data: HashMap<&str, &PyList> = HashMap::new(); //Vec<Option<&str>>> = HashMap::new();
146
161
  let data = PyDict::new(py);
147
162
  let tree = doc.root_element();
148
163
 
149
164
  for form in tree.children() {
150
165
  for child in form.children() {
151
166
  if child.is_element() && child.tag_name().name() != "" {
152
- let column = to_snake(child.tag_name().name());
167
+ let column = if short_names {
168
+ child.tag_name().name().to_owned().to_lowercase()
169
+ } else {
170
+ to_snake(child.tag_name().name())
171
+ };
153
172
  if let Some(c) = data.get_item(column.clone()) {
154
173
  py_list_append(py, child.text(), c.extract()?)?;
155
174
  data.set_item(column, c)?;
@@ -158,13 +177,6 @@ fn parse_xml_pandas<'py>(py: Python<'py>, xml_file: &PathBuf) -> PyResult<&'py P
158
177
  py_list_append(py, child.text(), list)?;
159
178
  data.set_item(column, list)?;
160
179
  }
161
- /*if let Some(d) = data.get_mut(column) {
162
- py_list_append(py, child.text(), list)?;
163
- d = list;
164
- } else {
165
- py_list_append(py, child.text(), list)?;
166
- data.insert(column, list);
167
- }*/
168
180
  }
169
181
  }
170
182
  }
@@ -199,17 +211,21 @@ fn validate_file(xml_file: &PathBuf) -> PyResult<()> {
199
211
  }
200
212
 
201
213
  #[pyfunction]
202
- fn _parse_flat_file_to_dict(py: Python, xml_file: PathBuf) -> PyResult<&PyDict> {
214
+ fn _parse_flat_file_to_dict(py: Python, xml_file: PathBuf, short_names: bool) -> PyResult<&PyDict> {
203
215
  validate_file(&xml_file)?;
204
- let data = parse_xml(py, &xml_file)?;
216
+ let data = parse_xml(py, &xml_file, short_names)?;
205
217
 
206
218
  Ok(data)
207
219
  }
208
220
 
209
221
  #[pyfunction]
210
- fn _parse_flat_file_to_pandas_dict(py: Python, xml_file: PathBuf) -> PyResult<&PyDict> {
222
+ fn _parse_flat_file_to_pandas_dict(
223
+ py: Python,
224
+ xml_file: PathBuf,
225
+ short_names: bool,
226
+ ) -> PyResult<&PyDict> {
211
227
  validate_file(&xml_file)?;
212
- let data = parse_xml_pandas(py, &xml_file)?;
228
+ let data = parse_xml_pandas(py, &xml_file, short_names)?;
213
229
 
214
230
  Ok(data)
215
231
  }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <export_from_vision_EDC date="15-Apr-2023 13:12 -0500" createdBy="Paul Sanders" role="Project Manager" numberSubjectsProcessed="2" includeComments="false" includeQueryStatus="false" includeFormState="true" includeStudyName="true" cdash="false" zipResult="true">
3
+
4
+ <communications>
5
+ <STUDYNAME>PBS</STUDYNAME>
6
+ <SITENAME>Some Site</SITENAME>
7
+ </communications>
8
+
9
+ <communications>
10
+ <STUDYNAME>PBS</STUDYNAME>
11
+ <SITENAME>Another Site</SITENAME>
12
+ </communications>
13
+
14
+ </export_from_vision_EDC>
@@ -18,3 +18,8 @@ def test_file_2():
18
18
  @pytest.fixture
19
19
  def test_file_3():
20
20
  return ASSETS_PATH / "test3.xml"
21
+
22
+
23
+ @pytest.fixture
24
+ def test_file_4():
25
+ return ASSETS_PATH / "test4.xml"
@@ -30,3 +30,15 @@ def test_pandas_to_dataframe(test_file_1):
30
30
  expected = pd.DataFrame.from_dict(data)
31
31
  result = result.reindex(sorted(result.columns), axis=1)
32
32
  assert expected.equals(result)
33
+
34
+
35
+ @pytest.mark.skipif(sys.version_info < (3, 9), reason="Pandas only supports 3.9+")
36
+ def test_pandas_to_dataframe_short_names(test_file_4):
37
+ result = to_dataframe(test_file_4, short_names=True)
38
+ data = {
39
+ "sitename": ["Some Site", "Another Site"],
40
+ "studyname": ["PBS", "PBS"],
41
+ }
42
+ expected = pd.DataFrame.from_dict(data)
43
+ result = result.reindex(sorted(result.columns), axis=1)
44
+ assert expected.equals(result)
@@ -70,6 +70,14 @@ def test_parse_to_classes_parsing_error(tmp_path):
70
70
  parse_to_classes(bad)
71
71
 
72
72
 
73
+ def test_parse_to_classes_short_names(test_file_4):
74
+ result = parse_to_classes(test_file_4, short_names=True)
75
+ assert len(result) == 2
76
+ assert result[0].__name__ == "Communications"
77
+ assert result[0].studyname == "PBS"
78
+ assert result[0].sitename == "Some Site"
79
+
80
+
73
81
  def test_parse_to_dict(test_file_1):
74
82
  result = parse_to_dict(test_file_1)
75
83
  expected = {
@@ -224,3 +232,23 @@ def test_parse_to_dict_i_form(test_file_3):
224
232
  ]
225
233
 
226
234
  assert result == expected
235
+
236
+
237
+ def test_parse_to_dict_short_names(test_file_4):
238
+ result = parse_to_dict(test_file_4, short_names=True)
239
+ expected = {
240
+ "communications": [
241
+ {
242
+ "sitename": "Some Site",
243
+ "studyname": "PBS",
244
+ },
245
+ {
246
+ "sitename": "Another Site",
247
+ "studyname": "PBS",
248
+ },
249
+ ]
250
+ }
251
+
252
+ result["communications"] = [dict(sorted(x.items())) for x in result["communications"]]
253
+
254
+ assert result == expected
@@ -25,3 +25,14 @@ def test_pandas_to_dataframe(test_file_1):
25
25
  expected = pl.from_dict(data) # type: ignore
26
26
  result = result.pipe(lambda x: x.select(sorted(x.columns)))
27
27
  assert_frame_equal(expected, result)
28
+
29
+
30
+ def test_pandas_to_dataframe_short_names(test_file_4):
31
+ result = to_dataframe(test_file_4, short_names=True)
32
+ data = {
33
+ "sitename": ["Some Site", "Another Site"],
34
+ "studyname": ["PBS", "PBS"],
35
+ }
36
+ expected = pl.from_dict(data) # type: ignore
37
+ result = result.pipe(lambda x: x.select(sorted(x.columns)))
38
+ assert_frame_equal(expected, result)
@@ -1,16 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from pathlib import Path
4
- from typing import Any
5
-
6
- def _parse_flat_file_to_dict(xml_file: str | Path) -> dict[str, list[dict[str, Any]]]: ...
7
- def _parse_flat_file_to_pandas_dict(xml_file: str | Path) -> dict[str, list[Any]]: ...
8
-
9
- class FileNotFoundError(Exception):
10
- pass
11
-
12
- class InvalidFileTypeError(Exception):
13
- pass
14
-
15
- class ParsingError(Exception):
16
- pass
File without changes
File without changes
File without changes