From d08b9543f2aff9de7e0a74a0a8808f8f14fd520c Mon Sep 17 00:00:00 2001 From: Mayank Anand Date: Thu, 16 Dec 2021 22:01:08 +0000 Subject: [PATCH] style fixes --- python/cudf/cudf/_lib/cpp/datetime.pxd | 12 +++++++++--- python/cudf/cudf/_lib/datetime.pyx | 11 ++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/python/cudf/cudf/_lib/cpp/datetime.pxd b/python/cudf/cudf/_lib/cpp/datetime.pxd index 67a9d811889..498fc313cf9 100644 --- a/python/cudf/cudf/_lib/cpp/datetime.pxd +++ b/python/cudf/cudf/_lib/cpp/datetime.pxd @@ -23,9 +23,15 @@ cdef extern from "cudf/datetime.hpp" namespace "cudf::datetime" nogil: MICROSECOND "cudf::datetime::rounding_frequency::MICROSECOND" NANOSECOND "cudf::datetime::rounding_frequency::NANOSECOND" - cdef unique_ptr[column] ceil_datetimes(const column_view& column, rounding_frequency freq) except + - cdef unique_ptr[column] floor_datetimes(const column_view& column, rounding_frequency freq) except + - cdef unique_ptr[column] round_datetimes(const column_view& column, rounding_frequency freq) except + + cdef unique_ptr[column] ceil_datetimes( + const column_view& column, rounding_frequency freq + ) except + + cdef unique_ptr[column] floor_datetimes( + const column_view& column, rounding_frequency freq + ) except + + cdef unique_ptr[column] round_datetimes( + const column_view& column, rounding_frequency freq + ) except + cdef unique_ptr[column] add_calendrical_months( const column_view& timestamps, diff --git a/python/cudf/cudf/_lib/datetime.pyx b/python/cudf/cudf/_lib/datetime.pyx index 64b78bd3a11..6618ed37154 100644 --- a/python/cudf/cudf/_lib/datetime.pyx +++ b/python/cudf/cudf/_lib/datetime.pyx @@ -61,6 +61,7 @@ def extract_datetime_component(Column col, object field): return result + cdef libcudf_datetime.rounding_frequency _get_rounding_frequency(object freq): cdef libcudf_datetime.rounding_frequency freq_val @@ -83,10 +84,12 @@ cdef libcudf_datetime.rounding_frequency _get_rounding_frequency(object freq): raise ValueError(f"Invalid resolution: '{freq}'") return freq_val + def ceil_datetime(Column col, object freq): cdef unique_ptr[column] c_result cdef column_view col_view = col.view() - cdef libcudf_datetime.rounding_frequency freq_val = _get_rounding_frequency(freq) + cdef libcudf_datetime.rounding_frequency freq_val = \ + _get_rounding_frequency(freq) with nogil: c_result = move(libcudf_datetime.ceil_datetimes(col_view, freq_val)) @@ -98,7 +101,8 @@ def ceil_datetime(Column col, object freq): def floor_datetime(Column col, object freq): cdef unique_ptr[column] c_result cdef column_view col_view = col.view() - cdef libcudf_datetime.rounding_frequency freq_val = _get_rounding_frequency(freq) + cdef libcudf_datetime.rounding_frequency freq_val = \ + _get_rounding_frequency(freq) with nogil: c_result = move(libcudf_datetime.floor_datetimes(col_view, freq_val)) @@ -110,7 +114,8 @@ def floor_datetime(Column col, object freq): def round_datetime(Column col, object freq): cdef unique_ptr[column] c_result cdef column_view col_view = col.view() - cdef libcudf_datetime.rounding_frequency freq_val = _get_rounding_frequency(freq) + cdef libcudf_datetime.rounding_frequency freq_val = \ + _get_rounding_frequency(freq) with nogil: c_result = move(libcudf_datetime.round_datetimes(col_view, freq_val))