mongojet 0.2.0__tar.gz → 0.2.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 (43) hide show
  1. {mongojet-0.2.0 → mongojet-0.2.2}/Cargo.lock +217 -200
  2. {mongojet-0.2.0 → mongojet-0.2.2}/Cargo.toml +3 -3
  3. {mongojet-0.2.0 → mongojet-0.2.2}/PKG-INFO +1 -1
  4. mongojet-0.2.2/python/mongojet/_gridfs.py +50 -0
  5. {mongojet-0.2.0 → mongojet-0.2.2}/src/error.rs +11 -7
  6. mongojet-0.2.0/python/mongojet/_gridfs.py +0 -85
  7. {mongojet-0.2.0 → mongojet-0.2.2}/.github/workflows/python-ci.yml +0 -0
  8. {mongojet-0.2.0 → mongojet-0.2.2}/.github/workflows/release.yml +0 -0
  9. {mongojet-0.2.0 → mongojet-0.2.2}/.gitignore +0 -0
  10. {mongojet-0.2.0 → mongojet-0.2.2}/.rustfmt.toml +0 -0
  11. {mongojet-0.2.0 → mongojet-0.2.2}/LICENSE.txt +0 -0
  12. {mongojet-0.2.0 → mongojet-0.2.2}/README.md +0 -0
  13. {mongojet-0.2.0 → mongojet-0.2.2}/pyproject.toml +0 -0
  14. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/__init__.py +0 -0
  15. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_client.py +0 -0
  16. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_codec.py +0 -0
  17. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_collection.py +0 -0
  18. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_cursor.py +0 -0
  19. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_database.py +0 -0
  20. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_helpers.py +0 -0
  21. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_session.py +0 -0
  22. {mongojet-0.2.0 → mongojet-0.2.2}/python/mongojet/_types.py +0 -0
  23. {mongojet-0.2.0 → mongojet-0.2.2}/requirements-dev.txt +0 -0
  24. {mongojet-0.2.0 → mongojet-0.2.2}/src/client.rs +0 -0
  25. {mongojet-0.2.0 → mongojet-0.2.2}/src/collection.rs +0 -0
  26. {mongojet-0.2.0 → mongojet-0.2.2}/src/conv.rs +0 -0
  27. {mongojet-0.2.0 → mongojet-0.2.2}/src/cursor.rs +0 -0
  28. {mongojet-0.2.0 → mongojet-0.2.2}/src/database.rs +0 -0
  29. {mongojet-0.2.0 → mongojet-0.2.2}/src/document.rs +0 -0
  30. {mongojet-0.2.0 → mongojet-0.2.2}/src/gridfs.rs +0 -0
  31. {mongojet-0.2.0 → mongojet-0.2.2}/src/lib.rs +0 -0
  32. {mongojet-0.2.0 → mongojet-0.2.2}/src/options.rs +0 -0
  33. {mongojet-0.2.0 → mongojet-0.2.2}/src/result.rs +0 -0
  34. {mongojet-0.2.0 → mongojet-0.2.2}/src/runtime.rs +0 -0
  35. {mongojet-0.2.0 → mongojet-0.2.2}/src/session.rs +0 -0
  36. {mongojet-0.2.0 → mongojet-0.2.2}/tests/__init__.py +0 -0
  37. {mongojet-0.2.0 → mongojet-0.2.2}/tests/conftest.py +0 -0
  38. {mongojet-0.2.0 → mongojet-0.2.2}/tests/test_data_modification.py +0 -0
  39. {mongojet-0.2.0 → mongojet-0.2.2}/tests/test_data_querying.py +0 -0
  40. {mongojet-0.2.0 → mongojet-0.2.2}/tests/test_database.py +0 -0
  41. {mongojet-0.2.0 → mongojet-0.2.2}/tests/test_gridfs.py +0 -0
  42. {mongojet-0.2.0 → mongojet-0.2.2}/tests/test_indexes.py +0 -0
  43. {mongojet-0.2.0 → mongojet-0.2.2}/tests/test_sessions.py +0 -0
@@ -27,7 +27,7 @@ dependencies = [
27
27
  "getrandom",
28
28
  "once_cell",
29
29
  "version_check",
30
- "zerocopy 0.7.35",
30
+ "zerocopy",
31
31
  ]
32
32
 
33
33
  [[package]]
@@ -74,19 +74,19 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457"
74
74
 
75
75
  [[package]]
76
76
  name = "arrayvec"
77
- version = "0.7.4"
77
+ version = "0.7.6"
78
78
  source = "registry+https://github.com/rust-lang/crates.io-index"
79
- checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
79
+ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
80
80
 
81
81
  [[package]]
82
82
  name = "async-trait"
83
- version = "0.1.81"
83
+ version = "0.1.82"
84
84
  source = "registry+https://github.com/rust-lang/crates.io-index"
85
- checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
85
+ checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1"
86
86
  dependencies = [
87
87
  "proc-macro2",
88
88
  "quote",
89
- "syn 2.0.72",
89
+ "syn 2.0.77",
90
90
  ]
91
91
 
92
92
  [[package]]
@@ -122,6 +122,12 @@ version = "0.21.7"
122
122
  source = "registry+https://github.com/rust-lang/crates.io-index"
123
123
  checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
124
124
 
125
+ [[package]]
126
+ name = "base64"
127
+ version = "0.22.1"
128
+ source = "registry+https://github.com/rust-lang/crates.io-index"
129
+ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
130
+
125
131
  [[package]]
126
132
  name = "bitflags"
127
133
  version = "1.3.2"
@@ -166,7 +172,7 @@ dependencies = [
166
172
  "bitvec",
167
173
  "chrono",
168
174
  "hex",
169
- "indexmap",
175
+ "indexmap 2.5.0",
170
176
  "js-sys",
171
177
  "once_cell",
172
178
  "rand",
@@ -197,9 +203,12 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
197
203
 
198
204
  [[package]]
199
205
  name = "cc"
200
- version = "1.1.7"
206
+ version = "1.1.16"
201
207
  source = "registry+https://github.com/rust-lang/crates.io-index"
202
- checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc"
208
+ checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b"
209
+ dependencies = [
210
+ "shlex",
211
+ ]
203
212
 
204
213
  [[package]]
205
214
  name = "cfg-if"
@@ -252,15 +261,15 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
252
261
 
253
262
  [[package]]
254
263
  name = "core-foundation-sys"
255
- version = "0.8.6"
264
+ version = "0.8.7"
256
265
  source = "registry+https://github.com/rust-lang/crates.io-index"
257
- checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
266
+ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
258
267
 
259
268
  [[package]]
260
269
  name = "cpufeatures"
261
- version = "0.2.12"
270
+ version = "0.2.13"
262
271
  source = "registry+https://github.com/rust-lang/crates.io-index"
263
- checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
272
+ checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad"
264
273
  dependencies = [
265
274
  "libc",
266
275
  ]
@@ -277,9 +286,9 @@ dependencies = [
277
286
 
278
287
  [[package]]
279
288
  name = "darling"
280
- version = "0.13.4"
289
+ version = "0.20.10"
281
290
  source = "registry+https://github.com/rust-lang/crates.io-index"
282
- checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c"
291
+ checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
283
292
  dependencies = [
284
293
  "darling_core",
285
294
  "darling_macro",
@@ -287,27 +296,27 @@ dependencies = [
287
296
 
288
297
  [[package]]
289
298
  name = "darling_core"
290
- version = "0.13.4"
299
+ version = "0.20.10"
291
300
  source = "registry+https://github.com/rust-lang/crates.io-index"
292
- checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610"
301
+ checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
293
302
  dependencies = [
294
303
  "fnv",
295
304
  "ident_case",
296
305
  "proc-macro2",
297
306
  "quote",
298
307
  "strsim",
299
- "syn 1.0.109",
308
+ "syn 2.0.77",
300
309
  ]
301
310
 
302
311
  [[package]]
303
312
  name = "darling_macro"
304
- version = "0.13.4"
313
+ version = "0.20.10"
305
314
  source = "registry+https://github.com/rust-lang/crates.io-index"
306
- checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
315
+ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
307
316
  dependencies = [
308
317
  "darling_core",
309
318
  "quote",
310
- "syn 1.0.109",
319
+ "syn 2.0.77",
311
320
  ]
312
321
 
313
322
  [[package]]
@@ -323,6 +332,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
323
332
  checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
324
333
  dependencies = [
325
334
  "powerfmt",
335
+ "serde",
326
336
  ]
327
337
 
328
338
  [[package]]
@@ -345,8 +355,8 @@ dependencies = [
345
355
  "convert_case",
346
356
  "proc-macro2",
347
357
  "quote",
348
- "rustc_version 0.4.0",
349
- "syn 2.0.72",
358
+ "rustc_version",
359
+ "syn 2.0.77",
350
360
  ]
351
361
 
352
362
  [[package]]
@@ -368,14 +378,14 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
368
378
 
369
379
  [[package]]
370
380
  name = "enum-as-inner"
371
- version = "0.4.0"
381
+ version = "0.6.0"
372
382
  source = "registry+https://github.com/rust-lang/crates.io-index"
373
- checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73"
383
+ checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a"
374
384
  dependencies = [
375
385
  "heck 0.4.1",
376
386
  "proc-macro2",
377
387
  "quote",
378
- "syn 1.0.109",
388
+ "syn 2.0.77",
379
389
  ]
380
390
 
381
391
  [[package]]
@@ -471,7 +481,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
471
481
  dependencies = [
472
482
  "proc-macro2",
473
483
  "quote",
474
- "syn 2.0.72",
484
+ "syn 2.0.77",
475
485
  ]
476
486
 
477
487
  [[package]]
@@ -531,6 +541,12 @@ version = "0.29.0"
531
541
  source = "registry+https://github.com/rust-lang/crates.io-index"
532
542
  checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
533
543
 
544
+ [[package]]
545
+ name = "hashbrown"
546
+ version = "0.12.3"
547
+ source = "registry+https://github.com/rust-lang/crates.io-index"
548
+ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
549
+
534
550
  [[package]]
535
551
  name = "hashbrown"
536
552
  version = "0.14.5"
@@ -565,6 +581,51 @@ version = "0.4.3"
565
581
  source = "registry+https://github.com/rust-lang/crates.io-index"
566
582
  checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
567
583
 
584
+ [[package]]
585
+ name = "hickory-proto"
586
+ version = "0.24.1"
587
+ source = "registry+https://github.com/rust-lang/crates.io-index"
588
+ checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512"
589
+ dependencies = [
590
+ "async-trait",
591
+ "cfg-if",
592
+ "data-encoding",
593
+ "enum-as-inner",
594
+ "futures-channel",
595
+ "futures-io",
596
+ "futures-util",
597
+ "idna 0.4.0",
598
+ "ipnet",
599
+ "once_cell",
600
+ "rand",
601
+ "thiserror",
602
+ "tinyvec",
603
+ "tokio",
604
+ "tracing",
605
+ "url",
606
+ ]
607
+
608
+ [[package]]
609
+ name = "hickory-resolver"
610
+ version = "0.24.1"
611
+ source = "registry+https://github.com/rust-lang/crates.io-index"
612
+ checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243"
613
+ dependencies = [
614
+ "cfg-if",
615
+ "futures-util",
616
+ "hickory-proto",
617
+ "ipconfig",
618
+ "lru-cache",
619
+ "once_cell",
620
+ "parking_lot",
621
+ "rand",
622
+ "resolv-conf",
623
+ "smallvec",
624
+ "thiserror",
625
+ "tokio",
626
+ "tracing",
627
+ ]
628
+
568
629
  [[package]]
569
630
  name = "hmac"
570
631
  version = "0.12.1"
@@ -616,11 +677,10 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
616
677
 
617
678
  [[package]]
618
679
  name = "idna"
619
- version = "0.2.3"
680
+ version = "0.4.0"
620
681
  source = "registry+https://github.com/rust-lang/crates.io-index"
621
- checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
682
+ checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
622
683
  dependencies = [
623
- "matches",
624
684
  "unicode-bidi",
625
685
  "unicode-normalization",
626
686
  ]
@@ -643,12 +703,24 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
643
703
 
644
704
  [[package]]
645
705
  name = "indexmap"
646
- version = "2.3.0"
706
+ version = "1.9.3"
707
+ source = "registry+https://github.com/rust-lang/crates.io-index"
708
+ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
709
+ dependencies = [
710
+ "autocfg",
711
+ "hashbrown 0.12.3",
712
+ "serde",
713
+ ]
714
+
715
+ [[package]]
716
+ name = "indexmap"
717
+ version = "2.5.0"
647
718
  source = "registry+https://github.com/rust-lang/crates.io-index"
648
- checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0"
719
+ checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
649
720
  dependencies = [
650
721
  "equivalent",
651
- "hashbrown",
722
+ "hashbrown 0.14.5",
723
+ "serde",
652
724
  ]
653
725
 
654
726
  [[package]]
@@ -683,24 +755,18 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
683
755
 
684
756
  [[package]]
685
757
  name = "js-sys"
686
- version = "0.3.69"
758
+ version = "0.3.70"
687
759
  source = "registry+https://github.com/rust-lang/crates.io-index"
688
- checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
760
+ checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
689
761
  dependencies = [
690
762
  "wasm-bindgen",
691
763
  ]
692
764
 
693
- [[package]]
694
- name = "lazy_static"
695
- version = "1.5.0"
696
- source = "registry+https://github.com/rust-lang/crates.io-index"
697
- checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
698
-
699
765
  [[package]]
700
766
  name = "libc"
701
- version = "0.2.155"
767
+ version = "0.2.158"
702
768
  source = "registry+https://github.com/rust-lang/crates.io-index"
703
- checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
769
+ checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
704
770
 
705
771
  [[package]]
706
772
  name = "linked-hash-map"
@@ -739,12 +805,6 @@ version = "0.1.0"
739
805
  source = "registry+https://github.com/rust-lang/crates.io-index"
740
806
  checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"
741
807
 
742
- [[package]]
743
- name = "matches"
744
- version = "0.1.10"
745
- source = "registry+https://github.com/rust-lang/crates.io-index"
746
- checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
747
-
748
808
  [[package]]
749
809
  name = "md-5"
750
810
  version = "0.10.6"
@@ -781,9 +841,9 @@ dependencies = [
781
841
 
782
842
  [[package]]
783
843
  name = "mio"
784
- version = "1.0.1"
844
+ version = "1.0.2"
785
845
  source = "registry+https://github.com/rust-lang/crates.io-index"
786
- checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4"
846
+ checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
787
847
  dependencies = [
788
848
  "hermit-abi",
789
849
  "libc",
@@ -793,9 +853,9 @@ dependencies = [
793
853
 
794
854
  [[package]]
795
855
  name = "mongodb"
796
- version = "3.0.1"
856
+ version = "3.1.0"
797
857
  source = "registry+https://github.com/rust-lang/crates.io-index"
798
- checksum = "60f61f1556ee1d65e0b256e5bbc6d61e10022d1e3df86c23526d469bd832fa24"
858
+ checksum = "c857d71f918b38221baf2fdff7207fec9984b4504901544772b1edf0302d669f"
799
859
  dependencies = [
800
860
  "async-trait",
801
861
  "base64 0.13.1",
@@ -809,6 +869,8 @@ dependencies = [
809
869
  "futures-io",
810
870
  "futures-util",
811
871
  "hex",
872
+ "hickory-proto",
873
+ "hickory-resolver",
812
874
  "hmac",
813
875
  "md-5",
814
876
  "mongodb-internal-macros",
@@ -832,8 +894,6 @@ dependencies = [
832
894
  "tokio",
833
895
  "tokio-rustls",
834
896
  "tokio-util",
835
- "trust-dns-proto",
836
- "trust-dns-resolver",
837
897
  "typed-builder",
838
898
  "uuid",
839
899
  "webpki-roots",
@@ -841,18 +901,18 @@ dependencies = [
841
901
 
842
902
  [[package]]
843
903
  name = "mongodb-internal-macros"
844
- version = "3.0.1"
904
+ version = "3.1.0"
845
905
  source = "registry+https://github.com/rust-lang/crates.io-index"
846
- checksum = "934305ae9c66ef6a3aa728c66dec8fa2424de4dfcd043c7acaffacae2bf99442"
906
+ checksum = "3a6dbc533e93429a71c44a14c04547ac783b56d3f22e6c4f12b1b994cf93844e"
847
907
  dependencies = [
848
908
  "proc-macro2",
849
909
  "quote",
850
- "syn 2.0.72",
910
+ "syn 2.0.77",
851
911
  ]
852
912
 
853
913
  [[package]]
854
914
  name = "mongojet"
855
- version = "0.2.0"
915
+ version = "0.2.2"
856
916
  dependencies = [
857
917
  "bson",
858
918
  "chrono",
@@ -922,9 +982,9 @@ dependencies = [
922
982
 
923
983
  [[package]]
924
984
  name = "object"
925
- version = "0.36.2"
985
+ version = "0.36.4"
926
986
  source = "registry+https://github.com/rust-lang/crates.io-index"
927
- checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e"
987
+ checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a"
928
988
  dependencies = [
929
989
  "memchr",
930
990
  ]
@@ -1046,11 +1106,11 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
1046
1106
 
1047
1107
  [[package]]
1048
1108
  name = "ppv-lite86"
1049
- version = "0.2.18"
1109
+ version = "0.2.20"
1050
1110
  source = "registry+https://github.com/rust-lang/crates.io-index"
1051
- checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f"
1111
+ checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
1052
1112
  dependencies = [
1053
- "zerocopy 0.6.6",
1113
+ "zerocopy",
1054
1114
  ]
1055
1115
 
1056
1116
  [[package]]
@@ -1074,8 +1134,8 @@ dependencies = [
1074
1134
  "chrono-tz",
1075
1135
  "either",
1076
1136
  "eyre",
1077
- "hashbrown",
1078
- "indexmap",
1137
+ "hashbrown 0.14.5",
1138
+ "indexmap 2.5.0",
1079
1139
  "indoc",
1080
1140
  "libc",
1081
1141
  "memoffset",
@@ -1133,7 +1193,7 @@ dependencies = [
1133
1193
  "proc-macro2",
1134
1194
  "pyo3-macros-backend",
1135
1195
  "quote",
1136
- "syn 2.0.72",
1196
+ "syn 2.0.77",
1137
1197
  ]
1138
1198
 
1139
1199
  [[package]]
@@ -1146,7 +1206,7 @@ dependencies = [
1146
1206
  "proc-macro2",
1147
1207
  "pyo3-build-config",
1148
1208
  "quote",
1149
- "syn 2.0.72",
1209
+ "syn 2.0.77",
1150
1210
  ]
1151
1211
 
1152
1212
  [[package]]
@@ -1157,9 +1217,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
1157
1217
 
1158
1218
  [[package]]
1159
1219
  name = "quote"
1160
- version = "1.0.36"
1220
+ version = "1.0.37"
1161
1221
  source = "registry+https://github.com/rust-lang/crates.io-index"
1162
- checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
1222
+ checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
1163
1223
  dependencies = [
1164
1224
  "proc-macro2",
1165
1225
  ]
@@ -1211,9 +1271,9 @@ dependencies = [
1211
1271
 
1212
1272
  [[package]]
1213
1273
  name = "regex"
1214
- version = "1.10.5"
1274
+ version = "1.10.6"
1215
1275
  source = "registry+https://github.com/rust-lang/crates.io-index"
1216
- checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
1276
+ checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
1217
1277
  dependencies = [
1218
1278
  "aho-corasick",
1219
1279
  "memchr",
@@ -1265,9 +1325,9 @@ dependencies = [
1265
1325
 
1266
1326
  [[package]]
1267
1327
  name = "rust_decimal"
1268
- version = "1.35.0"
1328
+ version = "1.36.0"
1269
1329
  source = "registry+https://github.com/rust-lang/crates.io-index"
1270
- checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a"
1330
+ checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555"
1271
1331
  dependencies = [
1272
1332
  "arrayvec",
1273
1333
  "num-traits",
@@ -1281,30 +1341,21 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
1281
1341
 
1282
1342
  [[package]]
1283
1343
  name = "rustc_version"
1284
- version = "0.2.3"
1285
- source = "registry+https://github.com/rust-lang/crates.io-index"
1286
- checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
1287
- dependencies = [
1288
- "semver 0.9.0",
1289
- ]
1290
-
1291
- [[package]]
1292
- name = "rustc_version"
1293
- version = "0.4.0"
1344
+ version = "0.4.1"
1294
1345
  source = "registry+https://github.com/rust-lang/crates.io-index"
1295
- checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
1346
+ checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
1296
1347
  dependencies = [
1297
- "semver 1.0.23",
1348
+ "semver",
1298
1349
  ]
1299
1350
 
1300
1351
  [[package]]
1301
1352
  name = "rustc_version_runtime"
1302
- version = "0.2.1"
1353
+ version = "0.3.0"
1303
1354
  source = "registry+https://github.com/rust-lang/crates.io-index"
1304
- checksum = "d31b7153270ebf48bf91c65ae5b0c00e749c4cfad505f66530ac74950249582f"
1355
+ checksum = "2dd18cd2bae1820af0b6ad5e54f4a51d0f3fcc53b05f845675074efcc7af071d"
1305
1356
  dependencies = [
1306
- "rustc_version 0.2.3",
1307
- "semver 0.9.0",
1357
+ "rustc_version",
1358
+ "semver",
1308
1359
  ]
1309
1360
 
1310
1361
  [[package]]
@@ -1360,32 +1411,17 @@ dependencies = [
1360
1411
  "untrusted",
1361
1412
  ]
1362
1413
 
1363
- [[package]]
1364
- name = "semver"
1365
- version = "0.9.0"
1366
- source = "registry+https://github.com/rust-lang/crates.io-index"
1367
- checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
1368
- dependencies = [
1369
- "semver-parser",
1370
- ]
1371
-
1372
1414
  [[package]]
1373
1415
  name = "semver"
1374
1416
  version = "1.0.23"
1375
1417
  source = "registry+https://github.com/rust-lang/crates.io-index"
1376
1418
  checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
1377
1419
 
1378
- [[package]]
1379
- name = "semver-parser"
1380
- version = "0.7.0"
1381
- source = "registry+https://github.com/rust-lang/crates.io-index"
1382
- checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
1383
-
1384
1420
  [[package]]
1385
1421
  name = "serde"
1386
- version = "1.0.204"
1422
+ version = "1.0.209"
1387
1423
  source = "registry+https://github.com/rust-lang/crates.io-index"
1388
- checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
1424
+ checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
1389
1425
  dependencies = [
1390
1426
  "serde_derive",
1391
1427
  ]
@@ -1401,22 +1437,22 @@ dependencies = [
1401
1437
 
1402
1438
  [[package]]
1403
1439
  name = "serde_derive"
1404
- version = "1.0.204"
1440
+ version = "1.0.209"
1405
1441
  source = "registry+https://github.com/rust-lang/crates.io-index"
1406
- checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
1442
+ checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
1407
1443
  dependencies = [
1408
1444
  "proc-macro2",
1409
1445
  "quote",
1410
- "syn 2.0.72",
1446
+ "syn 2.0.77",
1411
1447
  ]
1412
1448
 
1413
1449
  [[package]]
1414
1450
  name = "serde_json"
1415
- version = "1.0.122"
1451
+ version = "1.0.128"
1416
1452
  source = "registry+https://github.com/rust-lang/crates.io-index"
1417
- checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"
1453
+ checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
1418
1454
  dependencies = [
1419
- "indexmap",
1455
+ "indexmap 2.5.0",
1420
1456
  "itoa",
1421
1457
  "memchr",
1422
1458
  "ryu",
@@ -1425,24 +1461,32 @@ dependencies = [
1425
1461
 
1426
1462
  [[package]]
1427
1463
  name = "serde_with"
1428
- version = "1.14.0"
1464
+ version = "3.9.0"
1429
1465
  source = "registry+https://github.com/rust-lang/crates.io-index"
1430
- checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff"
1466
+ checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
1431
1467
  dependencies = [
1468
+ "base64 0.22.1",
1469
+ "chrono",
1470
+ "hex",
1471
+ "indexmap 1.9.3",
1472
+ "indexmap 2.5.0",
1432
1473
  "serde",
1474
+ "serde_derive",
1475
+ "serde_json",
1433
1476
  "serde_with_macros",
1477
+ "time",
1434
1478
  ]
1435
1479
 
1436
1480
  [[package]]
1437
1481
  name = "serde_with_macros"
1438
- version = "1.5.2"
1482
+ version = "3.9.0"
1439
1483
  source = "registry+https://github.com/rust-lang/crates.io-index"
1440
- checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082"
1484
+ checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
1441
1485
  dependencies = [
1442
1486
  "darling",
1443
1487
  "proc-macro2",
1444
1488
  "quote",
1445
- "syn 1.0.109",
1489
+ "syn 2.0.77",
1446
1490
  ]
1447
1491
 
1448
1492
  [[package]]
@@ -1467,6 +1511,12 @@ dependencies = [
1467
1511
  "digest",
1468
1512
  ]
1469
1513
 
1514
+ [[package]]
1515
+ name = "shlex"
1516
+ version = "1.3.0"
1517
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1518
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
1519
+
1470
1520
  [[package]]
1471
1521
  name = "signal-hook-registry"
1472
1522
  version = "1.4.2"
@@ -1526,9 +1576,9 @@ dependencies = [
1526
1576
 
1527
1577
  [[package]]
1528
1578
  name = "strsim"
1529
- version = "0.10.0"
1579
+ version = "0.11.1"
1530
1580
  source = "registry+https://github.com/rust-lang/crates.io-index"
1531
- checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
1581
+ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
1532
1582
 
1533
1583
  [[package]]
1534
1584
  name = "subtle"
@@ -1549,9 +1599,9 @@ dependencies = [
1549
1599
 
1550
1600
  [[package]]
1551
1601
  name = "syn"
1552
- version = "2.0.72"
1602
+ version = "2.0.77"
1553
1603
  source = "registry+https://github.com/rust-lang/crates.io-index"
1554
- checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
1604
+ checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed"
1555
1605
  dependencies = [
1556
1606
  "proc-macro2",
1557
1607
  "quote",
@@ -1593,7 +1643,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
1593
1643
  dependencies = [
1594
1644
  "proc-macro2",
1595
1645
  "quote",
1596
- "syn 2.0.72",
1646
+ "syn 2.0.77",
1597
1647
  ]
1598
1648
 
1599
1649
  [[package]]
@@ -1644,9 +1694,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
1644
1694
 
1645
1695
  [[package]]
1646
1696
  name = "tokio"
1647
- version = "1.39.2"
1697
+ version = "1.40.0"
1648
1698
  source = "registry+https://github.com/rust-lang/crates.io-index"
1649
- checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1"
1699
+ checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
1650
1700
  dependencies = [
1651
1701
  "backtrace",
1652
1702
  "bytes",
@@ -1668,7 +1718,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
1668
1718
  dependencies = [
1669
1719
  "proc-macro2",
1670
1720
  "quote",
1671
- "syn 2.0.72",
1721
+ "syn 2.0.77",
1672
1722
  ]
1673
1723
 
1674
1724
  [[package]]
@@ -1683,9 +1733,9 @@ dependencies = [
1683
1733
 
1684
1734
  [[package]]
1685
1735
  name = "tokio-util"
1686
- version = "0.7.11"
1736
+ version = "0.7.12"
1687
1737
  source = "registry+https://github.com/rust-lang/crates.io-index"
1688
- checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
1738
+ checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a"
1689
1739
  dependencies = [
1690
1740
  "bytes",
1691
1741
  "futures-core",
@@ -1696,48 +1746,34 @@ dependencies = [
1696
1746
  ]
1697
1747
 
1698
1748
  [[package]]
1699
- name = "trust-dns-proto"
1700
- version = "0.21.2"
1749
+ name = "tracing"
1750
+ version = "0.1.40"
1701
1751
  source = "registry+https://github.com/rust-lang/crates.io-index"
1702
- checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d"
1752
+ checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
1703
1753
  dependencies = [
1704
- "async-trait",
1705
- "cfg-if",
1706
- "data-encoding",
1707
- "enum-as-inner",
1708
- "futures-channel",
1709
- "futures-io",
1710
- "futures-util",
1711
- "idna 0.2.3",
1712
- "ipnet",
1713
- "lazy_static",
1714
- "log",
1715
- "rand",
1716
- "smallvec",
1717
- "thiserror",
1718
- "tinyvec",
1719
- "tokio",
1720
- "url",
1754
+ "pin-project-lite",
1755
+ "tracing-attributes",
1756
+ "tracing-core",
1721
1757
  ]
1722
1758
 
1723
1759
  [[package]]
1724
- name = "trust-dns-resolver"
1725
- version = "0.21.2"
1760
+ name = "tracing-attributes"
1761
+ version = "0.1.27"
1726
1762
  source = "registry+https://github.com/rust-lang/crates.io-index"
1727
- checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558"
1763
+ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
1728
1764
  dependencies = [
1729
- "cfg-if",
1730
- "futures-util",
1731
- "ipconfig",
1732
- "lazy_static",
1733
- "log",
1734
- "lru-cache",
1735
- "parking_lot",
1736
- "resolv-conf",
1737
- "smallvec",
1738
- "thiserror",
1739
- "tokio",
1740
- "trust-dns-proto",
1765
+ "proc-macro2",
1766
+ "quote",
1767
+ "syn 2.0.77",
1768
+ ]
1769
+
1770
+ [[package]]
1771
+ name = "tracing-core"
1772
+ version = "0.1.32"
1773
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1774
+ checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
1775
+ dependencies = [
1776
+ "once_cell",
1741
1777
  ]
1742
1778
 
1743
1779
  [[package]]
@@ -1780,9 +1816,9 @@ dependencies = [
1780
1816
 
1781
1817
  [[package]]
1782
1818
  name = "unicode-properties"
1783
- version = "0.1.1"
1819
+ version = "0.1.2"
1784
1820
  source = "registry+https://github.com/rust-lang/crates.io-index"
1785
- checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291"
1821
+ checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524"
1786
1822
 
1787
1823
  [[package]]
1788
1824
  name = "unindent"
@@ -1831,34 +1867,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
1831
1867
 
1832
1868
  [[package]]
1833
1869
  name = "wasm-bindgen"
1834
- version = "0.2.92"
1870
+ version = "0.2.93"
1835
1871
  source = "registry+https://github.com/rust-lang/crates.io-index"
1836
- checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
1872
+ checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
1837
1873
  dependencies = [
1838
1874
  "cfg-if",
1875
+ "once_cell",
1839
1876
  "wasm-bindgen-macro",
1840
1877
  ]
1841
1878
 
1842
1879
  [[package]]
1843
1880
  name = "wasm-bindgen-backend"
1844
- version = "0.2.92"
1881
+ version = "0.2.93"
1845
1882
  source = "registry+https://github.com/rust-lang/crates.io-index"
1846
- checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
1883
+ checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
1847
1884
  dependencies = [
1848
1885
  "bumpalo",
1849
1886
  "log",
1850
1887
  "once_cell",
1851
1888
  "proc-macro2",
1852
1889
  "quote",
1853
- "syn 2.0.72",
1890
+ "syn 2.0.77",
1854
1891
  "wasm-bindgen-shared",
1855
1892
  ]
1856
1893
 
1857
1894
  [[package]]
1858
1895
  name = "wasm-bindgen-macro"
1859
- version = "0.2.92"
1896
+ version = "0.2.93"
1860
1897
  source = "registry+https://github.com/rust-lang/crates.io-index"
1861
- checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
1898
+ checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
1862
1899
  dependencies = [
1863
1900
  "quote",
1864
1901
  "wasm-bindgen-macro-support",
@@ -1866,22 +1903,22 @@ dependencies = [
1866
1903
 
1867
1904
  [[package]]
1868
1905
  name = "wasm-bindgen-macro-support"
1869
- version = "0.2.92"
1906
+ version = "0.2.93"
1870
1907
  source = "registry+https://github.com/rust-lang/crates.io-index"
1871
- checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
1908
+ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
1872
1909
  dependencies = [
1873
1910
  "proc-macro2",
1874
1911
  "quote",
1875
- "syn 2.0.72",
1912
+ "syn 2.0.77",
1876
1913
  "wasm-bindgen-backend",
1877
1914
  "wasm-bindgen-shared",
1878
1915
  ]
1879
1916
 
1880
1917
  [[package]]
1881
1918
  name = "wasm-bindgen-shared"
1882
- version = "0.2.92"
1919
+ version = "0.2.93"
1883
1920
  source = "registry+https://github.com/rust-lang/crates.io-index"
1884
- checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
1921
+ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
1885
1922
 
1886
1923
  [[package]]
1887
1924
  name = "webpki-roots"
@@ -2084,34 +2121,14 @@ dependencies = [
2084
2121
  "tap",
2085
2122
  ]
2086
2123
 
2087
- [[package]]
2088
- name = "zerocopy"
2089
- version = "0.6.6"
2090
- source = "registry+https://github.com/rust-lang/crates.io-index"
2091
- checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6"
2092
- dependencies = [
2093
- "byteorder",
2094
- "zerocopy-derive 0.6.6",
2095
- ]
2096
-
2097
2124
  [[package]]
2098
2125
  name = "zerocopy"
2099
2126
  version = "0.7.35"
2100
2127
  source = "registry+https://github.com/rust-lang/crates.io-index"
2101
2128
  checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
2102
2129
  dependencies = [
2103
- "zerocopy-derive 0.7.35",
2104
- ]
2105
-
2106
- [[package]]
2107
- name = "zerocopy-derive"
2108
- version = "0.6.6"
2109
- source = "registry+https://github.com/rust-lang/crates.io-index"
2110
- checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91"
2111
- dependencies = [
2112
- "proc-macro2",
2113
- "quote",
2114
- "syn 2.0.72",
2130
+ "byteorder",
2131
+ "zerocopy-derive",
2115
2132
  ]
2116
2133
 
2117
2134
  [[package]]
@@ -2122,5 +2139,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
2122
2139
  dependencies = [
2123
2140
  "proc-macro2",
2124
2141
  "quote",
2125
- "syn 2.0.72",
2142
+ "syn 2.0.77",
2126
2143
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "mongojet"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  edition = "2021"
5
5
 
6
6
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -11,10 +11,10 @@ crate-type = ["cdylib"]
11
11
  [dependencies]
12
12
  pyo3 = {version = "0.22", features = ["full"]}
13
13
  pyo3-log={version = "0.11" }
14
- tokio = {version = "1.39", features = ["full"]}
14
+ tokio = {version = "1.40", features = ["full"]}
15
15
  futures="0.3"
16
16
 
17
- mongodb = {version = "3.0"}
17
+ mongodb = {version = "3.1"}
18
18
  bson = { version = "2.11", features = ["chrono-0_4"] }
19
19
  chrono = {version = "0.4", features = ["serde"]}
20
20
  chrono-tz = "0.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mongojet
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python
@@ -0,0 +1,50 @@
1
+ from typing import Any, Optional
2
+
3
+ from bson import CodecOptions
4
+
5
+ from .mongojet import PyMongoError, NoFile, FileExists, DuplicateKeyError
6
+ from ._codec import Codec
7
+ from ._types import GridFsPutResult
8
+
9
+
10
+ class GridfsBucket:
11
+ def __init__(self, core_bucket, codec_options: CodecOptions):
12
+ self._core_bucket = core_bucket
13
+ self._codec = Codec(codec_options)
14
+
15
+ async def put(
16
+ self,
17
+ data: bytes,
18
+ filename: Optional[str] = None,
19
+ file_id: Optional[Any] = None,
20
+ **metadata: Any,
21
+ ) -> GridFsPutResult:
22
+
23
+ options = {}
24
+ if filename:
25
+ options['filename'] = filename
26
+ if file_id:
27
+ options['file_id'] = file_id
28
+
29
+ try:
30
+ result = await self._core_bucket.put(
31
+ data,
32
+ self._codec.encode(options),
33
+ self._codec.encode(metadata),
34
+ )
35
+ except DuplicateKeyError as e:
36
+ raise FileExists(e) from e
37
+ else:
38
+ return self._codec.decode(result)
39
+
40
+ async def get_by_id(self, file_id: Any) -> bytes:
41
+ options = {'file_id': file_id}
42
+ return await self._core_bucket.get_by_id(self._codec.encode(options))
43
+
44
+ async def get_by_name(self, filename: Any) -> bytes:
45
+ options = {'filename': filename}
46
+ return await self._core_bucket.get_by_name(self._codec.encode(options))
47
+
48
+ async def delete(self, file_id: Any) -> None:
49
+ options = {'file_id': file_id}
50
+ await self._core_bucket.delete(self._codec.encode(options))
@@ -1,6 +1,6 @@
1
1
  use std::fmt::{Display, Formatter};
2
2
 
3
- use mongodb::error::{ErrorKind, WriteFailure};
3
+ use mongodb::error::{ErrorKind, GridFsErrorKind, WriteFailure};
4
4
  use pyo3::exceptions::{PyException, PyValueError};
5
5
  use pyo3::{create_exception, PyErr};
6
6
 
@@ -133,17 +133,21 @@ impl From<MongoError> for PyErr {
133
133
  // if cmd.code == 85{
134
134
  OperationFailure::new_err(msg)
135
135
  }
136
- //todo
137
- //error[E0603]: tuple variant `GridFs` is private
138
- // https://github.com/mongodb/mongo-rust-driver/issues/1071
139
- // ErrorKind::GridFs(..) => GridFSError::new_err(msg),
136
+ ErrorKind::GridFs(kind) => match kind {
137
+ GridFsErrorKind::FileNotFound { .. } => NoFile::new_err(msg),
138
+ _ => GridFSError::new_err(msg),
139
+ },
140
140
  _ => PyMongoError::new_err(msg),
141
141
  }
142
142
  }
143
143
  }
144
144
 
145
145
  impl From<std::io::Error> for MongoError {
146
- fn from(value: std::io::Error) -> Self {
147
- MongoError(mongodb::error::Error::from(value))
146
+ fn from(io_error: std::io::Error) -> Self {
147
+ let mongo_error = io_error.downcast::<mongodb::error::Error>();
148
+ match mongo_error {
149
+ Ok(e) => MongoError(e),
150
+ Err(e) => MongoError(mongodb::error::Error::from(e)),
151
+ }
148
152
  }
149
153
  }
@@ -1,85 +0,0 @@
1
- from typing import Any, Optional
2
-
3
- from bson import CodecOptions
4
-
5
- from .mongojet import PyMongoError, NoFile, FileExists
6
- from ._codec import Codec
7
- from ._types import GridFsPutResult
8
-
9
-
10
- class GridfsBucket:
11
- def __init__(self, core_bucket, codec_options: CodecOptions):
12
- self._core_bucket = core_bucket
13
- self._codec = Codec(codec_options)
14
-
15
- async def put(
16
- self,
17
- data: bytes,
18
- filename: Optional[str] = None,
19
- file_id: Optional[Any] = None,
20
- **metadata: Any,
21
- ) -> GridFsPutResult:
22
-
23
- options = {}
24
- if filename:
25
- options['filename'] = filename
26
- if file_id:
27
- options['file_id'] = file_id
28
-
29
- # temporary hack (https://github.com/mongodb/mongo-rust-driver/issues/1071)
30
- try:
31
- result = await self._core_bucket.put(
32
- data,
33
- self._codec.encode(options),
34
- self._codec.encode(metadata),
35
- )
36
- except PyMongoError as e:
37
- if 'E11000 duplicate key error' in str(e):
38
- raise FileExists(e) from e
39
- else:
40
- raise
41
- else:
42
- return self._codec.decode(result)
43
-
44
- async def get_by_id(self, file_id: Any) -> bytes:
45
- options = {'file_id': file_id}
46
- # temporary hack (https://github.com/mongodb/mongo-rust-driver/issues/1071)
47
- try:
48
- result = await self._core_bucket.get_by_id(
49
- self._codec.encode(options),
50
- )
51
- except PyMongoError as e:
52
- if 'FileNotFound' in str(e):
53
- raise NoFile(e) from e
54
- else:
55
- raise
56
- else:
57
- return result
58
-
59
- async def get_by_name(self, filename: Any) -> bytes:
60
- options = {'filename': filename}
61
- # temporary hack (https://github.com/mongodb/mongo-rust-driver/issues/1071)
62
- try:
63
- result = await self._core_bucket.get_by_name(
64
- self._codec.encode(options),
65
- )
66
- except PyMongoError as e:
67
- if 'FileNotFound' in str(e):
68
- raise NoFile(e) from e
69
- else:
70
- raise
71
- else:
72
- return result
73
-
74
- async def delete(self, file_id: Any) -> None:
75
- options = {'file_id': file_id}
76
- # temporary hack (https://github.com/mongodb/mongo-rust-driver/issues/1071)
77
- try:
78
- await self._core_bucket.delete(
79
- self._codec.encode(options),
80
- )
81
- except PyMongoError as e:
82
- if 'FileNotFound' in str(e):
83
- raise NoFile(e) from e
84
- else:
85
- raise
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes