From 842f705dd8a90c0cb4327f6753b402963add4d59 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Thu, 2 Nov 2023 07:47:09 +0000 Subject: [PATCH] move deprecated methods to bottom of file --- py-polars/polars/expr/datetime.py | 154 ++++++++++++++-------------- py-polars/polars/series/datetime.py | 154 ++++++++++++++-------------- 2 files changed, 154 insertions(+), 154 deletions(-) diff --git a/py-polars/polars/expr/datetime.py b/py-polars/polars/expr/datetime.py index c67dee350a78..0c82d52dd288 100644 --- a/py-polars/polars/expr/datetime.py +++ b/py-polars/polars/expr/datetime.py @@ -1457,17 +1457,6 @@ def replace_time_zone( self._pyexpr.dt_replace_time_zone(time_zone, ambiguous._pyexpr) ) - @deprecate_renamed_function("total_days", version="0.19.3") - def days(self) -> Expr: - """ - Extract the total days from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_days` instead. - - """ - return self.total_days() - def total_days(self) -> Expr: """ Extract the total days from a Duration type. @@ -1507,17 +1496,6 @@ def total_days(self) -> Expr: """ return wrap_expr(self._pyexpr.duration_days()) - @deprecate_renamed_function("total_hours", version="0.19.3") - def hours(self) -> Expr: - """ - Extract the total hours from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_hours` instead. - - """ - return self.total_hours() - def total_hours(self) -> Expr: """ Extract the total hours from a Duration type. @@ -1558,17 +1536,6 @@ def total_hours(self) -> Expr: """ return wrap_expr(self._pyexpr.duration_hours()) - @deprecate_renamed_function("total_minutes", version="0.19.3") - def minutes(self) -> Expr: - """ - Extract the total minutes from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_minutes` instead. - - """ - return self.total_minutes() - def total_minutes(self) -> Expr: """ Extract the total minutes from a Duration type. @@ -1609,17 +1576,6 @@ def total_minutes(self) -> Expr: """ return wrap_expr(self._pyexpr.duration_minutes()) - @deprecate_renamed_function("total_seconds", version="0.19.3") - def seconds(self) -> Expr: - """ - Extract the total seconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_seconds` instead. - - """ - return self.total_seconds() - def total_seconds(self) -> Expr: """ Extract the total seconds from a Duration type. @@ -1662,17 +1618,6 @@ def total_seconds(self) -> Expr: """ return wrap_expr(self._pyexpr.duration_seconds()) - @deprecate_renamed_function("total_milliseconds", version="0.19.3") - def milliseconds(self) -> Expr: - """ - Extract the total milliseconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_milliseconds` instead. - - """ - return self.total_milliseconds() - def total_milliseconds(self) -> Expr: """ Extract the total milliseconds from a Duration type. @@ -1719,17 +1664,6 @@ def total_milliseconds(self) -> Expr: """ return wrap_expr(self._pyexpr.duration_milliseconds()) - @deprecate_renamed_function("total_microseconds", version="0.19.3") - def microseconds(self) -> Expr: - """ - Extract the total microseconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_microseconds` instead. - - """ - return self.total_microseconds() - def total_microseconds(self) -> Expr: """ Extract the total microseconds from a Duration type. @@ -1776,17 +1710,6 @@ def total_microseconds(self) -> Expr: """ return wrap_expr(self._pyexpr.duration_microseconds()) - @deprecate_renamed_function("total_nanoseconds", version="0.19.3") - def nanoseconds(self) -> Expr: - """ - Extract the total nanoseconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_nanoseconds` instead. - - """ - return self.total_nanoseconds() - def total_nanoseconds(self) -> Expr: """ Extract the total nanoseconds from a Duration type. @@ -2090,3 +2013,80 @@ def dst_offset(self) -> Expr: └─────────────────────────────┴──────────────┘ """ return wrap_expr(self._pyexpr.dt_dst_offset()) + + @deprecate_renamed_function("total_days", version="0.19.13") + def days(self) -> Expr: + """ + Extract the total days from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_days` instead. + + """ + return self.total_days() + + @deprecate_renamed_function("total_hours", version="0.19.13") + def hours(self) -> Expr: + """ + Extract the total hours from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_hours` instead. + + """ + return self.total_hours() + + @deprecate_renamed_function("total_minutes", version="0.19.13") + def minutes(self) -> Expr: + """ + Extract the total minutes from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_minutes` instead. + + """ + return self.total_minutes() + + @deprecate_renamed_function("total_seconds", version="0.19.13") + def seconds(self) -> Expr: + """ + Extract the total seconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_seconds` instead. + + """ + return self.total_seconds() + + @deprecate_renamed_function("total_milliseconds", version="0.19.13") + def milliseconds(self) -> Expr: + """ + Extract the total milliseconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_milliseconds` instead. + + """ + return self.total_milliseconds() + + @deprecate_renamed_function("total_microseconds", version="0.19.13") + def microseconds(self) -> Expr: + """ + Extract the total microseconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_microseconds` instead. + + """ + return self.total_microseconds() + + @deprecate_renamed_function("total_nanoseconds", version="0.19.13") + def nanoseconds(self) -> Expr: + """ + Extract the total nanoseconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_nanoseconds` instead. + + """ + return self.total_nanoseconds() diff --git a/py-polars/polars/series/datetime.py b/py-polars/polars/series/datetime.py index b48109b6984c..b96953a85029 100644 --- a/py-polars/polars/series/datetime.py +++ b/py-polars/polars/series/datetime.py @@ -1098,17 +1098,6 @@ def replace_time_zone( """ - @deprecate_renamed_function("total_days", version="0.19.3") - def days(self) -> Series: - """ - Extract the total days from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_days` instead. - - """ - return self.total_days() - def total_days(self) -> Series: """ Extract the total days from a Duration type. @@ -1143,17 +1132,6 @@ def total_days(self) -> Series: """ - @deprecate_renamed_function("total_hours", version="0.19.3") - def hours(self) -> Series: - """ - Extract the total hours from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_hours` instead. - - """ - return self.total_hours() - def total_hours(self) -> Series: """ Extract the total hours from a Duration type. @@ -1190,17 +1168,6 @@ def total_hours(self) -> Series: """ - @deprecate_renamed_function("total_minutes", version="0.19.3") - def minutes(self) -> Series: - """ - Extract the total minutes from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_minutes` instead. - - """ - return self.total_minutes() - def total_minutes(self) -> Series: """ Extract the total minutes from a Duration type. @@ -1237,17 +1204,6 @@ def total_minutes(self) -> Series: """ - @deprecate_renamed_function("total_seconds", version="0.19.3") - def seconds(self) -> Series: - """ - Extract the total seconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_seconds` instead. - - """ - return self.total_seconds() - def total_seconds(self) -> Series: """ Extract the total seconds from a Duration type. @@ -1286,17 +1242,6 @@ def total_seconds(self) -> Series: """ - @deprecate_renamed_function("total_milliseconds", version="0.19.3") - def milliseconds(self) -> Series: - """ - Extract the total milliseconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_milliseconds` instead. - - """ - return self.total_milliseconds() - def total_milliseconds(self) -> Series: """ Extract the total milliseconds from a Duration type. @@ -1334,17 +1279,6 @@ def total_milliseconds(self) -> Series: """ - @deprecate_renamed_function("total_microseconds", version="0.19.3") - def microseconds(self) -> Series: - """ - Extract the total microseconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_microseconds` instead. - - """ - return self.total_microseconds() - def total_microseconds(self) -> Series: """ Extract the total microseconds from a Duration type. @@ -1382,17 +1316,6 @@ def total_microseconds(self) -> Series: """ - @deprecate_renamed_function("total_nanoseconds", version="0.19.3") - def nanoseconds(self) -> Series: - """ - Extract the total nanoseconds from a Duration type. - - .. deprecated:: 0.19.3 - Use :meth:`total_nanoseconds` instead. - - """ - return self.total_nanoseconds() - def total_nanoseconds(self) -> Series: """ Extract the total nanoseconds from a Duration type. @@ -1985,3 +1908,80 @@ def dst_offset(self) -> Series: ] """ + + @deprecate_renamed_function("total_days", version="0.19.13") + def days(self) -> Series: + """ + Extract the total days from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_days` instead. + + """ + return self.total_days() + + @deprecate_renamed_function("total_hours", version="0.19.13") + def hours(self) -> Series: + """ + Extract the total hours from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_hours` instead. + + """ + return self.total_hours() + + @deprecate_renamed_function("total_minutes", version="0.19.13") + def minutes(self) -> Series: + """ + Extract the total minutes from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_minutes` instead. + + """ + return self.total_minutes() + + @deprecate_renamed_function("total_seconds", version="0.19.13") + def seconds(self) -> Series: + """ + Extract the total seconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_seconds` instead. + + """ + return self.total_seconds() + + @deprecate_renamed_function("total_milliseconds", version="0.19.13") + def milliseconds(self) -> Series: + """ + Extract the total milliseconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_milliseconds` instead. + + """ + return self.total_milliseconds() + + @deprecate_renamed_function("total_microseconds", version="0.19.13") + def microseconds(self) -> Series: + """ + Extract the total microseconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_microseconds` instead. + + """ + return self.total_microseconds() + + @deprecate_renamed_function("total_nanoseconds", version="0.19.13") + def nanoseconds(self) -> Series: + """ + Extract the total nanoseconds from a Duration type. + + .. deprecated:: 0.19.13 + Use :meth:`total_nanoseconds` instead. + + """ + return self.total_nanoseconds()