MCPcopy Create free account
hub / github.com/Pometry/Raphtory / aware_datetime

Method aware_datetime

raphtory-api/src/python/prop.rs:354–364  ·  view source on GitHub ↗
(value: &Bound<'_, PyAny>)

Source from the content-addressed store, hash-verified

352 /// Prop:
353 #[staticmethod]
354 pub fn aware_datetime(value: &Bound<'_, PyAny>) -> PyResult<Self> {
355 if let Ok(dt) = value.extract::<DateTime<Utc>>() {
356 return Ok(PyProp(Prop::DTime(dt)));
357 }
358 if let Ok(naive) = value.extract::<NaiveDateTime>() {
359 return Ok(PyProp(Prop::DTime(naive.and_utc())));
360 }
361 Err(PyTypeError::new_err(format!(
362 "Could not convert {value:?} to a datetime"
363 )))
364 }
365
366 /// Construct a `Prop` holding a naive (timezone-unaware) datetime.
367 ///

Callers 2

test_aware_datetimeFunction · 0.80

Calls 2

PyPropClass · 0.85
ErrEnum · 0.85

Tested by 2

test_aware_datetimeFunction · 0.64