hdx-python-utilities 4.2.4__tar.gz → 4.2.5__tar.gz
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_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/CLAUDE.md +1 -1
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/PKG-INFO +2 -4
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/documentation/index.md +2 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/pyproject.toml +2 -4
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/_version.py +2 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/base_downloader.py +1 -3
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/dateparse.py +19 -19
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_dateparse.py +88 -102
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_state.py +3 -3
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/uv.lock +31 -704
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.github/workflows/publish-test.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.github/workflows/publish.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.github/workflows/run-python-tests.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.gitignore +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.pre-commit-config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/LICENSE +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/README.md +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/documentation/.readthedocs.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/documentation/mkdocs.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/__init__.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/compare.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/dictandlist.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/downloader.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/easy_logging.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/email.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/encoding.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/error_handler.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/errors_onexit.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/file_hashing.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/frictionless_wrapper.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/html.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/loader.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/matching.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/path.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/retriever.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/saver.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/session.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/state.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/text.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/url.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/useragent.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/uuid.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/zip_crc.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/compare/test_csv_processing.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/compare/test_csv_processing2.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/empty.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_config.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_email_configuration.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/logging_config.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/logging_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/project_configuration.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/project_configuration.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/smtp_config.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/smtp_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config2.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config3.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/basicauth.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/bearertoken.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/extra_params.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/extra_params.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/extra_params_tree.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/resume_test.dat +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_csv_processing.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_csv_processing_blanks.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data1.csv/empty.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data2.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_json_processing.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_xls_processing.xls +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_xlsx_processing.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/bad_header.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/bad_index.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/empty.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/test.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/test_shapefile.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/valid_sig_invalid_body.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/html/response.html +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/loader/empty.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/loader/empty.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/loader/empty_list.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/matching/wfp_admin_matcher_calls.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/retriever-test.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out2.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out2.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out5.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out6.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out7.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out8.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out8.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-false.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-false.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-true.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-true.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-false.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-false.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-true.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-true.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/state/analysis_dates.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/state/last_build_date.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/test_data.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/text/text1.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/text/text2.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/conftest.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_compare.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_dictandlist.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_downloader.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_easy_logging.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_email.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_encoding.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_error_handler.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_file_hashing.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_html.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_loader.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_matching.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_matching_wfp_admin.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_path.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_retriever.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_saver.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_text.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_url.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_useragent.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_uuid.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_zip_crc.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/utils.py +0 -0
|
@@ -65,7 +65,7 @@ Key modules:
|
|
|
65
65
|
|
|
66
66
|
## Code Style
|
|
67
67
|
|
|
68
|
-
- Python ≥ 3.
|
|
68
|
+
- Python ≥ 3.11; type hints throughout using `X | Y` union syntax (PEP 604)
|
|
69
69
|
- Google-style docstrings with `Args:` and `Returns:` sections
|
|
70
70
|
- Formatted and linted with `ruff` (rules: E, F, I, UP; E501 ignored)
|
|
71
71
|
- No inline comments unless the *why* is non-obvious
|
|
@@ -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
|
|
@@ -33,6 +33,8 @@ The code for the library is [here](https://github.com/OCHA-DAP/hdx-python-utilit
|
|
|
33
33
|
The library has detailed API documentation which can be found in the menu at the top.
|
|
34
34
|
|
|
35
35
|
## Breaking Changes
|
|
36
|
+
From 4.2.5, Python 3.11 or later is required
|
|
37
|
+
|
|
36
38
|
From 4.2.2, Phonetics and the pyphonetics dependency are removed
|
|
37
39
|
|
|
38
40
|
From 4.2.0, get_code_from_name fuzzy matches using RapidFuzzMatcher rather than
|
|
@@ -19,7 +19,6 @@ classifiers = [
|
|
|
19
19
|
"Programming Language :: Python",
|
|
20
20
|
"Programming Language :: Python :: 3",
|
|
21
21
|
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
-
"Programming Language :: Python :: 3.10",
|
|
23
22
|
"Programming Language :: Python :: 3.11",
|
|
24
23
|
"Programming Language :: Python :: 3.12",
|
|
25
24
|
"Programming Language :: Python :: 3.13",
|
|
@@ -34,7 +33,7 @@ classifiers = [
|
|
|
34
33
|
]
|
|
35
34
|
readme = "README.md"
|
|
36
35
|
dynamic = ["version"]
|
|
37
|
-
requires-python = ">=3.
|
|
36
|
+
requires-python = ">=3.11"
|
|
38
37
|
|
|
39
38
|
# Extras for frictionless[excel,json] added explicitly
|
|
40
39
|
# for conda-forge compatibility
|
|
@@ -49,7 +48,6 @@ dependencies = [
|
|
|
49
48
|
"ijson>=3.5.0",
|
|
50
49
|
"jsonlines>=4.0.0",
|
|
51
50
|
# /end frictionless extras
|
|
52
|
-
"typing_extensions",
|
|
53
51
|
"loguru",
|
|
54
52
|
"rapidfuzz",
|
|
55
53
|
"python-dateutil>=2.9.0, <3.1",
|
|
@@ -103,7 +101,7 @@ allow-direct-references = true
|
|
|
103
101
|
# ----------------------------------------------------------------------------
|
|
104
102
|
|
|
105
103
|
[tool.ruff]
|
|
106
|
-
target-version = "
|
|
104
|
+
target-version = "py311"
|
|
107
105
|
src = ["src"]
|
|
108
106
|
exclude = ["_version.py"]
|
|
109
107
|
|
|
@@ -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
|
|
@@ -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)
|
{hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_dateparse.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Date Parse Utility Tests"""
|
|
2
2
|
|
|
3
|
-
from datetime import datetime, timedelta, timezone
|
|
3
|
+
from datetime import UTC, datetime, timedelta, timezone
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
from dateutil.parser import ParserError
|
|
@@ -21,35 +21,35 @@ from hdx.utilities.dateparse import (
|
|
|
21
21
|
|
|
22
22
|
class TestDateParse:
|
|
23
23
|
def test_now_utc(self):
|
|
24
|
-
assert now_utc().replace(second=0, microsecond=0) == datetime.now(
|
|
25
|
-
|
|
26
|
-
)
|
|
24
|
+
assert now_utc().replace(second=0, microsecond=0) == datetime.now(UTC).replace(
|
|
25
|
+
second=0, microsecond=0, tzinfo=UTC
|
|
26
|
+
)
|
|
27
27
|
assert now_utc_notz().replace(second=0, microsecond=0) == datetime.now(
|
|
28
|
-
|
|
28
|
+
UTC
|
|
29
29
|
).replace(second=0, microsecond=0, tzinfo=None)
|
|
30
30
|
|
|
31
31
|
def test_parse_date_range(self):
|
|
32
32
|
result = (
|
|
33
|
-
datetime(2013, 2, 10, 0, 0, tzinfo=
|
|
34
|
-
datetime(2013, 2, 10, 0, 0, tzinfo=
|
|
33
|
+
datetime(2013, 2, 10, 0, 0, tzinfo=UTC),
|
|
34
|
+
datetime(2013, 2, 10, 0, 0, tzinfo=UTC),
|
|
35
35
|
)
|
|
36
36
|
assert parse_date_range("10/02/2013") == result
|
|
37
37
|
assert parse_date_range("2013/02/10") == result
|
|
38
38
|
result = (
|
|
39
|
-
datetime(2013, 2, 20, 10, 0, tzinfo=
|
|
40
|
-
datetime(2013, 2, 20, 10, 0, tzinfo=
|
|
39
|
+
datetime(2013, 2, 20, 10, 0, tzinfo=UTC),
|
|
40
|
+
datetime(2013, 2, 20, 10, 0, tzinfo=UTC),
|
|
41
41
|
)
|
|
42
42
|
assert parse_date_range("20/02/2013 10:00:00") == result
|
|
43
43
|
assert parse_date_range("20/02/2013 10:00:00", "%d/%m/%Y %H:%M:%S") == result
|
|
44
44
|
result = (
|
|
45
|
-
datetime(2013, 2, 20, 0, 0, tzinfo=
|
|
46
|
-
datetime(2013, 2, 20, 0, 0, tzinfo=
|
|
45
|
+
datetime(2013, 2, 20, 0, 0, tzinfo=UTC),
|
|
46
|
+
datetime(2013, 2, 20, 0, 0, tzinfo=UTC),
|
|
47
47
|
)
|
|
48
48
|
assert parse_date_range("20/02/2013") == result
|
|
49
49
|
assert parse_date_range("20/02/2013 10:00:00", zero_time=True) == result
|
|
50
50
|
result2 = (
|
|
51
|
-
datetime(2013, 2, 20, 0, 0, tzinfo=
|
|
52
|
-
datetime(2013, 2, 20, 23, 59, 59, tzinfo=
|
|
51
|
+
datetime(2013, 2, 20, 0, 0, tzinfo=UTC),
|
|
52
|
+
datetime(2013, 2, 20, 23, 59, 59, tzinfo=UTC),
|
|
53
53
|
)
|
|
54
54
|
assert (
|
|
55
55
|
parse_date_range(
|
|
@@ -60,8 +60,8 @@ class TestDateParse:
|
|
|
60
60
|
== result2
|
|
61
61
|
)
|
|
62
62
|
result2 = (
|
|
63
|
-
datetime(2013, 2, 20, 23, 59, 59, 999999, tzinfo=
|
|
64
|
-
datetime(2013, 2, 20, 23, 59, 59, 999999, tzinfo=
|
|
63
|
+
datetime(2013, 2, 20, 23, 59, 59, 999999, tzinfo=UTC),
|
|
64
|
+
datetime(2013, 2, 20, 23, 59, 59, 999999, tzinfo=UTC),
|
|
65
65
|
)
|
|
66
66
|
assert (
|
|
67
67
|
parse_date_range(
|
|
@@ -82,8 +82,8 @@ class TestDateParse:
|
|
|
82
82
|
parse_date_range("date is 20/02/2013 for this test", fuzzy=fuzzy) == result
|
|
83
83
|
)
|
|
84
84
|
fuzzyresult = {
|
|
85
|
-
"startdate": datetime(2013, 2, 20, 0, 0, tzinfo=
|
|
86
|
-
"enddate": datetime(2013, 2, 20, 0, 0, tzinfo=
|
|
85
|
+
"startdate": datetime(2013, 2, 20, 0, 0, tzinfo=UTC),
|
|
86
|
+
"enddate": datetime(2013, 2, 20, 0, 0, tzinfo=UTC),
|
|
87
87
|
"nondate": ("date is ", " for this test"),
|
|
88
88
|
"date": ("20/02/2013",),
|
|
89
89
|
}
|
|
@@ -106,27 +106,27 @@ class TestDateParse:
|
|
|
106
106
|
fuzzyresult["nondate"] = None
|
|
107
107
|
assert fuzzy == fuzzyresult
|
|
108
108
|
result = (
|
|
109
|
-
datetime(2013, 2, 1, 0, 0, tzinfo=
|
|
110
|
-
datetime(2013, 2, 28, 0, 0, tzinfo=
|
|
109
|
+
datetime(2013, 2, 1, 0, 0, tzinfo=UTC),
|
|
110
|
+
datetime(2013, 2, 28, 0, 0, tzinfo=UTC),
|
|
111
111
|
)
|
|
112
112
|
assert parse_date_range("02/2013") == result
|
|
113
113
|
assert parse_date_range("02/2013", "%m/%Y") == result
|
|
114
114
|
fuzzy = {}
|
|
115
115
|
assert parse_date_range("date is 02/2013 for this test", fuzzy=fuzzy) == result
|
|
116
116
|
assert fuzzy == {
|
|
117
|
-
"startdate": datetime(2013, 2, 1, 0, 0, tzinfo=
|
|
118
|
-
"enddate": datetime(2013, 2, 28, 0, 0, tzinfo=
|
|
117
|
+
"startdate": datetime(2013, 2, 1, 0, 0, tzinfo=UTC),
|
|
118
|
+
"enddate": datetime(2013, 2, 28, 0, 0, tzinfo=UTC),
|
|
119
119
|
"nondate": ("date is ", " for this test"),
|
|
120
120
|
"date": ("02/2013",),
|
|
121
121
|
}
|
|
122
122
|
result = (
|
|
123
|
-
datetime(2013, 1, 1, 0, 0, tzinfo=
|
|
124
|
-
datetime(2013, 12, 31, 0, 0, tzinfo=
|
|
123
|
+
datetime(2013, 1, 1, 0, 0, tzinfo=UTC),
|
|
124
|
+
datetime(2013, 12, 31, 0, 0, tzinfo=UTC),
|
|
125
125
|
)
|
|
126
126
|
assert parse_date_range("2013") == result
|
|
127
127
|
assert parse_date_range("2013", "%Y") == result
|
|
128
128
|
fuzzy = {}
|
|
129
|
-
date = datetime(2001, 12, 10, 0, 0, tzinfo=
|
|
129
|
+
date = datetime(2001, 12, 10, 0, 0, tzinfo=UTC)
|
|
130
130
|
result = date, date
|
|
131
131
|
assert (
|
|
132
132
|
parse_date_range(
|
|
@@ -155,14 +155,12 @@ class TestDateParse:
|
|
|
155
155
|
parse_date_range("20/02", "%d/%m")
|
|
156
156
|
|
|
157
157
|
def test_parse_date(self):
|
|
158
|
-
assert parse_date("20/02/2013") == datetime(
|
|
159
|
-
2013, 2, 20, 0, 0, tzinfo=timezone.utc
|
|
160
|
-
)
|
|
158
|
+
assert parse_date("20/02/2013") == datetime(2013, 2, 20, 0, 0, tzinfo=UTC)
|
|
161
159
|
assert parse_date("20/02/2013", "%d/%m/%Y") == datetime(
|
|
162
|
-
2013, 2, 20, 0, 0, tzinfo=
|
|
160
|
+
2013, 2, 20, 0, 0, tzinfo=UTC
|
|
163
161
|
)
|
|
164
162
|
assert parse_date("20/02/2013 01:30:20") == datetime(
|
|
165
|
-
2013, 2, 20, 1, 30, 20, tzinfo=
|
|
163
|
+
2013, 2, 20, 1, 30, 20, tzinfo=UTC
|
|
166
164
|
)
|
|
167
165
|
assert parse_date("20/02/2013 01:30:20 IST") == datetime(
|
|
168
166
|
2013,
|
|
@@ -171,7 +169,7 @@ class TestDateParse:
|
|
|
171
169
|
1,
|
|
172
170
|
30,
|
|
173
171
|
20,
|
|
174
|
-
tzinfo=
|
|
172
|
+
tzinfo=UTC,
|
|
175
173
|
)
|
|
176
174
|
assert parse_date("20/02/2013 01:30:20 IST", timezone_handling=1) == datetime(
|
|
177
175
|
2013,
|
|
@@ -212,7 +210,7 @@ class TestDateParse:
|
|
|
212
210
|
20,
|
|
213
211
|
00,
|
|
214
212
|
20,
|
|
215
|
-
tzinfo=
|
|
213
|
+
tzinfo=UTC,
|
|
216
214
|
)
|
|
217
215
|
assert parse_date("20/02/2013 01:30:20 IST", zero_time=True) == datetime(
|
|
218
216
|
2013,
|
|
@@ -221,7 +219,7 @@ class TestDateParse:
|
|
|
221
219
|
0,
|
|
222
220
|
0,
|
|
223
221
|
0,
|
|
224
|
-
tzinfo=
|
|
222
|
+
tzinfo=UTC,
|
|
225
223
|
)
|
|
226
224
|
assert parse_date("20/02/2013 01:30:20 IST", max_time=True) == datetime(
|
|
227
225
|
2013,
|
|
@@ -230,7 +228,7 @@ class TestDateParse:
|
|
|
230
228
|
23,
|
|
231
229
|
59,
|
|
232
230
|
59,
|
|
233
|
-
tzinfo=
|
|
231
|
+
tzinfo=UTC,
|
|
234
232
|
)
|
|
235
233
|
assert parse_date(
|
|
236
234
|
"20/02/2013 01:30:20 NUT",
|
|
@@ -268,7 +266,7 @@ class TestDateParse:
|
|
|
268
266
|
1,
|
|
269
267
|
30,
|
|
270
268
|
20,
|
|
271
|
-
tzinfo=
|
|
269
|
+
tzinfo=UTC,
|
|
272
270
|
)
|
|
273
271
|
assert parse_date(
|
|
274
272
|
"20/02/2013 01:30:20 IST",
|
|
@@ -281,7 +279,7 @@ class TestDateParse:
|
|
|
281
279
|
1,
|
|
282
280
|
30,
|
|
283
281
|
20,
|
|
284
|
-
tzinfo=
|
|
282
|
+
tzinfo=UTC,
|
|
285
283
|
)
|
|
286
284
|
with pytest.raises(ParserError):
|
|
287
285
|
parse_date("02/2013")
|
|
@@ -290,161 +288,149 @@ class TestDateParse:
|
|
|
290
288
|
|
|
291
289
|
def test_get_datetime_from_timestamp(self):
|
|
292
290
|
expected_timestamp = 1596180834.0
|
|
293
|
-
expected_date = datetime(2020, 7, 31, 7, 33, 54, tzinfo=
|
|
291
|
+
expected_date = datetime(2020, 7, 31, 7, 33, 54, tzinfo=UTC)
|
|
294
292
|
timestamp = get_timestamp_from_datetime(expected_date)
|
|
295
293
|
assert timestamp == expected_timestamp
|
|
296
|
-
date = get_datetime_from_timestamp(expected_timestamp, timezone=
|
|
294
|
+
date = get_datetime_from_timestamp(expected_timestamp, timezone=UTC)
|
|
297
295
|
assert date == expected_date
|
|
298
|
-
date = get_datetime_from_timestamp(
|
|
299
|
-
expected_timestamp * 1000, timezone=timezone.utc
|
|
300
|
-
)
|
|
296
|
+
date = get_datetime_from_timestamp(expected_timestamp * 1000, timezone=UTC)
|
|
301
297
|
assert date == expected_date
|
|
302
298
|
|
|
303
299
|
def test_iso_string_from_datetime(self):
|
|
304
|
-
date = datetime(2020, 7, 31, 7, 33, 54, tzinfo=
|
|
300
|
+
date = datetime(2020, 7, 31, 7, 33, 54, tzinfo=UTC)
|
|
305
301
|
string = iso_string_from_datetime(date)
|
|
306
302
|
assert string == "2020-07-31"
|
|
307
303
|
|
|
308
304
|
def test_get_quarter(self):
|
|
309
|
-
date = datetime(2020, 7, 31, 7, 33, 54, tzinfo=
|
|
305
|
+
date = datetime(2020, 7, 31, 7, 33, 54, tzinfo=UTC)
|
|
310
306
|
assert get_quarter(date) == 3
|
|
311
|
-
assert (
|
|
312
|
-
|
|
313
|
-
)
|
|
314
|
-
assert (
|
|
315
|
-
get_quarter(datetime(year=2020, month=9, day=25, tzinfo=timezone.utc)) == 3
|
|
316
|
-
)
|
|
317
|
-
assert (
|
|
318
|
-
get_quarter(datetime(year=2020, month=12, day=11, tzinfo=timezone.utc)) == 4
|
|
319
|
-
)
|
|
320
|
-
assert (
|
|
321
|
-
get_quarter(datetime(year=2020, month=1, day=2, tzinfo=timezone.utc)) == 1
|
|
322
|
-
)
|
|
307
|
+
assert get_quarter(datetime(year=2021, month=10, day=5, tzinfo=UTC)) == 4
|
|
308
|
+
assert get_quarter(datetime(year=2020, month=9, day=25, tzinfo=UTC)) == 3
|
|
309
|
+
assert get_quarter(datetime(year=2020, month=12, day=11, tzinfo=UTC)) == 4
|
|
310
|
+
assert get_quarter(datetime(year=2020, month=1, day=2, tzinfo=UTC)) == 1
|
|
323
311
|
|
|
324
312
|
def test_get_quarter_start_end(self):
|
|
325
313
|
year = 2022
|
|
326
314
|
quarter = 3
|
|
327
|
-
assert get_quarter_start(year, quarter) == datetime(
|
|
328
|
-
2022, 7, 1, tzinfo=timezone.utc
|
|
329
|
-
)
|
|
315
|
+
assert get_quarter_start(year, quarter) == datetime(2022, 7, 1, tzinfo=UTC)
|
|
330
316
|
assert get_quarter_end(year, quarter) == datetime(
|
|
331
|
-
2022, 9, 30, 23, 59, 59, tzinfo=
|
|
317
|
+
2022, 9, 30, 23, 59, 59, tzinfo=UTC
|
|
332
318
|
)
|
|
333
319
|
assert get_quarter_end(year, quarter, max_time=False) == datetime(
|
|
334
|
-
2022, 9, 30, tzinfo=
|
|
320
|
+
2022, 9, 30, tzinfo=UTC
|
|
335
321
|
)
|
|
336
322
|
assert get_quarter_end(year, quarter, include_microseconds=True) == datetime(
|
|
337
|
-
2022, 9, 30, 23, 59, 59, 999999, tzinfo=
|
|
323
|
+
2022, 9, 30, 23, 59, 59, 999999, tzinfo=UTC
|
|
338
324
|
)
|
|
339
325
|
|
|
340
|
-
date = datetime(2020, 10, 5, tzinfo=
|
|
326
|
+
date = datetime(2020, 10, 5, tzinfo=UTC)
|
|
341
327
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
342
|
-
2020, 10, 1, tzinfo=
|
|
328
|
+
2020, 10, 1, tzinfo=UTC
|
|
343
329
|
)
|
|
344
330
|
assert get_quarter_end(
|
|
345
331
|
date.year, get_quarter(date), max_time=False
|
|
346
|
-
) == datetime(2020, 12, 31, tzinfo=
|
|
332
|
+
) == datetime(2020, 12, 31, tzinfo=UTC)
|
|
347
333
|
|
|
348
|
-
date = datetime(2020, 9, 25, tzinfo=
|
|
334
|
+
date = datetime(2020, 9, 25, tzinfo=UTC)
|
|
349
335
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
350
|
-
2020, 7, 1, tzinfo=
|
|
336
|
+
2020, 7, 1, tzinfo=UTC
|
|
351
337
|
)
|
|
352
338
|
assert get_quarter_end(
|
|
353
339
|
date.year, get_quarter(date), max_time=False
|
|
354
|
-
) == datetime(2020, 9, 30, tzinfo=
|
|
340
|
+
) == datetime(2020, 9, 30, tzinfo=UTC)
|
|
355
341
|
|
|
356
|
-
date = datetime(2020, 7, 1, tzinfo=
|
|
342
|
+
date = datetime(2020, 7, 1, tzinfo=UTC)
|
|
357
343
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
358
|
-
2020, 7, 1, tzinfo=
|
|
344
|
+
2020, 7, 1, tzinfo=UTC
|
|
359
345
|
)
|
|
360
346
|
assert get_quarter_end(
|
|
361
347
|
date.year, get_quarter(date), max_time=False
|
|
362
|
-
) == datetime(2020, 9, 30, tzinfo=
|
|
348
|
+
) == datetime(2020, 9, 30, tzinfo=UTC)
|
|
363
349
|
|
|
364
|
-
date = datetime(2020, 9, 30, tzinfo=
|
|
350
|
+
date = datetime(2020, 9, 30, tzinfo=UTC)
|
|
365
351
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
366
|
-
2020, 7, 1, tzinfo=
|
|
352
|
+
2020, 7, 1, tzinfo=UTC
|
|
367
353
|
)
|
|
368
354
|
assert get_quarter_end(
|
|
369
355
|
date.year, get_quarter(date), max_time=False
|
|
370
|
-
) == datetime(2020, 9, 30, tzinfo=
|
|
356
|
+
) == datetime(2020, 9, 30, tzinfo=UTC)
|
|
371
357
|
|
|
372
|
-
date = datetime(2020, 12, 11, tzinfo=
|
|
358
|
+
date = datetime(2020, 12, 11, tzinfo=UTC)
|
|
373
359
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
374
|
-
2020, 10, 1, tzinfo=
|
|
360
|
+
2020, 10, 1, tzinfo=UTC
|
|
375
361
|
)
|
|
376
362
|
assert get_quarter_end(
|
|
377
363
|
date.year, get_quarter(date), max_time=False
|
|
378
|
-
) == datetime(2020, 12, 31, tzinfo=
|
|
364
|
+
) == datetime(2020, 12, 31, tzinfo=UTC)
|
|
379
365
|
|
|
380
|
-
date = datetime(2020, 10, 1, tzinfo=
|
|
366
|
+
date = datetime(2020, 10, 1, tzinfo=UTC)
|
|
381
367
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
382
|
-
2020, 10, 1, tzinfo=
|
|
368
|
+
2020, 10, 1, tzinfo=UTC
|
|
383
369
|
)
|
|
384
370
|
assert get_quarter_end(
|
|
385
371
|
date.year, get_quarter(date), max_time=False
|
|
386
|
-
) == datetime(2020, 12, 31, tzinfo=
|
|
372
|
+
) == datetime(2020, 12, 31, tzinfo=UTC)
|
|
387
373
|
|
|
388
|
-
date = datetime(2020, 12, 31, tzinfo=
|
|
374
|
+
date = datetime(2020, 12, 31, tzinfo=UTC)
|
|
389
375
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
390
|
-
2020, 10, 1, tzinfo=
|
|
376
|
+
2020, 10, 1, tzinfo=UTC
|
|
391
377
|
)
|
|
392
378
|
assert get_quarter_end(
|
|
393
379
|
date.year, get_quarter(date), max_time=False
|
|
394
|
-
) == datetime(2020, 12, 31, tzinfo=
|
|
380
|
+
) == datetime(2020, 12, 31, tzinfo=UTC)
|
|
395
381
|
|
|
396
|
-
date = datetime(2020, 1, 2, tzinfo=
|
|
382
|
+
date = datetime(2020, 1, 2, tzinfo=UTC)
|
|
397
383
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
398
|
-
2020, 1, 1, tzinfo=
|
|
384
|
+
2020, 1, 1, tzinfo=UTC
|
|
399
385
|
)
|
|
400
386
|
assert get_quarter_end(
|
|
401
387
|
date.year, get_quarter(date), max_time=False
|
|
402
|
-
) == datetime(2020, 3, 31, tzinfo=
|
|
388
|
+
) == datetime(2020, 3, 31, tzinfo=UTC)
|
|
403
389
|
|
|
404
|
-
date = datetime(2020, 1, 1, tzinfo=
|
|
390
|
+
date = datetime(2020, 1, 1, tzinfo=UTC)
|
|
405
391
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
406
|
-
2020, 1, 1, tzinfo=
|
|
392
|
+
2020, 1, 1, tzinfo=UTC
|
|
407
393
|
)
|
|
408
394
|
assert get_quarter_end(
|
|
409
395
|
date.year, get_quarter(date), max_time=False
|
|
410
|
-
) == datetime(2020, 3, 31, tzinfo=
|
|
396
|
+
) == datetime(2020, 3, 31, tzinfo=UTC)
|
|
411
397
|
|
|
412
|
-
date = datetime(2020, 3, 31, tzinfo=
|
|
398
|
+
date = datetime(2020, 3, 31, tzinfo=UTC)
|
|
413
399
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
414
|
-
2020, 1, 1, tzinfo=
|
|
400
|
+
2020, 1, 1, tzinfo=UTC
|
|
415
401
|
)
|
|
416
402
|
assert get_quarter_end(
|
|
417
403
|
date.year, get_quarter(date), max_time=False
|
|
418
|
-
) == datetime(2020, 3, 31, tzinfo=
|
|
404
|
+
) == datetime(2020, 3, 31, tzinfo=UTC)
|
|
419
405
|
|
|
420
|
-
date = datetime(2020, 2, 29, tzinfo=
|
|
406
|
+
date = datetime(2020, 2, 29, tzinfo=UTC)
|
|
421
407
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
422
|
-
2020, 1, 1, tzinfo=
|
|
408
|
+
2020, 1, 1, tzinfo=UTC
|
|
423
409
|
)
|
|
424
410
|
assert get_quarter_end(
|
|
425
411
|
date.year, get_quarter(date), max_time=False
|
|
426
|
-
) == datetime(2020, 3, 31, tzinfo=
|
|
412
|
+
) == datetime(2020, 3, 31, tzinfo=UTC)
|
|
427
413
|
|
|
428
|
-
date = datetime(2020, 5, 6, tzinfo=
|
|
414
|
+
date = datetime(2020, 5, 6, tzinfo=UTC)
|
|
429
415
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
430
|
-
2020, 4, 1, tzinfo=
|
|
416
|
+
2020, 4, 1, tzinfo=UTC
|
|
431
417
|
)
|
|
432
418
|
assert get_quarter_end(
|
|
433
419
|
date.year, get_quarter(date), max_time=False
|
|
434
|
-
) == datetime(2020, 6, 30, tzinfo=
|
|
420
|
+
) == datetime(2020, 6, 30, tzinfo=UTC)
|
|
435
421
|
|
|
436
|
-
date = datetime(2020, 4, 1, tzinfo=
|
|
422
|
+
date = datetime(2020, 4, 1, tzinfo=UTC)
|
|
437
423
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
438
|
-
2020, 4, 1, tzinfo=
|
|
424
|
+
2020, 4, 1, tzinfo=UTC
|
|
439
425
|
)
|
|
440
426
|
assert get_quarter_end(
|
|
441
427
|
date.year, get_quarter(date), max_time=False
|
|
442
|
-
) == datetime(2020, 6, 30, tzinfo=
|
|
428
|
+
) == datetime(2020, 6, 30, tzinfo=UTC)
|
|
443
429
|
|
|
444
|
-
date = datetime(2020, 6, 30, tzinfo=
|
|
430
|
+
date = datetime(2020, 6, 30, tzinfo=UTC)
|
|
445
431
|
assert get_quarter_start(date.year, get_quarter(date)) == datetime(
|
|
446
|
-
2020, 4, 1, tzinfo=
|
|
432
|
+
2020, 4, 1, tzinfo=UTC
|
|
447
433
|
)
|
|
448
434
|
assert get_quarter_end(
|
|
449
435
|
date.year, get_quarter(date), max_time=False
|
|
450
|
-
) == datetime(2020, 6, 30, tzinfo=
|
|
436
|
+
) == datetime(2020, 6, 30, tzinfo=UTC)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""State Utility Tests"""
|
|
2
2
|
|
|
3
|
-
from datetime import
|
|
3
|
+
from datetime import UTC, datetime
|
|
4
4
|
from shutil import copyfile
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
@@ -24,11 +24,11 @@ class TestState:
|
|
|
24
24
|
|
|
25
25
|
@pytest.fixture(scope="class")
|
|
26
26
|
def date1(self):
|
|
27
|
-
return datetime(2020, 9, 23, 0, 0, tzinfo=
|
|
27
|
+
return datetime(2020, 9, 23, 0, 0, tzinfo=UTC)
|
|
28
28
|
|
|
29
29
|
@pytest.fixture(scope="class")
|
|
30
30
|
def date2(self):
|
|
31
|
-
return datetime(2022, 5, 12, 10, 15, tzinfo=
|
|
31
|
+
return datetime(2022, 5, 12, 10, 15, tzinfo=UTC)
|
|
32
32
|
|
|
33
33
|
def test_state(self, tmp_path, statefolder, statefile, date1, date2):
|
|
34
34
|
statepath = tmp_path / statefile
|