Skip to content

Commit d9dacb0

Browse files
authored
update to speedate 0.16 (#1740)
1 parent 3415428 commit d9dacb0

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

Cargo.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ rust-version = "1.75"
2929
# but needs a bit of work to make sure it's not used in the codebase
3030
pyo3 = { version = "0.25", features = ["generate-import-lib", "num-bigint", "py-clone"] }
3131
regex = "1.11.1"
32-
strum = { version = "0.26.3", features = ["derive"] }
33-
strum_macros = "0.26.4"
32+
strum = { version = "0.27", features = ["derive"] }
33+
strum_macros = "0.27"
3434
serde_json = { version = "1.0.140", features = ["arbitrary_precision"] }
3535
enum_dispatch = "0.3.13"
3636
serde = { version = "1.0.219", features = ["derive"] }
37-
speedate = "0.15.0"
37+
speedate = "0.16.0"
3838
smallvec = "1.15.0"
3939
ahash = "0.8.12"
4040
url = "2.5.4"

src/input/datetime.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ use pyo3::pyclass::CompareOp;
66
use pyo3::types::PyTuple;
77
use pyo3::types::{PyDate, PyDateTime, PyDelta, PyDeltaAccess, PyDict, PyTime, PyTzInfo};
88
use pyo3::IntoPyObjectExt;
9-
use speedate::MicrosecondsPrecisionOverflowBehavior;
10-
use speedate::{Date, DateTime, Duration, ParseError, Time, TimeConfig};
9+
use speedate::{
10+
Date, DateTime, DateTimeConfig, Duration, MicrosecondsPrecisionOverflowBehavior, ParseError, Time, TimeConfig,
11+
};
1112
use std::borrow::Cow;
1213
use std::collections::hash_map::DefaultHasher;
1314
use std::fmt::Write;
@@ -366,9 +367,12 @@ pub fn bytes_as_datetime<'py>(
366367
) -> ValResult<EitherDateTime<'py>> {
367368
match DateTime::parse_bytes_with_config(
368369
bytes,
369-
&TimeConfig {
370-
microseconds_precision_overflow_behavior: microseconds_overflow_behavior,
371-
unix_timestamp_offset: Some(0),
370+
&DateTimeConfig {
371+
time_config: TimeConfig {
372+
microseconds_precision_overflow_behavior: microseconds_overflow_behavior,
373+
unix_timestamp_offset: Some(0),
374+
},
375+
..Default::default()
372376
},
373377
) {
374378
Ok(dt) => Ok(dt.into()),
@@ -390,8 +394,11 @@ pub fn int_as_datetime<'py>(
390394
match DateTime::from_timestamp_with_config(
391395
timestamp,
392396
timestamp_microseconds,
393-
&TimeConfig {
394-
unix_timestamp_offset: Some(0),
397+
&DateTimeConfig {
398+
time_config: TimeConfig {
399+
unix_timestamp_offset: Some(0),
400+
..Default::default()
401+
},
395402
..Default::default()
396403
},
397404
) {

src/validators/datetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(crate) fn extract_microseconds_precision(
3232
schema_or_config_same(schema, config, intern!(schema.py(), "microseconds_precision"))?
3333
.map_or(
3434
Ok(speedate::MicrosecondsPrecisionOverflowBehavior::Truncate),
35-
|v: Bound<'_, PyString>| speedate::MicrosecondsPrecisionOverflowBehavior::try_from(v.to_str().unwrap()),
35+
|v: Bound<'_, PyString>| v.to_str().unwrap().parse(),
3636
)
3737
.map_err(|_| {
3838
py_schema_error_type!("Invalid `microseconds_precision`, must be one of \"truncate\" or \"error\"")

0 commit comments

Comments
 (0)