From 24643ee94c41f43969b521393befabd974656df4 Mon Sep 17 00:00:00 2001 From: OlivierLuG Date: Mon, 25 May 2020 22:24:22 +0200 Subject: [PATCH 1/3] Replace old string formatting syntax with f-strings #29547: 2 files were fixed --- pandas/_libs/tslibs/timedeltas.pyx | 2 +- pandas/_libs/tslibs/timestamps.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 2be2338253937..5a598e0e86022 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -584,7 +584,7 @@ cdef inline int64_t parse_iso_format_string(str ts) except? -1: bint have_dot = 0, have_value = 0, neg = 0 list number = [], unit = [] - err_msg = "Invalid ISO 8601 Duration format - {}".format(ts) + err_msg = "Invalid ISO 8601 Duration format - {ts}" for c in ts: # number (ascii codes) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 12d44413e1350..ed1df9c14b1d2 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -194,7 +194,7 @@ def integer_op_not_supported(obj): "Addition/subtraction of integers and integer-arrays with {cls} is " "no longer supported. Instead of adding/subtracting `n`, " "use `n * obj.freq`" - ).format(cls=cls) + ) return TypeError(int_addsub_msg) From 9d86b7edc4daa252c0c23f742e5b060d2e515145 Mon Sep 17 00:00:00 2001 From: OlivierLuG <59281854+OlivierLuG@users.noreply.github.com> Date: Tue, 26 May 2020 11:35:25 +0200 Subject: [PATCH 2/3] timestamps.pyx --- pandas/_libs/tslibs/timestamps.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index ed1df9c14b1d2..9fd62e5e25c54 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -191,7 +191,7 @@ def integer_op_not_supported(obj): # GH#30886 using an fstring raises SystemError int_addsub_msg = ( - "Addition/subtraction of integers and integer-arrays with {cls} is " + f"Addition/subtraction of integers and integer-arrays with {cls} is " "no longer supported. Instead of adding/subtracting `n`, " "use `n * obj.freq`" ) From 2132119b7bea9961d679babae5fe625f1c78d557 Mon Sep 17 00:00:00 2001 From: OlivierLuG <59281854+OlivierLuG@users.noreply.github.com> Date: Tue, 26 May 2020 11:37:49 +0200 Subject: [PATCH 3/3] Update timedeltas.pyx --- pandas/_libs/tslibs/timedeltas.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 5a598e0e86022..5bc3694cf8dad 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -584,7 +584,7 @@ cdef inline int64_t parse_iso_format_string(str ts) except? -1: bint have_dot = 0, have_value = 0, neg = 0 list number = [], unit = [] - err_msg = "Invalid ISO 8601 Duration format - {ts}" + err_msg = f"Invalid ISO 8601 Duration format - {ts}" for c in ts: # number (ascii codes)