hdx-python-utilities 3.6.1__tar.gz → 3.6.2__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-3.6.1 → hdx_python_utilities-3.6.2}/.github/workflows/run-python-tests.yaml +1 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/PKG-INFO +1 -1
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/documentation/.readthedocs.yaml +1 -3
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/documentation/main.md +21 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/documentation/pydoc-markdown.yaml +1 -1
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/requirements.txt +24 -19
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/_version.py +2 -2
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/email.py +2 -2
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/state.py +40 -1
- hdx_python_utilities-3.6.2/tests/fixtures/state/analysis_dates.txt +1 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_downloader.py +2 -2
- hdx_python_utilities-3.6.2/tests/hdx/utilities/test_state.py +83 -0
- hdx_python_utilities-3.6.1/tests/hdx/utilities/test_state.py +0 -40
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/.config/black.toml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/.config/coveragerc +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/.config/pre-commit-config.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/.config/pytest.ini +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/.config/ruff.toml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/.github/workflows/publish.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/.gitignore +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/CONTRIBUTING.md +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/LICENSE +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/README.md +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/pyproject.toml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/__init__.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/base_downloader.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/compare.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/dateparse.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/dictandlist.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/downloader.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/easy_logging.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/encoding.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/errors_onexit.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/frictionless_wrapper.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/html.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/loader.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/path.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/retriever.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/saver.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/session.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/text.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/typehint.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/useragent.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/uuid.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/compare/test_csv_processing.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/compare/test_csv_processing2.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/empty.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/hdx_config.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/hdx_config.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/hdx_email_configuration.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/json_csv.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/logging_config.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/logging_config.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/project_configuration.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/project_configuration.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/smtp_config.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/smtp_config.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/user_agent_config.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/user_agent_config2.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/user_agent_config3.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/basicauth.txt +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/extra_params.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/extra_params.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/extra_params_tree.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_csv_processing.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_csv_processing_blanks.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_data.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_data.xlsx +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_data1.csv/empty.txt +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_data2.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_json_processing.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_xls_processing.xls +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_xlsx_processing.xlsx +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/html/response.html +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/loader/empty.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/loader/empty.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/fallbacks/test.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/fallbacks/test.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/fallbacks/test.txt +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/fallbacks/test.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/retriever-test.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test.txt +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test_hxl.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out2.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out2.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out5.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out6.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out7.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out8.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/out8.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-false_sortkeys-false.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-false_sortkeys-false.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-false_sortkeys-true.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-false_sortkeys-true.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-true_sortkeys-false.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-true_sortkeys-false.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-true_sortkeys-true.json +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/saver/pretty-true_sortkeys-true.yaml +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/state/last_build_date.txt +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/test_data.csv +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/conftest.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_compare.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_dateparse.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_dictandlist.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_easy_logging.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_email.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_encoding.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_errors_onexit.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_html.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_loader.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_path.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_retriever.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_saver.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_text.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_useragent.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_uuid.py +0 -0
- {hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hdx-python-utilities
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.2
|
|
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>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
|
|
3
3
|
mkdocs:
|
|
4
|
-
configuration: mkdocs.yml
|
|
4
|
+
configuration: docs/mkdocs.yml
|
|
5
5
|
fail_on_warning: false
|
|
6
6
|
|
|
7
7
|
build:
|
|
@@ -13,5 +13,3 @@ build:
|
|
|
13
13
|
- pip install --upgrade mkdocs
|
|
14
14
|
- pip install pydoc-markdown
|
|
15
15
|
- pydoc-markdown documentation/pydoc-markdown.yaml
|
|
16
|
-
- mv docs/content/* docs
|
|
17
|
-
- rmdir docs/content
|
|
@@ -679,6 +679,27 @@ transformation outputs a string. It is used as follows:
|
|
|
679
679
|
) as state:
|
|
680
680
|
assert state.get() == date2.replace(hour=0, minute=0)
|
|
681
681
|
|
|
682
|
+
with State(
|
|
683
|
+
statepath,
|
|
684
|
+
State.dates_str_to_country_date_dict,
|
|
685
|
+
State.country_date_dict_to_dates_str,
|
|
686
|
+
) as state:
|
|
687
|
+
state_dict = state.get()
|
|
688
|
+
assert state_dict == {"DEFAULT": date1}
|
|
689
|
+
state_dict["AFG"] = date2
|
|
690
|
+
state.set(state_dict)
|
|
691
|
+
with State(
|
|
692
|
+
statepath,
|
|
693
|
+
State.dates_str_to_country_date_dict,
|
|
694
|
+
State.country_date_dict_to_dates_str,
|
|
695
|
+
) as state:
|
|
696
|
+
state_dict = state.get()
|
|
697
|
+
assert state_dict == {
|
|
698
|
+
"DEFAULT": date1,
|
|
699
|
+
"AFG": date2.replace(hour=0, minute=0),
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
|
|
682
703
|
If run inside a GitHub Action, the saved state file could be committed to
|
|
683
704
|
GitHub so that on the next run the state is available in the repository.
|
|
684
705
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
#
|
|
5
5
|
# pip-compile --all-extras --output-file=requirements.txt --resolver=backtracking pyproject.toml
|
|
6
6
|
#
|
|
7
|
+
annotated-types==0.5.0
|
|
8
|
+
# via pydantic
|
|
7
9
|
attrs==23.1.0
|
|
8
10
|
# via
|
|
9
11
|
# frictionless
|
|
@@ -11,15 +13,15 @@ attrs==23.1.0
|
|
|
11
13
|
# jsonschema
|
|
12
14
|
beautifulsoup4==4.12.2
|
|
13
15
|
# via hdx-python-utilities (pyproject.toml)
|
|
14
|
-
certifi==2023.
|
|
16
|
+
certifi==2023.7.22
|
|
15
17
|
# via requests
|
|
16
18
|
cfgv==3.3.1
|
|
17
19
|
# via pre-commit
|
|
18
|
-
chardet==5.
|
|
20
|
+
chardet==5.2.0
|
|
19
21
|
# via frictionless
|
|
20
|
-
charset-normalizer==3.
|
|
22
|
+
charset-normalizer==3.2.0
|
|
21
23
|
# via requests
|
|
22
|
-
click==8.1.
|
|
24
|
+
click==8.1.6
|
|
23
25
|
# via typer
|
|
24
26
|
colorama==0.4.6
|
|
25
27
|
# via typer
|
|
@@ -27,9 +29,9 @@ coverage[toml]==7.2.7
|
|
|
27
29
|
# via pytest-cov
|
|
28
30
|
decorator==5.1.1
|
|
29
31
|
# via validators
|
|
30
|
-
distlib==0.3.
|
|
32
|
+
distlib==0.3.7
|
|
31
33
|
# via virtualenv
|
|
32
|
-
dnspython==2.
|
|
34
|
+
dnspython==2.4.1
|
|
33
35
|
# via email-validator
|
|
34
36
|
email-validator==2.0.0.post2
|
|
35
37
|
# via hdx-python-utilities (pyproject.toml)
|
|
@@ -37,19 +39,19 @@ et-xmlfile==1.1.0
|
|
|
37
39
|
# via openpyxl
|
|
38
40
|
filelock==3.12.2
|
|
39
41
|
# via virtualenv
|
|
40
|
-
frictionless==5.
|
|
42
|
+
frictionless==5.15.10
|
|
41
43
|
# via hdx-python-utilities (pyproject.toml)
|
|
42
44
|
html5lib==1.1
|
|
43
45
|
# via hdx-python-utilities (pyproject.toml)
|
|
44
|
-
humanize==4.
|
|
46
|
+
humanize==4.7.0
|
|
45
47
|
# via frictionless
|
|
46
|
-
identify==2.5.
|
|
48
|
+
identify==2.5.26
|
|
47
49
|
# via pre-commit
|
|
48
50
|
idna==3.4
|
|
49
51
|
# via
|
|
50
52
|
# email-validator
|
|
51
53
|
# requests
|
|
52
|
-
ijson==3.2.
|
|
54
|
+
ijson==3.2.3
|
|
53
55
|
# via hdx-python-utilities (pyproject.toml)
|
|
54
56
|
iniconfig==2.0.0
|
|
55
57
|
# via pytest
|
|
@@ -83,19 +85,21 @@ packaging==23.1
|
|
|
83
85
|
# via pytest
|
|
84
86
|
petl==1.7.12
|
|
85
87
|
# via frictionless
|
|
86
|
-
platformdirs==3.
|
|
88
|
+
platformdirs==3.10.0
|
|
87
89
|
# via virtualenv
|
|
88
90
|
pluggy==1.2.0
|
|
89
91
|
# via pytest
|
|
90
92
|
pre-commit==3.3.3
|
|
91
93
|
# via hdx-python-utilities (pyproject.toml)
|
|
92
|
-
pydantic==1.
|
|
94
|
+
pydantic==2.1.1
|
|
93
95
|
# via frictionless
|
|
94
|
-
|
|
96
|
+
pydantic-core==2.4.0
|
|
97
|
+
# via pydantic
|
|
98
|
+
pygments==2.16.1
|
|
95
99
|
# via rich
|
|
96
100
|
pyrsistent==0.19.3
|
|
97
101
|
# via jsonschema
|
|
98
|
-
pytest==7.
|
|
102
|
+
pytest==7.4.0
|
|
99
103
|
# via
|
|
100
104
|
# hdx-python-utilities (pyproject.toml)
|
|
101
105
|
# pytest-cov
|
|
@@ -110,7 +114,7 @@ python-dateutil==2.8.2
|
|
|
110
114
|
# hdx-python-utilities (pyproject.toml)
|
|
111
115
|
python-slugify==8.0.1
|
|
112
116
|
# via frictionless
|
|
113
|
-
pyyaml==6.0
|
|
117
|
+
pyyaml==6.0.1
|
|
114
118
|
# via
|
|
115
119
|
# frictionless
|
|
116
120
|
# pre-commit
|
|
@@ -125,7 +129,7 @@ requests-file==1.5.1
|
|
|
125
129
|
# via hdx-python-utilities (pyproject.toml)
|
|
126
130
|
rfc3986==2.0.0
|
|
127
131
|
# via frictionless
|
|
128
|
-
rich==13.
|
|
132
|
+
rich==13.5.2
|
|
129
133
|
# via typer
|
|
130
134
|
ruamel-yaml==0.17.32
|
|
131
135
|
# via hdx-python-utilities (pyproject.toml)
|
|
@@ -153,16 +157,17 @@ text-unidecode==1.3
|
|
|
153
157
|
# via python-slugify
|
|
154
158
|
typer[all]==0.9.0
|
|
155
159
|
# via frictionless
|
|
156
|
-
typing-extensions==4.
|
|
160
|
+
typing-extensions==4.7.1
|
|
157
161
|
# via
|
|
158
162
|
# frictionless
|
|
159
163
|
# pydantic
|
|
164
|
+
# pydantic-core
|
|
160
165
|
# typer
|
|
161
|
-
urllib3==2.0.
|
|
166
|
+
urllib3==2.0.4
|
|
162
167
|
# via requests
|
|
163
168
|
validators==0.20.0
|
|
164
169
|
# via frictionless
|
|
165
|
-
virtualenv==20.
|
|
170
|
+
virtualenv==20.24.2
|
|
166
171
|
# via pre-commit
|
|
167
172
|
webencodings==0.5.1
|
|
168
173
|
# via html5lib
|
|
@@ -171,7 +171,7 @@ class Email:
|
|
|
171
171
|
recipient, check_deliverability=True
|
|
172
172
|
) # validate and get info
|
|
173
173
|
normalised_recipients.append(
|
|
174
|
-
v
|
|
174
|
+
v.normalized
|
|
175
175
|
) # replace with normalized form
|
|
176
176
|
return normalised_recipients
|
|
177
177
|
|
|
@@ -209,7 +209,7 @@ class Email:
|
|
|
209
209
|
v = validate_email(
|
|
210
210
|
sender, check_deliverability=False
|
|
211
211
|
) # validate and get info
|
|
212
|
-
sender = v
|
|
212
|
+
sender = v.normalized
|
|
213
213
|
|
|
214
214
|
if html_body is not None:
|
|
215
215
|
msg = MIMEMultipart("alternative")
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Utility to save state to a file and read it back."""
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Any, Callable
|
|
3
|
+
from typing import Any, Callable, Dict
|
|
4
4
|
|
|
5
|
+
from hdx.utilities.dateparse import iso_string_from_datetime, parse_date
|
|
5
6
|
from hdx.utilities.loader import load_text
|
|
6
7
|
from hdx.utilities.saver import save_text
|
|
7
8
|
|
|
@@ -91,3 +92,41 @@ class State:
|
|
|
91
92
|
None
|
|
92
93
|
"""
|
|
93
94
|
self.state = state
|
|
95
|
+
|
|
96
|
+
@staticmethod
|
|
97
|
+
def dates_str_to_country_date_dict(dates_str: str) -> Dict:
|
|
98
|
+
"""Convert a comma separated string of key=date string pairs eg.
|
|
99
|
+
"default=2017-01-01,afg=2019-01-01" to a dictionary of key date
|
|
100
|
+
mappings eg.
|
|
101
|
+
{"default": 2017-01-01 as datetime, "afg": 2019-01-01 as datetime}
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
dates_str (str): Comma separated string of key=date string pairs
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
Dict: Dictionary of key date mappings
|
|
108
|
+
"""
|
|
109
|
+
result = {}
|
|
110
|
+
for keyvalue in dates_str.split(","):
|
|
111
|
+
key, value = keyvalue.split("=")
|
|
112
|
+
result[key] = parse_date(value)
|
|
113
|
+
return result
|
|
114
|
+
|
|
115
|
+
@staticmethod
|
|
116
|
+
def country_date_dict_to_dates_str(country_date_dict: Dict) -> str:
|
|
117
|
+
"""Convert a dictionary of key date mappings eg.
|
|
118
|
+
{"default": 2017-01-01 as datetime, "afg": 2019-01-01 as datetime}
|
|
119
|
+
to a comma separated string of key=date string pairs eg.
|
|
120
|
+
"default=2017-01-01,afg=2019-01-01"
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
country_date_dict (Dict): Dictionary of key date mappings
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
str: Comma separated string of key=date string pairs
|
|
127
|
+
"""
|
|
128
|
+
strlist = []
|
|
129
|
+
for key, value in country_date_dict.items():
|
|
130
|
+
valstr = iso_string_from_datetime(value)
|
|
131
|
+
strlist.append(f"{key}={valstr}")
|
|
132
|
+
return ",".join(strlist)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DEFAULT=2020-09-23
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_downloader.py
RENAMED
|
@@ -55,11 +55,11 @@ class TestDownloader:
|
|
|
55
55
|
|
|
56
56
|
@pytest.fixture(scope="class")
|
|
57
57
|
def getfixtureurl(self):
|
|
58
|
-
return "
|
|
58
|
+
return "https://httpbin.org/get"
|
|
59
59
|
|
|
60
60
|
@pytest.fixture(scope="class")
|
|
61
61
|
def postfixtureurl(self):
|
|
62
|
-
return "
|
|
62
|
+
return "https://httpbin.org/post"
|
|
63
63
|
|
|
64
64
|
@pytest.fixture(scope="class")
|
|
65
65
|
def fixturenotexistsurl(self):
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""State Utility Tests"""
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
from os.path import join
|
|
4
|
+
from shutil import copyfile
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from hdx.utilities.dateparse import iso_string_from_datetime, parse_date
|
|
9
|
+
from hdx.utilities.path import temp_dir
|
|
10
|
+
from hdx.utilities.state import State
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TestState:
|
|
14
|
+
@pytest.fixture(scope="class")
|
|
15
|
+
def statefolder(self, fixturesfolder):
|
|
16
|
+
return join(fixturesfolder, "state")
|
|
17
|
+
|
|
18
|
+
@pytest.fixture(scope="class")
|
|
19
|
+
def statefile(self):
|
|
20
|
+
return "last_build_date.txt"
|
|
21
|
+
|
|
22
|
+
@pytest.fixture(scope="class")
|
|
23
|
+
def multidatestatefile(self):
|
|
24
|
+
return "analysis_dates.txt"
|
|
25
|
+
|
|
26
|
+
@pytest.fixture(scope="class")
|
|
27
|
+
def date1(self):
|
|
28
|
+
return datetime(2020, 9, 23, 0, 0, tzinfo=timezone.utc)
|
|
29
|
+
|
|
30
|
+
@pytest.fixture(scope="class")
|
|
31
|
+
def date2(self):
|
|
32
|
+
return datetime(2022, 5, 12, 10, 15, tzinfo=timezone.utc)
|
|
33
|
+
|
|
34
|
+
def test_state(self, statefolder, statefile, date1, date2):
|
|
35
|
+
with temp_dir(folder="test_state") as tmpdir:
|
|
36
|
+
statepath = join(tmpdir, statefile)
|
|
37
|
+
copyfile(join(statefolder, statefile), statepath)
|
|
38
|
+
with State(
|
|
39
|
+
statepath, parse_date, iso_string_from_datetime
|
|
40
|
+
) as state:
|
|
41
|
+
assert state.get() == date1
|
|
42
|
+
with State(
|
|
43
|
+
statepath, parse_date, iso_string_from_datetime
|
|
44
|
+
) as state:
|
|
45
|
+
assert state.get() == date1
|
|
46
|
+
state.set(date2)
|
|
47
|
+
with State(
|
|
48
|
+
statepath, parse_date, iso_string_from_datetime
|
|
49
|
+
) as state:
|
|
50
|
+
assert state.get() == date2.replace(hour=0, minute=0)
|
|
51
|
+
|
|
52
|
+
def test_multi_date_state(
|
|
53
|
+
self, statefolder, multidatestatefile, date1, date2
|
|
54
|
+
):
|
|
55
|
+
with temp_dir(folder="test_multidatestate") as tmpdir:
|
|
56
|
+
statepath = join(tmpdir, multidatestatefile)
|
|
57
|
+
copyfile(join(statefolder, multidatestatefile), statepath)
|
|
58
|
+
with State(
|
|
59
|
+
statepath,
|
|
60
|
+
State.dates_str_to_country_date_dict,
|
|
61
|
+
State.country_date_dict_to_dates_str,
|
|
62
|
+
) as state:
|
|
63
|
+
state_dict = state.get()
|
|
64
|
+
assert state_dict == {"DEFAULT": date1}
|
|
65
|
+
with State(
|
|
66
|
+
statepath,
|
|
67
|
+
State.dates_str_to_country_date_dict,
|
|
68
|
+
State.country_date_dict_to_dates_str,
|
|
69
|
+
) as state:
|
|
70
|
+
state_dict = state.get()
|
|
71
|
+
assert state_dict == {"DEFAULT": date1}
|
|
72
|
+
state_dict["AFG"] = date2
|
|
73
|
+
state.set(state_dict)
|
|
74
|
+
with State(
|
|
75
|
+
statepath,
|
|
76
|
+
State.dates_str_to_country_date_dict,
|
|
77
|
+
State.country_date_dict_to_dates_str,
|
|
78
|
+
) as state:
|
|
79
|
+
state_dict = state.get()
|
|
80
|
+
assert state_dict == {
|
|
81
|
+
"DEFAULT": date1,
|
|
82
|
+
"AFG": date2.replace(hour=0, minute=0),
|
|
83
|
+
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"""State Utility Tests"""
|
|
2
|
-
from datetime import datetime, timezone
|
|
3
|
-
from os.path import join
|
|
4
|
-
from shutil import copyfile
|
|
5
|
-
|
|
6
|
-
import pytest
|
|
7
|
-
|
|
8
|
-
from hdx.utilities.dateparse import iso_string_from_datetime, parse_date
|
|
9
|
-
from hdx.utilities.path import temp_dir
|
|
10
|
-
from hdx.utilities.state import State
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class TestState:
|
|
14
|
-
@pytest.fixture(scope="class")
|
|
15
|
-
def statefolder(self, fixturesfolder):
|
|
16
|
-
return join(fixturesfolder, "state")
|
|
17
|
-
|
|
18
|
-
@pytest.fixture(scope="class")
|
|
19
|
-
def statefile(self):
|
|
20
|
-
return "last_build_date.txt"
|
|
21
|
-
|
|
22
|
-
def test_state(self, statefolder, statefile):
|
|
23
|
-
with temp_dir(folder="test_state") as tmpdir:
|
|
24
|
-
statepath = join(tmpdir, statefile)
|
|
25
|
-
copyfile(join(statefolder, statefile), statepath)
|
|
26
|
-
date1 = datetime(2020, 9, 23, 0, 0, tzinfo=timezone.utc)
|
|
27
|
-
date2 = datetime(2022, 5, 12, 10, 15, tzinfo=timezone.utc)
|
|
28
|
-
with State(
|
|
29
|
-
statepath, parse_date, iso_string_from_datetime
|
|
30
|
-
) as state:
|
|
31
|
-
assert state.get() == date1
|
|
32
|
-
with State(
|
|
33
|
-
statepath, parse_date, iso_string_from_datetime
|
|
34
|
-
) as state:
|
|
35
|
-
assert state.get() == date1
|
|
36
|
-
state.set(date2)
|
|
37
|
-
with State(
|
|
38
|
-
statepath, parse_date, iso_string_from_datetime
|
|
39
|
-
) as state:
|
|
40
|
-
assert state.get() == date2.replace(hour=0, minute=0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/base_downloader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/errors_onexit.py
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/src/hdx/utilities/frictionless_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/hdx_config.json
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/hdx_config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/json_csv.yaml
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/logging_config.json
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/logging_config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/smtp_config.json
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/config/smtp_config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/basicauth.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_data.csv
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_data.xlsx
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/downloader/test_data2.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test.json
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test.yaml
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/retriever/test_hxl.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/fixtures/state/last_build_date.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_compare.py
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_dateparse.py
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_dictandlist.py
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_easy_logging.py
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_encoding.py
RENAMED
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_errors_onexit.py
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_loader.py
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_retriever.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_utilities-3.6.1 → hdx_python_utilities-3.6.2}/tests/hdx/utilities/test_useragent.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|