File: 0004-remove-pytz-dependency.patch

package info (click to toggle)
pendulum 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,768 kB
  • sloc: python: 18,420; makefile: 41
file content (129 lines) | stat: -rw-r--r-- 4,770 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
Description: remove pytz dependency
Author: Ananthu C V <weepingclown@debian.org>
Forwarded: https://github.com/python-pendulum/pendulum/pull/911
Last-Update: 2026-08-20
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -37,3 +37,2 @@
 pytest = "^7.1.2"
-pytz = ">=2022.1"
 time-machine = ">=2.16.0"
@@ -53,3 +52,2 @@
 types-python-dateutil = "^2.8.19"
-types-pytz = ">=2022.7.1.2"
 
--- a/tests/datetime/test_comparison.py
+++ b/tests/datetime/test_comparison.py
@@ -4,3 +4,3 @@
 
-import pytz
+import zoneinfo
 
@@ -101,3 +101,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 8, 59, 59, tz="America/Vancouver")
-    d3 = pytz.timezone("America/Vancouver").localize(datetime(2000, 1, 1, 8, 59, 59))
+    d3 = datetime(2000, 1, 1, 8, 59, 59, tzinfo=zoneinfo.ZoneInfo("America/Vancouver"))
 
@@ -110,3 +110,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 9, 0, 1, tz="America/Vancouver")
-    d3 = pytz.timezone("America/Vancouver").localize(datetime(2000, 1, 1, 9, 0, 1))
+    d3 = datetime(2000, 1, 1, 9, 0, 1, tzinfo=zoneinfo.ZoneInfo("America/Vancouver"))
 
@@ -146,3 +146,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 8, 59, 59, tz="America/Vancouver")
-    d3 = pytz.timezone("America/Vancouver").localize(datetime(2000, 1, 1, 8, 59, 59))
+    d3 = datetime(2000, 1, 1, 8, 59, 59, tzinfo=zoneinfo.ZoneInfo("America/Vancouver"))
 
@@ -155,3 +155,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 9, 0, 1, tz="America/Vancouver")
-    d3 = pytz.timezone("America/Vancouver").localize(datetime(2000, 1, 1, 9, 0, 1))
+    d3 = datetime(2000, 1, 1, 9, 0, 1, tzinfo=zoneinfo.ZoneInfo("America/Vancouver"))
 
@@ -182,3 +182,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 12, 0, 0, tz="America/Toronto")
-    d3 = pytz.timezone("America/Toronto").localize(datetime(2000, 1, 1, 12, 0, 0))
+    d3 = datetime(2000, 1, 1, 12, 0, 0, tzinfo=zoneinfo.ZoneInfo("America/Toronto"))
 
@@ -191,3 +191,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 12, 0, 0, tz="America/Toronto")
-    d3 = pytz.timezone("America/Toronto").localize(datetime(2000, 1, 1, 12, 0, 0))
+    d3 = datetime(2000, 1, 1, 12, 0, 0, tzinfo=zoneinfo.ZoneInfo("America/Toronto"))
 
@@ -227,3 +227,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 12, 0, 0, tz="America/Toronto")
-    d3 = pytz.timezone("America/Toronto").localize(datetime(2000, 1, 1, 12, 0, 0))
+    d3 = datetime(2000, 1, 1, 12, 0, 0, tzinfo=zoneinfo.ZoneInfo("America/Toronto"))
 
@@ -236,3 +236,3 @@
     d2 = pendulum.datetime(2000, 1, 1, 12, 0, 0, tz="America/Toronto")
-    d3 = pytz.timezone("America/Toronto").localize(datetime(2000, 1, 1, 12, 0, 0))
+    d3 = datetime(2000, 1, 1, 12, 0, 0, tzinfo=zoneinfo.ZoneInfo("America/Toronto"))
 
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -5,3 +5,3 @@
 import pytest
-import pytz
+import zoneinfo
 
@@ -104,8 +104,7 @@
 
-    # pytz
-    paris_pytz = pytz.timezone("Europe/Paris")
-    toronto_pytz = pytz.timezone("America/Toronto")
+    paris_tz = zoneinfo.ZoneInfo("Europe/Paris")
+    toronto_tz = zoneinfo.ZoneInfo("America/Toronto")
 
-    dt1 = paris_pytz.localize(datetime(2013, 3, 31, 1, 30))
-    dt2 = paris_pytz.localize(datetime(2013, 4, 1, 1, 30))
+    dt1 = datetime(2013, 3, 31, 1, 30, tzinfo=paris_tz)
+    dt2 = datetime(2013, 4, 1, 1, 30, tzinfo=paris_tz)
 
@@ -115,3 +114,3 @@
 
-    dt2 = toronto_pytz.localize(datetime(2013, 4, 1, 1, 30))
+    dt2 = datetime(2013, 4, 1, 1, 30, tzinfo=toronto_tz)
 
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -6,3 +6,3 @@
 
-import pytz
+import zoneinfo
 
@@ -27,4 +27,4 @@
 
-def test_instance_with_aware_datetime_pytz() -> None:
-    now = pendulum.instance(datetime.now(pytz.timezone("Europe/Paris")))
+def test_instance_with_aware_datetime_zoneinfo() -> None:
+    now = pendulum.instance(datetime.now(zoneinfo.ZoneInfo("Europe/Paris")))
     assert now.timezone_name == "Europe/Paris"
@@ -59,3 +59,3 @@
 def test_safe_timezone_with_tzinfo_objects() -> None:
-    tz = _safe_timezone(pytz.timezone("Europe/Paris"))
+    tz = _safe_timezone(zoneinfo.ZoneInfo("Europe/Paris"))
 
--- a/tests/time/test_sub.py
+++ b/tests/time/test_sub.py
@@ -6,3 +6,3 @@
 import pytest
-import pytz
+import zoneinfo
 
@@ -89,3 +89,3 @@
     t2 = time(1, 1, 1)
-    t3 = time(1, 1, 1, tzinfo=pytz.timezone("Europe/Paris"))
+    t3 = time(1, 1, 1, tzinfo=zoneinfo.ZoneInfo("Europe/Paris"))
 
--- a/docs/docs/duration.md
+++ b/docs/docs/duration.md
@@ -13,6 +13,6 @@
     >>> import pendulum
-    >>> from datetime import datetime
+    >>> import datetime
 
-    >>> d1 = datetime(2012, 1, 1, 1, 2, 3, tzinfo=pytz.UTC)
-    >>> d2 = datetime(2011, 12, 31, 22, 2, 3, tzinfo=pytz.UTC)
+    >>> d1 = datetime.datetime(2012, 1, 1, 1, 2, 3, tzinfo=datetime.UTC)
+    >>> d2 = datetime.datetime(2011, 12, 31, 22, 2, 3, tzinfo=datetime.UTC)
     >>> delta = d2 - d1