python-tqdm/sprinkle-in-timezone.patch
Steve Kowalik 9a455ff2bd - Add patch sprinkle-in-timezone.patch:
* Add a timezone to the call fromtimestamp()
- Switch to autosetup macro.
- Remove conditionals from some BuildRequires.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-tqdm?expand=0&rev=122
2023-11-24 04:34:26 +00:00

33 lines
1.2 KiB
Diff

From 6945b214bc4faac8db459d8734b4b8d116ba54a9 Mon Sep 17 00:00:00 2001
From: jamate <mateoarcilalopez@gmail.com>
Date: Wed, 4 Oct 2023 11:58:14 -0500
Subject: [PATCH] Fix DeprecationWarning for datetime.utcfromtimestamp in
Python 3.12
---
tqdm/std.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tqdm/std.py b/tqdm/std.py
index 9ba8e8506..83386c5fe 100644
--- a/tqdm/std.py
+++ b/tqdm/std.py
@@ -10,7 +10,7 @@
import sys
from collections import OrderedDict, defaultdict
from contextlib import contextmanager
-from datetime import datetime, timedelta
+from datetime import datetime, timedelta, timezone
from numbers import Number
from time import time
from warnings import warn
@@ -577,7 +577,7 @@ def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it
remaining_str = tqdm.format_interval(remaining) if rate else '?'
try:
eta_dt = (datetime.now() + timedelta(seconds=remaining)
- if rate and total else datetime.utcfromtimestamp(0))
+ if rate and total else datetime.fromtimestamp(0, timezone.utc))
except OverflowError:
eta_dt = datetime.max