hdx-python-utilities 4.2.4__tar.gz → 4.2.6__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.6}/.github/workflows/publish-test.yaml +2 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/.github/workflows/publish.yaml +2 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/.github/workflows/run-python-tests.yaml +4 -4
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/.pre-commit-config.yaml +2 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/CLAUDE.md +1 -1
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/PKG-INFO +2 -4
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/documentation/index.md +2 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/pyproject.toml +4 -6
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/__init__.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/_version.py +2 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/base_downloader.py +8 -4
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/compare.py +2 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/dateparse.py +25 -23
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/dictandlist.py +1 -1
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/downloader.py +16 -11
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/easy_logging.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/email.py +3 -3
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/encoding.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/error_handler.py +12 -6
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/file_hashing.py +1 -1
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/html.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/loader.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/matching.py +2 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/path.py +11 -13
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/retriever.py +8 -8
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/session.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/state.py +9 -3
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/text.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/useragent.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/uuid.py +1 -1
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/conftest.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_compare.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_dateparse.py +89 -103
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_dictandlist.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_downloader.py +18 -12
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_easy_logging.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_email.py +14 -11
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_encoding.py +0 -0
- hdx_python_utilities-4.2.6/tests/hdx/utilities/test_error_handler.py +53 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_file_hashing.py +3 -1
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_html.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_loader.py +8 -6
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_path.py +11 -11
- hdx_python_utilities-4.2.6/tests/hdx/utilities/test_retriever.py +504 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_saver.py +4 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_state.py +3 -3
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_text.py +1 -1
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_useragent.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_uuid.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_zip_crc.py +4 -2
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/uv.lock +68 -742
- hdx_python_utilities-4.2.4/tests/hdx/utilities/test_error_handler.py +0 -54
- hdx_python_utilities-4.2.4/tests/hdx/utilities/test_retriever.py +0 -495
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/.gitignore +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/LICENSE +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/README.md +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/documentation/.readthedocs.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/documentation/mkdocs.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/errors_onexit.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/frictionless_wrapper.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/saver.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/url.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/zip_crc.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/compare/test_csv_processing.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/compare/test_csv_processing2.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/empty.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/hdx_config.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/hdx_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/hdx_email_configuration.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/logging_config.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/logging_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/project_configuration.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/project_configuration.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/smtp_config.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/smtp_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/user_agent_config.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/user_agent_config2.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/user_agent_config3.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/basicauth.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/bearertoken.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/extra_params.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/extra_params.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/extra_params_tree.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/resume_test.dat +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_csv_processing.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_csv_processing_blanks.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_data.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_data.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_data1.csv/empty.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_data2.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_json_processing.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_xls_processing.xls +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/downloader/test_xlsx_processing.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/file_hashing/bad_header.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/file_hashing/bad_index.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/file_hashing/empty.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/file_hashing/test.xlsx +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/file_hashing/test_shapefile.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/file_hashing/valid_sig_invalid_body.zip +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/html/response.html +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/loader/empty.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/loader/empty.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/loader/empty_list.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/matching/wfp_admin_matcher_calls.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/fallbacks/test.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/fallbacks/test.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/fallbacks/test.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/fallbacks/test.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/retriever-test.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/test.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/test.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/test.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/retriever/test.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out2.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out2.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out5.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out6.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out7.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out8.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/out8.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-false_sortkeys-false.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-false_sortkeys-false.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-false_sortkeys-true.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-false_sortkeys-true.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-true_sortkeys-false.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-true_sortkeys-false.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-true_sortkeys-true.json +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/saver/pretty-true_sortkeys-true.yaml +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/state/analysis_dates.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/state/last_build_date.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/test_data.csv +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/text/text1.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/fixtures/text/text2.txt +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_matching.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_matching_wfp_admin.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/test_url.py +0 -0
- {hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/tests/hdx/utilities/utils.py +0 -0
{hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/.github/workflows/publish-test.yaml
RENAMED
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
contents: read
|
|
17
17
|
|
|
18
18
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
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@
|
|
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@
|
|
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@
|
|
28
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
29
29
|
|
|
30
30
|
- name: Build with uv
|
|
31
31
|
run: uv build
|
{hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/.github/workflows/run-python-tests.yaml
RENAMED
|
@@ -16,10 +16,10 @@ jobs:
|
|
|
16
16
|
pull-requests: write
|
|
17
17
|
|
|
18
18
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
19
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
20
20
|
|
|
21
21
|
- name: Install uv
|
|
22
|
-
uses: astral-sh/setup-uv@
|
|
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.
|
|
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.
|
|
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
|
|
@@ -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.6
|
|
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",
|
|
@@ -72,7 +70,7 @@ dev = [
|
|
|
72
70
|
"pytest-loguru",
|
|
73
71
|
"pytest-mock",
|
|
74
72
|
"pre-commit",
|
|
75
|
-
"ruff==0.
|
|
73
|
+
"ruff==0.17.3",
|
|
76
74
|
]
|
|
77
75
|
|
|
78
76
|
[project.urls]
|
|
@@ -103,12 +101,12 @@ 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
|
|
|
110
108
|
[tool.ruff.lint]
|
|
111
|
-
#
|
|
109
|
+
# Ruff's defaults plus isort and pyupgrade
|
|
112
110
|
extend-select = [
|
|
113
111
|
"I", # isort
|
|
114
112
|
"UP", # pyupgrade
|
|
File without changes
|
|
@@ -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.6'
|
|
22
|
+
__version_tuple__ = version_tuple = (4, 2, 6)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
{hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/base_downloader.py
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
from collections.abc import Iterator, Sequence
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from typing_extensions import Self
|
|
4
|
+
from types import TracebackType
|
|
5
|
+
from typing import Any, Self
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class DownloadError(Exception):
|
|
@@ -22,7 +21,12 @@ class BaseDownload(ABC):
|
|
|
22
21
|
"""
|
|
23
22
|
return self
|
|
24
23
|
|
|
25
|
-
def __exit__(
|
|
24
|
+
def __exit__(
|
|
25
|
+
self,
|
|
26
|
+
exc_type: type[BaseException] | None,
|
|
27
|
+
exc_value: BaseException | None,
|
|
28
|
+
traceback: TracebackType | None,
|
|
29
|
+
) -> None:
|
|
26
30
|
"""Subclasses should define this to allow with usage.
|
|
27
31
|
|
|
28
32
|
Args:
|
|
@@ -23,8 +23,8 @@ def compare_files(
|
|
|
23
23
|
Delta between the two files
|
|
24
24
|
"""
|
|
25
25
|
diff = ndiff(
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
|
@@ -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
|
|
@@ -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)
|
|
520
|
+
l = _timelex.split(timestr)
|
|
521
521
|
|
|
522
522
|
skipped_idxs = []
|
|
523
523
|
|
|
@@ -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(
|
|
@@ -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 {
|
|
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)
|
|
@@ -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,24 +1092,26 @@ 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 =
|
|
1101
|
-
today: datetime =
|
|
1100
|
+
timezone: datetime.tzinfo = 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)
|
|
@@ -1150,7 +1152,7 @@ def get_quarter_start(year: int, quarter: int) -> datetime:
|
|
|
1150
1152
|
First day of quarter
|
|
1151
1153
|
"""
|
|
1152
1154
|
month = 3 * (quarter - 1) + 1
|
|
1153
|
-
return datetime(year, month, 1, tzinfo=
|
|
1155
|
+
return datetime(year, month, 1, tzinfo=UTC)
|
|
1154
1156
|
|
|
1155
1157
|
|
|
1156
1158
|
def get_quarter_end(
|
|
@@ -1183,5 +1185,5 @@ def get_quarter_end(
|
|
|
1183
1185
|
seconds = 0
|
|
1184
1186
|
microseconds = 0
|
|
1185
1187
|
return datetime(
|
|
1186
|
-
year, month, 1, hours, minutes, seconds, microseconds, tzinfo=
|
|
1188
|
+
year, month, 1, hours, minutes, seconds, microseconds, tzinfo=UTC
|
|
1187
1189
|
) + timedelta(days=-1)
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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__(
|
|
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!"
|
|
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
|
|
@@ -1257,9 +1262,9 @@ class Download(BaseDownload):
|
|
|
1257
1262
|
kwargs["rate_limit"] = rate_limit
|
|
1258
1263
|
|
|
1259
1264
|
cls.downloaders = {"default": cls(**kwargs)}
|
|
1260
|
-
for name in custom_configs:
|
|
1265
|
+
for name, custom_config in custom_configs.items():
|
|
1261
1266
|
args_copy = deepcopy(kwargs)
|
|
1262
|
-
args_copy.update(
|
|
1267
|
+
args_copy.update(custom_config)
|
|
1263
1268
|
cls.downloaders[name] = cls(**args_copy)
|
|
1264
1269
|
|
|
1265
1270
|
@classmethod
|
|
File without changes
|
|
@@ -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) ->
|
|
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:
|
|
102
|
+
def __exit__(self, *args: object) -> None:
|
|
103
103
|
"""Close Email object for end of with statement.
|
|
104
104
|
|
|
105
105
|
Args:
|
|
File without changes
|
{hdx_python_utilities-4.2.4 → hdx_python_utilities-4.2.6}/src/hdx/utilities/error_handler.py
RENAMED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
import sys
|
|
5
5
|
from collections.abc import Sequence
|
|
6
|
-
from
|
|
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} {
|
|
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
|
|
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
|
|
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) ->
|
|
178
|
+
def __enter__(self) -> Self:
|
|
178
179
|
return self
|
|
179
180
|
|
|
180
|
-
def __exit__(
|
|
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:
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
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 =
|
|
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
|
|
187
|
+
) as folder_path:
|
|
188
188
|
yield {
|
|
189
|
-
"folder":
|
|
190
|
-
"batch": read_or_create_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
|
-
|
|
299
|
-
|
|
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
|
-
|
|
377
|
-
|
|
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
|
|
405
|
+
) as batch_info:
|
|
408
406
|
for info, nextdict in progress_storing_folder(
|
|
409
|
-
|
|
407
|
+
batch_info, iterators[i], key, wheretostart
|
|
410
408
|
):
|
|
411
409
|
save_text(info["progress"], progress_file)
|
|
412
410
|
yield i, info, nextdict
|