hdx-python-utilities 4.2.4__py3-none-any.whl → 4.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hdx/utilities/_version.py +2 -2
- hdx/utilities/base_downloader.py +1 -3
- hdx/utilities/dateparse.py +19 -19
- {hdx_python_utilities-4.2.4.dist-info → hdx_python_utilities-4.2.5.dist-info}/METADATA +2 -4
- {hdx_python_utilities-4.2.4.dist-info → hdx_python_utilities-4.2.5.dist-info}/RECORD +7 -7
- {hdx_python_utilities-4.2.4.dist-info → hdx_python_utilities-4.2.5.dist-info}/WHEEL +0 -0
- {hdx_python_utilities-4.2.4.dist-info → hdx_python_utilities-4.2.5.dist-info}/licenses/LICENSE +0 -0
hdx/utilities/_version.py
CHANGED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '4.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (4, 2,
|
|
21
|
+
__version__ = version = '4.2.5'
|
|
22
|
+
__version_tuple__ = version_tuple = (4, 2, 5)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
hdx/utilities/base_downloader.py
CHANGED
hdx/utilities/dateparse.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import re
|
|
4
4
|
import time
|
|
5
5
|
from calendar import monthrange
|
|
6
|
-
from datetime import datetime, timedelta
|
|
6
|
+
from datetime import UTC, datetime, timedelta
|
|
7
7
|
from io import StringIO
|
|
8
8
|
|
|
9
9
|
import dateutil
|
|
@@ -27,7 +27,7 @@ default_date = datetime(
|
|
|
27
27
|
minute=0,
|
|
28
28
|
second=0,
|
|
29
29
|
microsecond=0,
|
|
30
|
-
tzinfo=
|
|
30
|
+
tzinfo=UTC,
|
|
31
31
|
)
|
|
32
32
|
default_ed_year = 9990
|
|
33
33
|
default_enddate_notz = datetime(
|
|
@@ -47,7 +47,7 @@ default_enddate = datetime(
|
|
|
47
47
|
minute=0,
|
|
48
48
|
second=0,
|
|
49
49
|
microsecond=0,
|
|
50
|
-
tzinfo=
|
|
50
|
+
tzinfo=UTC,
|
|
51
51
|
)
|
|
52
52
|
|
|
53
53
|
# Used https://stackoverflow.com/questions/1703546/parsing-date-time-string-with-timezone-abbreviated-name-in-python/4766400#4766400
|
|
@@ -805,7 +805,7 @@ def now_utc() -> datetime:
|
|
|
805
805
|
Returns:
|
|
806
806
|
Now with UTC timezone
|
|
807
807
|
"""
|
|
808
|
-
return datetime.now(
|
|
808
|
+
return datetime.now(UTC)
|
|
809
809
|
|
|
810
810
|
|
|
811
811
|
def now_utc_notz() -> datetime:
|
|
@@ -814,7 +814,7 @@ def now_utc_notz() -> datetime:
|
|
|
814
814
|
Returns:
|
|
815
815
|
Now in UTC but with timezone removed
|
|
816
816
|
"""
|
|
817
|
-
return datetime.now(
|
|
817
|
+
return datetime.now(UTC).replace(tzinfo=None)
|
|
818
818
|
|
|
819
819
|
|
|
820
820
|
def parse_date_range(
|
|
@@ -959,25 +959,25 @@ def parse_date_range(
|
|
|
959
959
|
if max_endtime:
|
|
960
960
|
enddate = enddate.replace(hour=23, minute=59, second=59, microsecond=999999)
|
|
961
961
|
if timezone_handling == 0:
|
|
962
|
-
startdate = startdate.replace(tzinfo=
|
|
963
|
-
enddate = enddate.replace(tzinfo=
|
|
962
|
+
startdate = startdate.replace(tzinfo=UTC)
|
|
963
|
+
enddate = enddate.replace(tzinfo=UTC)
|
|
964
964
|
elif timezone_handling == 3:
|
|
965
965
|
if startdate.tzinfo is None:
|
|
966
|
-
startdate = startdate.replace(tzinfo=
|
|
966
|
+
startdate = startdate.replace(tzinfo=UTC)
|
|
967
967
|
if enddate.tzinfo is None:
|
|
968
|
-
enddate = enddate.replace(tzinfo=
|
|
968
|
+
enddate = enddate.replace(tzinfo=UTC)
|
|
969
969
|
elif timezone_handling == 4:
|
|
970
|
-
startdate = startdate.astimezone(
|
|
971
|
-
enddate = enddate.astimezone(
|
|
970
|
+
startdate = startdate.astimezone(UTC)
|
|
971
|
+
enddate = enddate.astimezone(UTC)
|
|
972
972
|
elif timezone_handling == 5:
|
|
973
973
|
if startdate.tzinfo is None:
|
|
974
|
-
startdate = startdate.replace(tzinfo=
|
|
974
|
+
startdate = startdate.replace(tzinfo=UTC)
|
|
975
975
|
else:
|
|
976
|
-
startdate = startdate.astimezone(
|
|
976
|
+
startdate = startdate.astimezone(UTC)
|
|
977
977
|
if enddate.tzinfo is None:
|
|
978
|
-
enddate = enddate.replace(tzinfo=
|
|
978
|
+
enddate = enddate.replace(tzinfo=UTC)
|
|
979
979
|
else:
|
|
980
|
-
enddate = enddate.astimezone(
|
|
980
|
+
enddate = enddate.astimezone(UTC)
|
|
981
981
|
if not include_microseconds:
|
|
982
982
|
startdate = startdate.replace(microsecond=0)
|
|
983
983
|
enddate = enddate.replace(microsecond=0)
|
|
@@ -1092,12 +1092,12 @@ def get_timestamp_from_datetime(date: datetime) -> float:
|
|
|
1092
1092
|
+ date.microsecond / 1e6
|
|
1093
1093
|
)
|
|
1094
1094
|
else:
|
|
1095
|
-
return (date - datetime(1970, 1, 1, tzinfo=
|
|
1095
|
+
return (date - datetime(1970, 1, 1, tzinfo=UTC)).total_seconds()
|
|
1096
1096
|
|
|
1097
1097
|
|
|
1098
1098
|
def get_datetime_from_timestamp(
|
|
1099
1099
|
timestamp: float,
|
|
1100
|
-
timezone: datetime.tzinfo =
|
|
1100
|
+
timezone: datetime.tzinfo = UTC,
|
|
1101
1101
|
today: datetime = now_utc(),
|
|
1102
1102
|
) -> datetime:
|
|
1103
1103
|
"""Convert timestamp to datetime.
|
|
@@ -1150,7 +1150,7 @@ def get_quarter_start(year: int, quarter: int) -> datetime:
|
|
|
1150
1150
|
First day of quarter
|
|
1151
1151
|
"""
|
|
1152
1152
|
month = 3 * (quarter - 1) + 1
|
|
1153
|
-
return datetime(year, month, 1, tzinfo=
|
|
1153
|
+
return datetime(year, month, 1, tzinfo=UTC)
|
|
1154
1154
|
|
|
1155
1155
|
|
|
1156
1156
|
def get_quarter_end(
|
|
@@ -1183,5 +1183,5 @@ def get_quarter_end(
|
|
|
1183
1183
|
seconds = 0
|
|
1184
1184
|
microseconds = 0
|
|
1185
1185
|
return datetime(
|
|
1186
|
-
year, month, 1, hours, minutes, seconds, microseconds, tzinfo=
|
|
1186
|
+
year, month, 1, hours, minutes, seconds, microseconds, tzinfo=UTC
|
|
1187
1187
|
) + timedelta(days=-1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: hdx-python-utilities
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.5
|
|
4
4
|
Summary: HDX Python Utilities for streaming tabular data, date and time handling and other helpful functions
|
|
5
5
|
Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-utilities
|
|
6
6
|
Author-email: Michael Rans <rans@email.com>
|
|
@@ -18,13 +18,12 @@ Classifier: Operating System :: Unix
|
|
|
18
18
|
Classifier: Programming Language :: Python
|
|
19
19
|
Classifier: Programming Language :: Python :: 3
|
|
20
20
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.14
|
|
26
25
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
-
Requires-Python: >=3.
|
|
26
|
+
Requires-Python: >=3.11
|
|
28
27
|
Requires-Dist: frictionless>=5.19.0
|
|
29
28
|
Requires-Dist: ijson>=3.5.0
|
|
30
29
|
Requires-Dist: jsonlines>=4.0.0
|
|
@@ -36,7 +35,6 @@ Requires-Dist: ratelimit
|
|
|
36
35
|
Requires-Dist: requests-file
|
|
37
36
|
Requires-Dist: ruamel-yaml
|
|
38
37
|
Requires-Dist: tableschema-to-template>=0.0.13
|
|
39
|
-
Requires-Dist: typing-extensions
|
|
40
38
|
Requires-Dist: xlrd>=2.0.1
|
|
41
39
|
Requires-Dist: xlsx2csv==0.8.4
|
|
42
40
|
Requires-Dist: xlwt>=1.3.0
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
hdx/utilities/__init__.py,sha256=DQztoBWScN4UoX3pTjA6JN_CHX-Lls3duu41YLJtdcM,72
|
|
2
|
-
hdx/utilities/_version.py,sha256=
|
|
3
|
-
hdx/utilities/base_downloader.py,sha256=
|
|
2
|
+
hdx/utilities/_version.py,sha256=7bhmAD-On_XHKZRDnLBnKaG2dkNHvJ2D5XVBOhtc5UA,520
|
|
3
|
+
hdx/utilities/base_downloader.py,sha256=jFQ0zf9FdAjNBKBieZj47Aejl0cn92jVvajuYASH394,3471
|
|
4
4
|
hdx/utilities/compare.py,sha256=3w12iMELCBsR9gKXM7zyRZAf8YSeRylJwmGuLlEkAVQ,1145
|
|
5
|
-
hdx/utilities/dateparse.py,sha256=
|
|
5
|
+
hdx/utilities/dateparse.py,sha256=rs8uUSy_YnGxCqMNv8LWbaZHYmmtdAbJnzwsOenq0FE,41971
|
|
6
6
|
hdx/utilities/dictandlist.py,sha256=ho760YhYUGrd4GpkDekgFJiOg2bpqOHwvjTQmQx82h0,15590
|
|
7
7
|
hdx/utilities/downloader.py,sha256=nyjuzrEHELdU81gAdUQsFkujM42fHOXh4DO1UcPRBpg,59973
|
|
8
8
|
hdx/utilities/easy_logging.py,sha256=UizwMsYpFcKmY3x7qVPxi4cIpEyqpKQaKhby_kuFH4A,2129
|
|
@@ -25,7 +25,7 @@ hdx/utilities/url.py,sha256=iN4tqU7sbpXc3EXMNaQfoot8Wm98AvDKN_oKS2heuAE,4312
|
|
|
25
25
|
hdx/utilities/useragent.py,sha256=u1nwquIei93lLMAGqHrLs0w99qIIM1A2yUY7AOMSFy4,6862
|
|
26
26
|
hdx/utilities/uuid.py,sha256=KUpQoo0P3RFO_n6-qdxTDxdaJMUpkTosdI0ulyk-RYA,557
|
|
27
27
|
hdx/utilities/zip_crc.py,sha256=qs-81dd1oX6uIfwH7DUoZaS7OngHwOb7lnogBVmtBl8,4275
|
|
28
|
-
hdx_python_utilities-4.2.
|
|
29
|
-
hdx_python_utilities-4.2.
|
|
30
|
-
hdx_python_utilities-4.2.
|
|
31
|
-
hdx_python_utilities-4.2.
|
|
28
|
+
hdx_python_utilities-4.2.5.dist-info/METADATA,sha256=s9GWRw2vU2DH53tDT8swq5Koo0jPEfmyssb_geF6aYc,5409
|
|
29
|
+
hdx_python_utilities-4.2.5.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
30
|
+
hdx_python_utilities-4.2.5.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
|
|
31
|
+
hdx_python_utilities-4.2.5.dist-info/RECORD,,
|
|
File without changes
|
{hdx_python_utilities-4.2.4.dist-info → hdx_python_utilities-4.2.5.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|