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.
Files changed (139) hide show
  1. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/CLAUDE.md +1 -1
  2. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/PKG-INFO +2 -4
  3. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/documentation/index.md +2 -0
  4. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/pyproject.toml +2 -4
  5. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/_version.py +2 -2
  6. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/base_downloader.py +1 -3
  7. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/dateparse.py +19 -19
  8. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_dateparse.py +88 -102
  9. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_state.py +3 -3
  10. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/uv.lock +31 -704
  11. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.github/workflows/publish-test.yaml +0 -0
  12. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.github/workflows/publish.yaml +0 -0
  13. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.github/workflows/run-python-tests.yaml +0 -0
  14. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.gitignore +0 -0
  15. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/.pre-commit-config.yaml +0 -0
  16. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/LICENSE +0 -0
  17. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/README.md +0 -0
  18. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/documentation/.readthedocs.yaml +0 -0
  19. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/documentation/mkdocs.yaml +0 -0
  20. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/__init__.py +0 -0
  21. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/compare.py +0 -0
  22. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/dictandlist.py +0 -0
  23. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/downloader.py +0 -0
  24. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/easy_logging.py +0 -0
  25. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/email.py +0 -0
  26. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/encoding.py +0 -0
  27. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/error_handler.py +0 -0
  28. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/errors_onexit.py +0 -0
  29. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/file_hashing.py +0 -0
  30. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/frictionless_wrapper.py +0 -0
  31. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/html.py +0 -0
  32. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/loader.py +0 -0
  33. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/matching.py +0 -0
  34. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/path.py +0 -0
  35. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/retriever.py +0 -0
  36. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/saver.py +0 -0
  37. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/session.py +0 -0
  38. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/state.py +0 -0
  39. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/text.py +0 -0
  40. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/url.py +0 -0
  41. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/useragent.py +0 -0
  42. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/uuid.py +0 -0
  43. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/src/hdx/utilities/zip_crc.py +0 -0
  44. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/compare/test_csv_processing.csv +0 -0
  45. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/compare/test_csv_processing2.csv +0 -0
  46. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/empty.yaml +0 -0
  47. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_config.json +0 -0
  48. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_config.yaml +0 -0
  49. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_email_configuration.json +0 -0
  50. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
  51. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/logging_config.json +0 -0
  52. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/logging_config.yaml +0 -0
  53. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/project_configuration.json +0 -0
  54. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/project_configuration.yaml +0 -0
  55. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/smtp_config.json +0 -0
  56. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/smtp_config.yaml +0 -0
  57. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config.yaml +0 -0
  58. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config2.yaml +0 -0
  59. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config3.yaml +0 -0
  60. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
  61. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/basicauth.txt +0 -0
  62. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/bearertoken.txt +0 -0
  63. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/extra_params.json +0 -0
  64. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/extra_params.yaml +0 -0
  65. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/extra_params_tree.yaml +0 -0
  66. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/resume_test.dat +0 -0
  67. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_csv_processing.csv +0 -0
  68. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_csv_processing_blanks.csv +0 -0
  69. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data.csv +0 -0
  70. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data.xlsx +0 -0
  71. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data1.csv/empty.txt +0 -0
  72. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_data2.csv +0 -0
  73. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_json_processing.json +0 -0
  74. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_xls_processing.xls +0 -0
  75. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/downloader/test_xlsx_processing.xlsx +0 -0
  76. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/bad_header.zip +0 -0
  77. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/bad_index.xlsx +0 -0
  78. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/empty.zip +0 -0
  79. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/test.xlsx +0 -0
  80. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/test_shapefile.zip +0 -0
  81. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/file_hashing/valid_sig_invalid_body.zip +0 -0
  82. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/html/response.html +0 -0
  83. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/loader/empty.json +0 -0
  84. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/loader/empty.yaml +0 -0
  85. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/loader/empty_list.json +0 -0
  86. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/matching/wfp_admin_matcher_calls.json +0 -0
  87. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.csv +0 -0
  88. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.json +0 -0
  89. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.txt +0 -0
  90. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/fallbacks/test.yaml +0 -0
  91. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/retriever-test.csv +0 -0
  92. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.csv +0 -0
  93. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.json +0 -0
  94. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.txt +0 -0
  95. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/retriever/test.yaml +0 -0
  96. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out.csv +0 -0
  97. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out.json +0 -0
  98. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out2.csv +0 -0
  99. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out2.json +0 -0
  100. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out5.json +0 -0
  101. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out6.json +0 -0
  102. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out7.json +0 -0
  103. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out8.csv +0 -0
  104. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/out8.json +0 -0
  105. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-false.json +0 -0
  106. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-false.yaml +0 -0
  107. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-true.json +0 -0
  108. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-false_sortkeys-true.yaml +0 -0
  109. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-false.json +0 -0
  110. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-false.yaml +0 -0
  111. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-true.json +0 -0
  112. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/saver/pretty-true_sortkeys-true.yaml +0 -0
  113. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/state/analysis_dates.txt +0 -0
  114. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/state/last_build_date.txt +0 -0
  115. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/test_data.csv +0 -0
  116. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/text/text1.txt +0 -0
  117. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/fixtures/text/text2.txt +0 -0
  118. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/conftest.py +0 -0
  119. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_compare.py +0 -0
  120. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_dictandlist.py +0 -0
  121. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_downloader.py +0 -0
  122. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_easy_logging.py +0 -0
  123. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_email.py +0 -0
  124. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_encoding.py +0 -0
  125. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_error_handler.py +0 -0
  126. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_file_hashing.py +0 -0
  127. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_html.py +0 -0
  128. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_loader.py +0 -0
  129. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_matching.py +0 -0
  130. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_matching_wfp_admin.py +0 -0
  131. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_path.py +0 -0
  132. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_retriever.py +0 -0
  133. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_saver.py +0 -0
  134. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_text.py +0 -0
  135. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_url.py +0 -0
  136. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_useragent.py +0 -0
  137. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_uuid.py +0 -0
  138. {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.5}/tests/hdx/utilities/test_zip_crc.py +0 -0
  139. {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.10; type hints throughout using `X | Y` union syntax (PEP 604)
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.4
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.10
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.10"
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 = "py310"
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.4'
22
- __version_tuple__ = version_tuple = (4, 2, 4)
21
+ __version__ = version = '4.2.5'
22
+ __version_tuple__ = version_tuple = (4, 2, 5)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -1,9 +1,7 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from collections.abc import Iterator, Sequence
3
3
  from pathlib import Path
4
- from typing import Any
5
-
6
- from typing_extensions import Self
4
+ from typing import Any, Self
7
5
 
8
6
 
9
7
  class DownloadError(Exception):
@@ -3,7 +3,7 @@
3
3
  import re
4
4
  import time
5
5
  from calendar import monthrange
6
- from datetime import datetime, timedelta, timezone
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=timezone.utc,
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=timezone.utc,
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(timezone.utc)
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(timezone.utc).replace(tzinfo=None)
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=timezone.utc)
963
- enddate = enddate.replace(tzinfo=timezone.utc)
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=timezone.utc)
966
+ startdate = startdate.replace(tzinfo=UTC)
967
967
  if enddate.tzinfo is None:
968
- enddate = enddate.replace(tzinfo=timezone.utc)
968
+ enddate = enddate.replace(tzinfo=UTC)
969
969
  elif timezone_handling == 4:
970
- startdate = startdate.astimezone(timezone.utc)
971
- enddate = enddate.astimezone(timezone.utc)
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=timezone.utc)
974
+ startdate = startdate.replace(tzinfo=UTC)
975
975
  else:
976
- startdate = startdate.astimezone(timezone.utc)
976
+ startdate = startdate.astimezone(UTC)
977
977
  if enddate.tzinfo is None:
978
- enddate = enddate.replace(tzinfo=timezone.utc)
978
+ enddate = enddate.replace(tzinfo=UTC)
979
979
  else:
980
- enddate = enddate.astimezone(timezone.utc)
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=timezone.utc)).total_seconds()
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 = timezone.utc,
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=timezone.utc)
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=timezone.utc
1186
+ year, month, 1, hours, minutes, seconds, microseconds, tzinfo=UTC
1187
1187
  ) + timedelta(days=-1)
@@ -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
- timezone.utc
26
- ).replace(second=0, microsecond=0, tzinfo=timezone.utc)
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
- timezone.utc
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=timezone.utc),
34
- datetime(2013, 2, 10, 0, 0, tzinfo=timezone.utc),
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=timezone.utc),
40
- datetime(2013, 2, 20, 10, 0, tzinfo=timezone.utc),
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=timezone.utc),
46
- datetime(2013, 2, 20, 0, 0, tzinfo=timezone.utc),
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=timezone.utc),
52
- datetime(2013, 2, 20, 23, 59, 59, tzinfo=timezone.utc),
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=timezone.utc),
64
- datetime(2013, 2, 20, 23, 59, 59, 999999, tzinfo=timezone.utc),
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=timezone.utc),
86
- "enddate": datetime(2013, 2, 20, 0, 0, tzinfo=timezone.utc),
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=timezone.utc),
110
- datetime(2013, 2, 28, 0, 0, tzinfo=timezone.utc),
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=timezone.utc),
118
- "enddate": datetime(2013, 2, 28, 0, 0, tzinfo=timezone.utc),
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=timezone.utc),
124
- datetime(2013, 12, 31, 0, 0, tzinfo=timezone.utc),
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=timezone.utc)
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=timezone.utc
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=timezone.utc
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=timezone.utc,
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=timezone.utc,
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=timezone.utc,
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=timezone.utc,
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=timezone.utc,
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=timezone.utc,
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=timezone.utc)
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=timezone.utc)
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=timezone.utc)
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=timezone.utc)
305
+ date = datetime(2020, 7, 31, 7, 33, 54, tzinfo=UTC)
310
306
  assert get_quarter(date) == 3
311
- assert (
312
- get_quarter(datetime(year=2021, month=10, day=5, tzinfo=timezone.utc)) == 4
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=timezone.utc
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=timezone.utc
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=timezone.utc
323
+ 2022, 9, 30, 23, 59, 59, 999999, tzinfo=UTC
338
324
  )
339
325
 
340
- date = datetime(2020, 10, 5, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
332
+ ) == datetime(2020, 12, 31, tzinfo=UTC)
347
333
 
348
- date = datetime(2020, 9, 25, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
340
+ ) == datetime(2020, 9, 30, tzinfo=UTC)
355
341
 
356
- date = datetime(2020, 7, 1, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
348
+ ) == datetime(2020, 9, 30, tzinfo=UTC)
363
349
 
364
- date = datetime(2020, 9, 30, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
356
+ ) == datetime(2020, 9, 30, tzinfo=UTC)
371
357
 
372
- date = datetime(2020, 12, 11, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
364
+ ) == datetime(2020, 12, 31, tzinfo=UTC)
379
365
 
380
- date = datetime(2020, 10, 1, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
372
+ ) == datetime(2020, 12, 31, tzinfo=UTC)
387
373
 
388
- date = datetime(2020, 12, 31, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
380
+ ) == datetime(2020, 12, 31, tzinfo=UTC)
395
381
 
396
- date = datetime(2020, 1, 2, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
388
+ ) == datetime(2020, 3, 31, tzinfo=UTC)
403
389
 
404
- date = datetime(2020, 1, 1, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
396
+ ) == datetime(2020, 3, 31, tzinfo=UTC)
411
397
 
412
- date = datetime(2020, 3, 31, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
404
+ ) == datetime(2020, 3, 31, tzinfo=UTC)
419
405
 
420
- date = datetime(2020, 2, 29, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
412
+ ) == datetime(2020, 3, 31, tzinfo=UTC)
427
413
 
428
- date = datetime(2020, 5, 6, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
420
+ ) == datetime(2020, 6, 30, tzinfo=UTC)
435
421
 
436
- date = datetime(2020, 4, 1, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
428
+ ) == datetime(2020, 6, 30, tzinfo=UTC)
443
429
 
444
- date = datetime(2020, 6, 30, tzinfo=timezone.utc)
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=timezone.utc
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=timezone.utc)
436
+ ) == datetime(2020, 6, 30, tzinfo=UTC)
@@ -1,6 +1,6 @@
1
1
  """State Utility Tests"""
2
2
 
3
- from datetime import datetime, timezone
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=timezone.utc)
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=timezone.utc)
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