@@ -42,32 +42,22 @@ pub use validators::{validate_core_schema, PySome, SchemaValidator};
42
42
43
43
use crate :: input:: Input ;
44
44
45
- #[ derive( FromPyObject ) ]
46
- pub enum CacheStringsArg {
47
- Bool ( bool ) ,
48
- Literal ( StringCacheMode ) ,
49
- }
50
-
51
- #[ pyfunction( signature = ( data, * , allow_inf_nan=true , cache_strings=CacheStringsArg :: Bool ( true ) , allow_partial=PartialMode :: Off ) ) ]
45
+ #[ pyfunction( signature = ( data, * , allow_inf_nan=true , cache_strings=StringCacheMode :: All , allow_partial=PartialMode :: Off ) ) ]
52
46
pub fn from_json < ' py > (
53
47
py : Python < ' py > ,
54
48
data : & Bound < ' _ , PyAny > ,
55
49
allow_inf_nan : bool ,
56
- cache_strings : CacheStringsArg ,
50
+ cache_strings : StringCacheMode ,
57
51
allow_partial : PartialMode ,
58
52
) -> PyResult < Bound < ' py , PyAny > > {
59
53
let v_match = data
60
54
. validate_bytes ( false , ValBytesMode { ser : BytesMode :: Utf8 } )
61
55
. map_err ( |_| PyTypeError :: new_err ( "Expected bytes, bytearray or str" ) ) ?;
62
56
let json_either_bytes = v_match. into_inner ( ) ;
63
57
let json_bytes = json_either_bytes. as_slice ( ) ;
64
- let cache_mode = match cache_strings {
65
- CacheStringsArg :: Bool ( b) => b. into ( ) ,
66
- CacheStringsArg :: Literal ( mode) => mode,
67
- } ;
68
58
let parse_builder = PythonParse {
69
59
allow_inf_nan,
70
- cache_mode,
60
+ cache_mode : cache_strings ,
71
61
partial_mode : allow_partial,
72
62
catch_duplicate_keys : false ,
73
63
lossless_floats : false ,
0 commit comments