hdx-python-utilities 4.2.5__tar.gz → 4.2.7__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 (142) hide show
  1. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/.github/workflows/publish-test.yaml +2 -2
  2. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/.github/workflows/publish.yaml +2 -2
  3. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/.github/workflows/run-python-tests.yaml +4 -4
  4. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/.pre-commit-config.yaml +2 -2
  5. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/PKG-INFO +1 -1
  6. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/documentation/index.md +1 -0
  7. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/pyproject.toml +2 -2
  8. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/__init__.py +0 -0
  9. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/_version.py +2 -2
  10. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/base_downloader.py +7 -1
  11. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/compare.py +2 -2
  12. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/dateparse.py +6 -4
  13. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/dictandlist.py +1 -1
  14. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/downloader.py +24 -11
  15. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/easy_logging.py +0 -0
  16. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/email.py +3 -3
  17. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/encoding.py +0 -0
  18. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/error_handler.py +12 -6
  19. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/file_hashing.py +1 -1
  20. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/frictionless_wrapper.py +19 -1
  21. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/html.py +0 -0
  22. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/loader.py +0 -0
  23. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/matching.py +2 -2
  24. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/path.py +11 -13
  25. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/retriever.py +8 -8
  26. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/session.py +0 -0
  27. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/state.py +9 -3
  28. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/text.py +1 -1
  29. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/useragent.py +0 -0
  30. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/uuid.py +1 -1
  31. hdx_python_utilities-4.2.7/tests/fixtures/downloader/test_csv_processing_newlines.csv +4 -0
  32. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/conftest.py +0 -0
  33. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_compare.py +0 -0
  34. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_dateparse.py +1 -1
  35. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_dictandlist.py +0 -0
  36. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_downloader.py +49 -12
  37. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_easy_logging.py +0 -0
  38. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_email.py +14 -11
  39. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_encoding.py +0 -0
  40. hdx_python_utilities-4.2.7/tests/hdx/utilities/test_error_handler.py +53 -0
  41. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_file_hashing.py +3 -1
  42. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_html.py +0 -0
  43. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_loader.py +8 -6
  44. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_path.py +11 -11
  45. hdx_python_utilities-4.2.7/tests/hdx/utilities/test_retriever.py +504 -0
  46. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_saver.py +4 -2
  47. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_state.py +0 -0
  48. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_text.py +3 -1
  49. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_useragent.py +0 -0
  50. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_uuid.py +0 -0
  51. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_zip_crc.py +4 -2
  52. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/uv.lock +230 -207
  53. hdx_python_utilities-4.2.5/tests/hdx/utilities/test_error_handler.py +0 -54
  54. hdx_python_utilities-4.2.5/tests/hdx/utilities/test_retriever.py +0 -495
  55. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/.gitignore +0 -0
  56. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/CLAUDE.md +0 -0
  57. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/LICENSE +0 -0
  58. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/README.md +0 -0
  59. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/documentation/.readthedocs.yaml +0 -0
  60. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/documentation/mkdocs.yaml +0 -0
  61. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/errors_onexit.py +0 -0
  62. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/saver.py +0 -0
  63. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/url.py +0 -0
  64. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/src/hdx/utilities/zip_crc.py +0 -0
  65. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/compare/test_csv_processing.csv +0 -0
  66. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/compare/test_csv_processing2.csv +0 -0
  67. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/empty.yaml +0 -0
  68. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/hdx_config.json +0 -0
  69. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/hdx_config.yaml +0 -0
  70. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/hdx_email_configuration.json +0 -0
  71. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
  72. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/logging_config.json +0 -0
  73. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/logging_config.yaml +0 -0
  74. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/project_configuration.json +0 -0
  75. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/project_configuration.yaml +0 -0
  76. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/smtp_config.json +0 -0
  77. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/smtp_config.yaml +0 -0
  78. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/user_agent_config.yaml +0 -0
  79. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/user_agent_config2.yaml +0 -0
  80. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/user_agent_config3.yaml +0 -0
  81. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
  82. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/basicauth.txt +0 -0
  83. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/bearertoken.txt +0 -0
  84. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/extra_params.json +0 -0
  85. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/extra_params.yaml +0 -0
  86. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/extra_params_tree.yaml +0 -0
  87. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/resume_test.dat +0 -0
  88. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_csv_processing.csv +0 -0
  89. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_csv_processing_blanks.csv +0 -0
  90. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_data.csv +0 -0
  91. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_data.xlsx +0 -0
  92. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_data1.csv/empty.txt +0 -0
  93. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_data2.csv +0 -0
  94. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_json_processing.json +0 -0
  95. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_xls_processing.xls +0 -0
  96. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/downloader/test_xlsx_processing.xlsx +0 -0
  97. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/file_hashing/bad_header.zip +0 -0
  98. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/file_hashing/bad_index.xlsx +0 -0
  99. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/file_hashing/empty.zip +0 -0
  100. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/file_hashing/test.xlsx +0 -0
  101. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/file_hashing/test_shapefile.zip +0 -0
  102. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/file_hashing/valid_sig_invalid_body.zip +0 -0
  103. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/html/response.html +0 -0
  104. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/loader/empty.json +0 -0
  105. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/loader/empty.yaml +0 -0
  106. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/loader/empty_list.json +0 -0
  107. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/matching/wfp_admin_matcher_calls.json +0 -0
  108. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/fallbacks/test.csv +0 -0
  109. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/fallbacks/test.json +0 -0
  110. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/fallbacks/test.txt +0 -0
  111. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/fallbacks/test.yaml +0 -0
  112. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/retriever-test.csv +0 -0
  113. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/test.csv +0 -0
  114. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/test.json +0 -0
  115. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/test.txt +0 -0
  116. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/retriever/test.yaml +0 -0
  117. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out.csv +0 -0
  118. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out.json +0 -0
  119. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out2.csv +0 -0
  120. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out2.json +0 -0
  121. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out5.json +0 -0
  122. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out6.json +0 -0
  123. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out7.json +0 -0
  124. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out8.csv +0 -0
  125. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/out8.json +0 -0
  126. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-false_sortkeys-false.json +0 -0
  127. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-false_sortkeys-false.yaml +0 -0
  128. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-false_sortkeys-true.json +0 -0
  129. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-false_sortkeys-true.yaml +0 -0
  130. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-true_sortkeys-false.json +0 -0
  131. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-true_sortkeys-false.yaml +0 -0
  132. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-true_sortkeys-true.json +0 -0
  133. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/saver/pretty-true_sortkeys-true.yaml +0 -0
  134. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/state/analysis_dates.txt +0 -0
  135. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/state/last_build_date.txt +0 -0
  136. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/test_data.csv +0 -0
  137. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/text/text1.txt +0 -0
  138. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/fixtures/text/text2.txt +0 -0
  139. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_matching.py +0 -0
  140. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_matching_wfp_admin.py +0 -0
  141. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/test_url.py +0 -0
  142. {hdx_python_utilities-4.2.5 → hdx_python_utilities-4.2.7}/tests/hdx/utilities/utils.py +0 -0
@@ -16,7 +16,7 @@ jobs:
16
16
  contents: read
17
17
 
18
18
  steps:
19
- - uses: actions/checkout@v6
19
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20
20
 
21
21
  - name: Get history and tags for versioning to work
22
22
  run: |
@@ -24,7 +24,7 @@ jobs:
24
24
  git fetch --depth=1 origin +refs/tags/*:refs/tags/*
25
25
 
26
26
  - name: Install uv
27
- uses: astral-sh/setup-uv@v7
27
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
28
28
 
29
29
  - name: Build with uv
30
30
  run: uv build
@@ -17,7 +17,7 @@ jobs:
17
17
  contents: read
18
18
 
19
19
  steps:
20
- - uses: actions/checkout@v6
20
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
21
21
 
22
22
  - name: Get history and tags for versioning to work
23
23
  run: |
@@ -25,7 +25,7 @@ jobs:
25
25
  git fetch --depth=1 origin +refs/tags/*:refs/tags/*
26
26
 
27
27
  - name: Install uv
28
- uses: astral-sh/setup-uv@v7
28
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
29
29
 
30
30
  - name: Build with uv
31
31
  run: uv build
@@ -16,10 +16,10 @@ jobs:
16
16
  pull-requests: write
17
17
 
18
18
  steps:
19
- - uses: actions/checkout@v6
19
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20
20
 
21
21
  - name: Install uv
22
- uses: astral-sh/setup-uv@v7
22
+ uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
23
23
  with:
24
24
  enable-cache: true
25
25
  python-version: "3.13"
@@ -36,13 +36,13 @@ jobs:
36
36
  run: uv run --extra html --extra diff --extra email pytest
37
37
 
38
38
  - name: Publish Unit Test Results
39
- uses: EnricoMi/publish-unit-test-result-action@v2
39
+ uses: EnricoMi/publish-unit-test-result-action@7622c5bf3d112a72ab4fa3951c2aa5723d8ab92d # v2.25.0
40
40
  if: always()
41
41
  with:
42
42
  files: test-results.xml
43
43
 
44
44
  - name: Publish in Coveralls
45
- uses: coverallsapp/github-action@v2
45
+ uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
46
46
  if: always()
47
47
  with:
48
48
  flag-name: tests
@@ -12,7 +12,7 @@ repos:
12
12
  - id: check-ast
13
13
 
14
14
  - repo: https://github.com/astral-sh/ruff-pre-commit
15
- rev: v0.14.13
15
+ rev: v0.17.3
16
16
  hooks:
17
17
  # Run the linter.
18
18
  - id: ruff-check
@@ -21,7 +21,7 @@ repos:
21
21
  - id: ruff-format
22
22
 
23
23
  - repo: https://github.com/astral-sh/uv-pre-commit
24
- rev: 0.9.25
24
+ rev: 0.13.6
25
25
  hooks:
26
26
  # Ensure the lockfile is up-to-date with pyproject.toml
27
27
  - id: uv-lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hdx-python-utilities
3
- Version: 4.2.5
3
+ Version: 4.2.7
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>
@@ -855,6 +855,7 @@ Examples:
855
855
 
856
856
  # Remove whitespace and punctuation from end of string
857
857
  assert remove_end_characters('lalala,.,"') == "lalala"
858
+ assert remove_end_characters("") == ""
858
859
  assert remove_end_characters('lalala, .\t/,"', f"{punctuation}{whitespace}" == "lalala"
859
860
 
860
861
  # Remove list of items from end of string, stripping any whitespace
@@ -70,7 +70,7 @@ dev = [
70
70
  "pytest-loguru",
71
71
  "pytest-mock",
72
72
  "pre-commit",
73
- "ruff==0.14.13",
73
+ "ruff==0.17.3",
74
74
  ]
75
75
 
76
76
  [project.urls]
@@ -106,7 +106,7 @@ src = ["src"]
106
106
  exclude = ["_version.py"]
107
107
 
108
108
  [tool.ruff.lint]
109
- # Defaults are E (pycodestyle) and F (pyflakes). We extend them:
109
+ # Ruff's defaults plus isort and pyupgrade
110
110
  extend-select = [
111
111
  "I", # isort
112
112
  "UP", # pyupgrade
@@ -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.5'
22
- __version_tuple__ = version_tuple = (4, 2, 5)
21
+ __version__ = version = '4.2.7'
22
+ __version_tuple__ = version_tuple = (4, 2, 7)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -1,6 +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 types import TracebackType
4
5
  from typing import Any, Self
5
6
 
6
7
 
@@ -20,7 +21,12 @@ class BaseDownload(ABC):
20
21
  """
21
22
  return self
22
23
 
23
- def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
24
+ def __exit__(
25
+ self,
26
+ exc_type: type[BaseException] | None,
27
+ exc_value: BaseException | None,
28
+ traceback: TracebackType | None,
29
+ ) -> None:
24
30
  """Subclasses should define this to allow with usage.
25
31
 
26
32
  Args:
@@ -23,8 +23,8 @@ def compare_files(
23
23
  Delta between the two files
24
24
  """
25
25
  diff = ndiff(
26
- open(path1, encoding=encoding).read().splitlines(),
27
- open(path2, encoding=encoding).read().splitlines(),
26
+ Path(path1).read_text(encoding=encoding).splitlines(),
27
+ Path(path2).read_text(encoding=encoding).splitlines(),
28
28
  )
29
29
  return [x for x in diff if x[0] in ["-", "+", "?"]]
30
30
 
@@ -517,7 +517,7 @@ class DateParser(dateutil.parser.parser): # pragma: no cover
517
517
  yearfirst = info.yearfirst
518
518
 
519
519
  res = self._result()
520
- l = _timelex.split(timestr) # noqa: E741
520
+ l = _timelex.split(timestr)
521
521
 
522
522
  skipped_idxs = []
523
523
 
@@ -944,7 +944,7 @@ def parse_date_range(
944
944
  endday -= 1
945
945
  if endday == 0:
946
946
  raise ParserError(
947
- f"No end day of month found for {str(enddate)}!"
947
+ f"No end day of month found for {enddate!s}!"
948
948
  ) from e
949
949
  if not any(str in date_format for str in ["%b", "%B", "%m", "%j"]):
950
950
  startdate = startdate.replace(month=default_date.month)
@@ -1098,18 +1098,20 @@ def get_timestamp_from_datetime(date: datetime) -> float:
1098
1098
  def get_datetime_from_timestamp(
1099
1099
  timestamp: float,
1100
1100
  timezone: datetime.tzinfo = UTC,
1101
- today: datetime = now_utc(),
1101
+ today: datetime | None = None,
1102
1102
  ) -> datetime:
1103
1103
  """Convert timestamp to datetime.
1104
1104
 
1105
1105
  Args:
1106
1106
  timestamp: Timestamp to convert
1107
1107
  timezone: Timezone to use
1108
- today: Today's date. Defaults to now_utc.
1108
+ today: Today's date. Defaults to now_utc().
1109
1109
 
1110
1110
  Returns:
1111
1111
  Date of timestamp
1112
1112
  """
1113
+ if today is None:
1114
+ today = now_utc()
1113
1115
  if timestamp > get_timestamp_from_datetime(today):
1114
1116
  timestamp = timestamp / 1000
1115
1117
  return datetime.fromtimestamp(timestamp, tz=timezone)
@@ -220,7 +220,7 @@ def list_distribute_contents(
220
220
  def riffle_shuffle(piles_list):
221
221
  def grouper(n, iterable, fillvalue=None):
222
222
  args = [iter(iterable)] * n
223
- return itertools.zip_longest(fillvalue=fillvalue, *args)
223
+ return itertools.zip_longest(*args, fillvalue=fillvalue)
224
224
 
225
225
  if not piles_list:
226
226
  return []
@@ -3,10 +3,12 @@
3
3
  import hashlib
4
4
  import logging
5
5
  from collections.abc import Callable, Iterator, Sequence
6
+ from contextlib import suppress
6
7
  from copy import deepcopy
7
8
  from os.path import exists, isfile
8
9
  from pathlib import Path
9
- from typing import Any
10
+ from types import TracebackType
11
+ from typing import Any, ClassVar
10
12
  from urllib.parse import urlsplit, urlunsplit
11
13
 
12
14
  import requests
@@ -59,7 +61,7 @@ class Download(BaseDownload):
59
61
  allowed_methods (iterable): HTTP methods for which to force retry. Defaults t0 frozenset(['GET']).
60
62
  """
61
63
 
62
- downloaders = {}
64
+ downloaders: ClassVar[dict[str, "Download"]] = {}
63
65
 
64
66
  def __init__(
65
67
  self,
@@ -102,10 +104,8 @@ class Download(BaseDownload):
102
104
  None
103
105
  """
104
106
  if self.response:
105
- try:
107
+ with suppress(Exception):
106
108
  self.response.close()
107
- except Exception:
108
- pass
109
109
 
110
110
  def close(self) -> None:
111
111
  """Close response and session.
@@ -116,7 +116,12 @@ class Download(BaseDownload):
116
116
  self.close_response()
117
117
  self.session.close()
118
118
 
119
- def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
119
+ def __exit__(
120
+ self,
121
+ exc_type: type[BaseException] | None,
122
+ exc_value: BaseException | None,
123
+ traceback: TracebackType | None,
124
+ ) -> None:
120
125
  """Allow usage of with.
121
126
 
122
127
  Args:
@@ -245,10 +250,10 @@ class Download(BaseDownload):
245
250
  if chunk: # filter out keep-alive new chunks
246
251
  md5hash.update(chunk)
247
252
  return md5hash.hexdigest()
248
- except Exception:
253
+ except Exception as e:
249
254
  raise DownloadError(
250
- f"Download of {url} failed in retrieval of stream!" % url
251
- )
255
+ f"Download of {url} failed in retrieval of stream!"
256
+ ) from e
252
257
 
253
258
  def stream_path(
254
259
  self, path: Path | str, errormsg: str, append: bool = False
@@ -587,6 +592,7 @@ class Download(BaseDownload):
587
592
  default_type (str | None): Default field type if infer_types False. Defaults to string.
588
593
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
589
594
  null_values (list[Any]): Values that will return None. Defaults to [""].
595
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
590
596
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
591
597
  detector (Detector): This can be set to override the above. See Frictionless docs.
592
598
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -655,6 +661,7 @@ class Download(BaseDownload):
655
661
  default_type (str | None): Default field type if infer_types False. Defaults to string.
656
662
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
657
663
  null_values (list[Any]): Values that will return None. Defaults to [""].
664
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
658
665
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
659
666
  detector (Detector): This can be set to override the above. See Frictionless docs.
660
667
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -766,6 +773,7 @@ class Download(BaseDownload):
766
773
  default_type (str | None): Default field type if infer_types False. Defaults to string.
767
774
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
768
775
  null_values (list[Any]): Values that will return None. Defaults to [""].
776
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
769
777
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
770
778
  detector (Detector): This can be set to override the above. See Frictionless docs.
771
779
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -863,6 +871,7 @@ class Download(BaseDownload):
863
871
  default_type (str | None): Default field type if infer_types False. Defaults to string.
864
872
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
865
873
  null_values (list[Any]): Values that will return None. Defaults to [""].
874
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
866
875
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
867
876
  detector (Detector): This can be set to override the above. See Frictionless docs.
868
877
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -932,6 +941,7 @@ class Download(BaseDownload):
932
941
  default_type (str | None): Default field type if infer_types False. Defaults to string.
933
942
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
934
943
  null_values (list[Any]): Values that will return None. Defaults to [""].
944
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
935
945
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
936
946
  detector (Detector): This can be set to override the above. See Frictionless docs.
937
947
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -1003,6 +1013,7 @@ class Download(BaseDownload):
1003
1013
  default_type (str | None): Default field type if infer_types False. Defaults to string.
1004
1014
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
1005
1015
  null_values (list[Any]): Values that will return None. Defaults to [""].
1016
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
1006
1017
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
1007
1018
  detector (Detector): This can be set to override the above. See Frictionless docs.
1008
1019
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -1078,6 +1089,7 @@ class Download(BaseDownload):
1078
1089
  default_type (str | None): Default field type if infer_types False. Defaults to string.
1079
1090
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
1080
1091
  null_values (list[Any]): Values that will return None. Defaults to [""].
1092
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
1081
1093
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
1082
1094
  detector (Detector): This can be set to override the above. See Frictionless docs.
1083
1095
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -1157,6 +1169,7 @@ class Download(BaseDownload):
1157
1169
  default_type (str | None): Default field type if infer_types False. Defaults to string.
1158
1170
  float_numbers (bool): Use float not Decimal if infer_types True. Defaults to True.
1159
1171
  null_values (list[Any]): Values that will return None. Defaults to [""].
1172
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
1160
1173
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
1161
1174
  detector (Detector): This can be set to override the above. See Frictionless docs.
1162
1175
  layout (Layout): This can be set to override the above. See Frictionless docs.
@@ -1257,9 +1270,9 @@ class Download(BaseDownload):
1257
1270
  kwargs["rate_limit"] = rate_limit
1258
1271
 
1259
1272
  cls.downloaders = {"default": cls(**kwargs)}
1260
- for name in custom_configs:
1273
+ for name, custom_config in custom_configs.items():
1261
1274
  args_copy = deepcopy(kwargs)
1262
- args_copy.update(custom_configs[name])
1275
+ args_copy.update(custom_config)
1263
1276
  cls.downloaders[name] = cls(**args_copy)
1264
1277
 
1265
1278
  @classmethod
@@ -7,7 +7,7 @@ from email.mime.multipart import MIMEMultipart
7
7
  from email.mime.text import MIMEText
8
8
  from os.path import expanduser
9
9
  from pathlib import Path
10
- from typing import Any
10
+ from typing import Any, Self
11
11
 
12
12
  from hdx.utilities.loader import load_json, load_yaml
13
13
 
@@ -91,7 +91,7 @@ class Email:
91
91
  self.sender = email_config_dict.get("sender", self.username)
92
92
  self.server = None
93
93
 
94
- def __enter__(self) -> "Email":
94
+ def __enter__(self) -> Self:
95
95
  """Return Email object for with statement.
96
96
 
97
97
  Returns:
@@ -99,7 +99,7 @@ class Email:
99
99
  """
100
100
  return self
101
101
 
102
- def __exit__(self, *args: Any) -> None:
102
+ def __exit__(self, *args: object) -> None:
103
103
  """Close Email object for end of with statement.
104
104
 
105
105
  Args:
@@ -3,7 +3,8 @@
3
3
  import logging
4
4
  import sys
5
5
  from collections.abc import Sequence
6
- from typing import Any
6
+ from types import TracebackType
7
+ from typing import Any, Self
7
8
 
8
9
  from hdx.utilities.dictandlist import dict_of_sets_add
9
10
 
@@ -67,7 +68,7 @@ class ErrorHandler:
67
68
  Returns:
68
69
  A formatted message stating the missing value and its type
69
70
  """
70
- return f"{value_type} {str(value)} not found"
71
+ return f"{value_type} {value!s} not found"
71
72
 
72
73
  def add_missing_value(
73
74
  self,
@@ -155,11 +156,11 @@ class ErrorHandler:
155
156
  None
156
157
  """
157
158
 
158
- for _, warnings in self.shared_errors["warning"].items():
159
+ for warnings in self.shared_errors["warning"].values():
159
160
  warnings = sorted(warnings)
160
161
  for warning in warnings:
161
162
  logger.warning(warning)
162
- for _, errors in self.shared_errors["error"].items():
163
+ for errors in self.shared_errors["error"].values():
163
164
  errors = sorted(errors)
164
165
  for error in errors:
165
166
  logger.error(error)
@@ -174,10 +175,15 @@ class ErrorHandler:
174
175
  if self.should_exit_on_error and self.shared_errors["error"]:
175
176
  sys.exit(1)
176
177
 
177
- def __enter__(self) -> "ErrorHandler":
178
+ def __enter__(self) -> Self:
178
179
  return self
179
180
 
180
- def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None:
181
+ def __exit__(
182
+ self,
183
+ exc_type: type[BaseException] | None,
184
+ exc_value: BaseException | None,
185
+ traceback: TracebackType | None,
186
+ ) -> None:
181
187
  self.log()
182
188
  if exc_type is None:
183
189
  self.exit_on_error()
@@ -43,7 +43,7 @@ def hash_excel_buffer(buffer: bytes) -> str:
43
43
  f"Error hashing xlsx: The Excel file is corrupted or unreadable: {e}"
44
44
  )
45
45
  return ""
46
- except Exception as e:
46
+ except Exception as e: # noqa: BLE001
47
47
  logger.error(f"Unexpected error hashing xlsx: {e}")
48
48
  return ""
49
49
  finally:
@@ -14,6 +14,17 @@ from frictionless import (
14
14
  from frictionless.errors import ResourceError
15
15
  from frictionless.formats import CsvControl, ExcelControl, JsonControl
16
16
  from frictionless.resources import TableResource
17
+ from frictionless.types import ISample
18
+
19
+
20
+ class NormalisedHeaderDialect(Dialect):
21
+ """Dialect that converts newlines in headers to spaces and strips them, as
22
+ frictionless did before 5.20."""
23
+
24
+ def read_labels(self, sample: ISample) -> list[str]:
25
+ return [
26
+ label.replace("\n", " ").strip() for label in super().read_labels(sample)
27
+ ]
17
28
 
18
29
 
19
30
  def get_frictionless_control(**kwargs: Any) -> tuple[Control, Any]:
@@ -106,12 +117,18 @@ def get_frictionless_dialect(
106
117
  ignore_blank_rows: Whether to ignore blank rows. Defaults to True.
107
118
  **kwargs: See below
108
119
  columns (Sequence[int] | Sequence[str] | None): Columns to pick. Defaults to all.
120
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
109
121
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
110
122
 
111
123
  Returns:
112
124
  (frictionless Dialect object, Any)
113
125
  """
114
- dialect = kwargs.get("dialect", Dialect())
126
+ normalise_headers = kwargs.pop("normalise_headers", True)
127
+ if normalise_headers:
128
+ default_dialect = NormalisedHeaderDialect()
129
+ else:
130
+ default_dialect = Dialect()
131
+ dialect = kwargs.get("dialect", default_dialect)
115
132
  columns = kwargs.pop("columns", None)
116
133
  if columns:
117
134
  dialect.pick_fields = columns
@@ -156,6 +173,7 @@ def get_frictionless_tableresource(
156
173
  null_values (list[Any]): Values that will return None. Defaults to [""].
157
174
  control (Control): This can be set to override the above. See Frictionless docs.
158
175
  detector (Detector): This can be set to override the above. See Frictionless docs.
176
+ normalise_headers (bool): Convert newlines in headers to spaces and strip them. Ignored if dialect supplied. Defaults to True.
159
177
  dialect (Dialect): This can be set to override the above. See Frictionless docs.
160
178
  schema (Schema): This can be set to override the above. See Frictionless docs.
161
179
 
@@ -301,7 +301,7 @@ def get_code_from_name(
301
301
  if not fuzzy_match or is_list:
302
302
  unmatched.append(name)
303
303
  return None
304
- names = [x for x in code_lookup.keys() if len(x) > match_threshold]
304
+ names = [x for x in code_lookup if len(x) > match_threshold]
305
305
  name_index = RapidFuzzMatcher().match(
306
306
  possible_names=names,
307
307
  name=name,
@@ -373,7 +373,7 @@ def earliest_index(string_to_search: str, strings_to_try: Sequence[str]) -> int
373
373
  indices.append(index)
374
374
  except ValueError:
375
375
  indices.append(after_string)
376
- earliest_index = sorted(indices)[0]
376
+ earliest_index = min(indices)
377
377
  if earliest_index == after_string:
378
378
  return None
379
379
  else:
@@ -184,10 +184,10 @@ def temp_dir_batch(
184
184
  delete_on_success,
185
185
  delete_on_failure,
186
186
  tempdir=tempdir,
187
- ) as tempdir:
187
+ ) as folder_path:
188
188
  yield {
189
- "folder": tempdir,
190
- "batch": read_or_create_batch(tempdir, batch),
189
+ "folder": folder_path,
190
+ "batch": read_or_create_batch(folder_path, batch),
191
191
  }
192
192
 
193
193
 
@@ -294,10 +294,9 @@ def wheretostart_tempdir_batch(
294
294
  """
295
295
  delete_if_exists = False
296
296
  wheretostart = getenv("WHERETOSTART")
297
- if wheretostart:
298
- if wheretostart.upper() == "RESET":
299
- delete_if_exists = True
300
- logger.info("Removing progress file and will start from beginning!")
297
+ if wheretostart and wheretostart.upper() == "RESET":
298
+ delete_if_exists = True
299
+ logger.info("Removing progress file and will start from beginning!")
301
300
  with temp_dir_batch(
302
301
  folder,
303
302
  delete_if_exists,
@@ -372,10 +371,9 @@ def multiple_progress_storing_tempdir(
372
371
  """
373
372
  delete_if_exists = False
374
373
  wheretostartenv = getenv("WHERETOSTART")
375
- if wheretostartenv:
376
- if wheretostartenv.upper() == "RESET":
377
- delete_if_exists = True
378
- logger.info("Removing progress file and will start from beginning!")
374
+ if wheretostartenv and wheretostartenv.upper() == "RESET":
375
+ delete_if_exists = True
376
+ logger.info("Removing progress file and will start from beginning!")
379
377
  with temp_dir_batch(
380
378
  folder,
381
379
  delete_if_exists,
@@ -404,9 +402,9 @@ def multiple_progress_storing_tempdir(
404
402
  delete_on_failure=False,
405
403
  batch=batch,
406
404
  tempdir=tempdir,
407
- ) as info:
405
+ ) as batch_info:
408
406
  for info, nextdict in progress_storing_folder(
409
- info, iterators[i], key, wheretostart
407
+ batch_info, iterators[i], key, wheretostart
410
408
  ):
411
409
  save_text(info["progress"], progress_file)
412
410
  yield i, info, nextdict
@@ -4,7 +4,7 @@ from copy import deepcopy
4
4
  from os import mkdir
5
5
  from pathlib import Path
6
6
  from shutil import rmtree
7
- from typing import Any
7
+ from typing import Any, ClassVar
8
8
 
9
9
  from slugify import slugify
10
10
 
@@ -34,7 +34,7 @@ class Retrieve(BaseDownload):
34
34
  log_level: Level at which to log messages. Defaults to logging.INFO.
35
35
  """
36
36
 
37
- retrievers = {}
37
+ retrievers: ClassVar[dict[str, "Retrieve"]] = {}
38
38
 
39
39
  def __init__(
40
40
  self,
@@ -122,7 +122,7 @@ class Retrieve(BaseDownload):
122
122
  self,
123
123
  url: Path | str,
124
124
  filename: str | None = None,
125
- possible_extensions: tuple[str, ...] = tuple(),
125
+ possible_extensions: tuple[str, ...] = (),
126
126
  **kwargs: Any,
127
127
  ) -> tuple[str, Any]:
128
128
  """Get filename from url and given parameters.
@@ -186,7 +186,7 @@ class Retrieve(BaseDownload):
186
186
  fallback: bool = False,
187
187
  resume: bool = False,
188
188
  retries: int = 0,
189
- log_level: int = None,
189
+ log_level: int | None = None,
190
190
  **kwargs: Any,
191
191
  ) -> Path:
192
192
  """Retrieve file.
@@ -241,7 +241,7 @@ class Retrieve(BaseDownload):
241
241
  filename: str | None = None,
242
242
  logstr: str | None = None,
243
243
  fallback: bool = False,
244
- log_level: int = None,
244
+ log_level: int | None = None,
245
245
  **kwargs: Any,
246
246
  ) -> str:
247
247
  """Download text.
@@ -292,7 +292,7 @@ class Retrieve(BaseDownload):
292
292
  filename: str | None = None,
293
293
  logstr: str | None = None,
294
294
  fallback: bool = False,
295
- log_level: int = None,
295
+ log_level: int | None = None,
296
296
  **kwargs: Any,
297
297
  ) -> Any:
298
298
  """Retrieve YAML.
@@ -343,7 +343,7 @@ class Retrieve(BaseDownload):
343
343
  filename: str | None = None,
344
344
  logstr: str | None = None,
345
345
  fallback: bool = False,
346
- log_level: int = None,
346
+ log_level: int | None = None,
347
347
  **kwargs: Any,
348
348
  ) -> Any:
349
349
  """Retrieve JSON.
@@ -446,7 +446,7 @@ class Retrieve(BaseDownload):
446
446
  temp_dir: Path | str,
447
447
  save: bool = False,
448
448
  use_saved: bool = False,
449
- ignore: Sequence[str] = tuple(),
449
+ ignore: Sequence[str] = (),
450
450
  delete: bool = True,
451
451
  **kwargs: Any,
452
452
  ) -> None: