hdx-python-api 6.7.7__tar.gz → 6.7.8__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_api-6.7.7 → hdx_python_api-6.7.8}/.github/workflows/publish.yaml +2 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/.github/workflows/run-python-tests.yaml +4 -4
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/.pre-commit-config.yaml +2 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/PKG-INFO +2 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/explanation/facades.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/explanation/history.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/explanation/information.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/api-key.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/docker.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/framework.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/install.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/logging.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/objects.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/dataset-resources.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/location.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/maintainer.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/organization.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/tags.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/time-period.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/update-frequency.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/reference/changelog.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/tutorials/getting-started.md +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/pyproject.toml +2 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/_version.py +2 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/configuration.py +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/locations.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/utilities/date_helper.py +3 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/utilities/filestore_helper.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/utilities/hdx_error_handler.py +8 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/dataset.py +42 -49
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/hdxobject.py +3 -3
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/location.py +3 -4
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/organization.py +2 -3
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/resource.py +5 -5
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/resource_matcher.py +7 -10
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/resource_view.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/showcase.py +5 -5
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/user.py +2 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/vocabulary.py +2 -4
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/facades/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/facades/infer_arguments.py +1 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/facades/keyword_arguments.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/facades/simple.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/test_ckan.py +1 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/test_configuration.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/test_locations.py +0 -0
- hdx_python_api-6.7.8/tests/hdx/api/utilities/test_hdx_error_handler.py +76 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/conftest.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_activity.py +2 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_dataset_core.py +3 -4
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_dataset_noncore.py +2 -3
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_organization.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_resource.py +18 -18
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_resource_view.py +2 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_showcase.py +2 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_update_dataset_resources.py +3 -2
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_user.py +31 -33
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_vocabulary.py +2 -1
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/facades/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/facades/test_infer_arguments.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/facades/test_keyword_arguments.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/facades/test_simple.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/uv.lock +32 -33
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/workingexample/my_code.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/workingexample/run.py +0 -0
- hdx_python_api-6.7.7/tests/hdx/api/utilities/test_hdx_error_handler.py +0 -79
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/.gitignore +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/CLAUDE.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/LICENSE +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/README.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/.readthedocs.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/activity-streams.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/customisation.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/facades.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/idmc-example.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/locations.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/resource-generation.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/visualization.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-resources/data-dictionary.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-resources/datastore.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-resources/resource-operations.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/organizations.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/pipeline-state.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/showcases.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/statistics.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/users.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/vocabularies.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/working-examples.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/index.md +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/mkdocs.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/hdx_base_configuration.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/remotehdx.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/utilities/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/utilities/hdx_state.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/utilities/hdx_stats.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/api/utilities/url_utils.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/src/hdx/data/activity.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/Accepted_Tags.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/CKAN/hdx_dataset_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/Tag_Mapping.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/Tag_Mapping_ChainRuleError.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/empty.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_base_config.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_base_config.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_config.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_config.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_dataset_static.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_dataset_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_datasource_topline.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_datasource_topline.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_email_configuration.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_missing_site_config.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_organization_static.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_organization_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_resource_static.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_resource_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_resource_view_static.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_resource_view_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_showcase_static.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_showcase_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_user_static.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_user_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_vocabulary_static.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/hdx_vocabulary_static.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/project_configuration.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/project_configuration.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/user_agent_config.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/user_agent_config2.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/user_agent_config3.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/dataset_search_results.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/download_gen_resource/conflict_data_alg.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/download_gen_resource/min_qc_conflict_data_alg.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/download_gen_resource/qc_conflict_data_alg.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/download_gen_resource/test_data_no_data.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/download_gen_resource/test_data_no_years.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/empty.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/gen_resource/conflict_data_alg.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/gen_resource/min_qc_conflict_data_alg.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/gen_resource/qc_conflict_data_alg.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/gen_resource/test_data_no_data.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/gen_resource/test_data_no_years.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/location/location_list_all_fields.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/location/location_show_results.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/organization/organization_list_all_fields.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/organization/organization_show_results.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/qc_from_rows/qc_conflict_data_alg.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/qc_from_rows/qc_conflict_data_alg_one_col.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/resource_formats.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/showcase_all_search_results.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/size_hash/ACLED-All-Africa-File_20170101-to-20170708.xlsx +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/state/analysis_dates.txt +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/state/last_build_date.txt +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/test_data.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/test_data.zip +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/dem_data_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/dem_indicatorlist_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/expected_resources_to_update.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/opri_data_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/opri_indicatorlist_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/opri_metadata_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/qc_sdg_data_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/sdg_data_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/sdg_indicatorlist_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/sdg_metadata_zwe.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/unesco_dataset.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_dataset_resources/unesco_update_dataset.json +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_logic/update_logic_resources.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/fixtures/update_logic/update_logic_resources_new.yaml +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/utilities/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/utilities/test_filestore_helper.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/utilities/test_hdx_state.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/utilities/test_hdx_stats.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/api/utilities/test_url_utils.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/__init__.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_dataset_add_hapi_error.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_dataset_resource_generation.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_location.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/tests/hdx/data/test_update_logic.py +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/workingexample/my_resource.csv +0 -0
- {hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/workingexample/my_resource.xlsx +0 -0
|
@@ -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
|
|
@@ -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"
|
|
@@ -39,13 +39,13 @@ jobs:
|
|
|
39
39
|
run: uv run pytest
|
|
40
40
|
|
|
41
41
|
- name: Publish Unit Test Results
|
|
42
|
-
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
42
|
+
uses: EnricoMi/publish-unit-test-result-action@7622c5bf3d112a72ab4fa3951c2aa5723d8ab92d # v2.25.0
|
|
43
43
|
if: always()
|
|
44
44
|
with:
|
|
45
45
|
files: test-results.xml
|
|
46
46
|
|
|
47
47
|
- name: Publish in Coveralls
|
|
48
|
-
uses: coverallsapp/github-action@v2
|
|
48
|
+
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
|
|
49
49
|
if: always()
|
|
50
50
|
with:
|
|
51
51
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: hdx-python-api
|
|
3
|
-
Version: 6.7.
|
|
3
|
+
Version: 6.7.8
|
|
4
4
|
Summary: HDX Python API for interacting with the Humanitarian Data Exchange
|
|
5
5
|
Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-api
|
|
6
6
|
Author: Michael Rans
|
|
@@ -28,7 +28,7 @@ Requires-Dist: ckanapi>=4.11
|
|
|
28
28
|
Requires-Dist: defopt>=7.0.0
|
|
29
29
|
Requires-Dist: email-validator
|
|
30
30
|
Requires-Dist: hdx-python-country>=4.2.6
|
|
31
|
-
Requires-Dist: hdx-python-utilities>=4.2.
|
|
31
|
+
Requires-Dist: hdx-python-utilities>=4.2.6
|
|
32
32
|
Requires-Dist: makefun
|
|
33
33
|
Requires-Dist: requests
|
|
34
34
|
Provides-Extra: docs
|
|
@@ -11,4 +11,4 @@ project configuration is used for any configuration specific to your project.
|
|
|
11
11
|
|
|
12
12
|
The default logging configuration reads a configuration file internal to the library
|
|
13
13
|
that sets up an coloured console handler outputting at INFO level and a file handler
|
|
14
|
-
writing to errors.log at ERROR level.
|
|
14
|
+
writing to errors.log at ERROR level.
|
|
@@ -15,4 +15,4 @@ resolve issues as quickly as possible. Static metadata can be held in human read
|
|
|
15
15
|
files so if it needs to be modified, it is straightforward.
|
|
16
16
|
|
|
17
17
|
The HDX Python library has expanded over time as needs have arisen and is used for a
|
|
18
|
-
range of tasks involving interaction with the HDX platform.
|
|
18
|
+
range of tasks involving interaction with the HDX platform.
|
|
@@ -8,4 +8,4 @@ This library is part of the [Humanitarian Data Exchange](https://data.humdata.or
|
|
|
8
8
|
HDX.
|
|
9
9
|
|
|
10
10
|
The code for the library is [here](https://github.com/OCHA-DAP/hdx-python-api).
|
|
11
|
-
The library has detailed API documentation which can be found in the menu at the top.
|
|
11
|
+
The library has detailed API documentation which can be found in the menu at the top.
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
The library is also available set up and ready to go in a Docker image:
|
|
4
4
|
|
|
5
5
|
docker pull public.ecr.aws/unocha/hdx-scraper-baseimage:stable
|
|
6
|
-
docker run -i -t public.ecr.aws/unocha/hdx-scraper-baseimage:stable python3
|
|
6
|
+
docker run -i -t public.ecr.aws/unocha/hdx-scraper-baseimage:stable python3
|
|
@@ -15,4 +15,4 @@ package that are missing eg. for Ubuntu: python-dev, libffi-dev and libssl-dev.
|
|
|
15
15
|
If you get import or other errors, then please either recreate your virtualenv if you
|
|
16
16
|
are using one or uninstall hdx-python-api, hdx-python-country and hdx-python-utilities
|
|
17
17
|
using **pip uninstall**, then install hdx-python-api (which will pull in the other
|
|
18
|
-
dependencies).
|
|
18
|
+
dependencies).
|
|
@@ -99,4 +99,4 @@ You can delete HDX objects using **delete_from_hdx** and update an object that
|
|
|
99
99
|
already exists in HDX with the method **update_in_hdx**. These take various
|
|
100
100
|
boolean parameters that all have defaults and are documented in the API docs.
|
|
101
101
|
They do not return anything and they throw exceptions for failures like the
|
|
102
|
-
object to update not existing.
|
|
102
|
+
object to update not existing.
|
{hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/location.md
RENAMED
|
@@ -38,4 +38,4 @@ If you want to add any other kind of location (which must be in this
|
|
|
38
38
|
[list of valid locations](https://data.humdata.org/api/action/group_list?all_fields=true)),
|
|
39
39
|
you do as shown below.
|
|
40
40
|
|
|
41
|
-
dataset.add_other_location("LOCATION")
|
|
41
|
+
dataset.add_other_location("LOCATION")
|
{hdx_python_api-6.7.7 → hdx_python_api-6.7.8}/documentation/how-to/operate-datasets/time-period.md
RENAMED
|
@@ -28,4 +28,4 @@ The method below allows you to set the time period using a year range. The start
|
|
|
28
28
|
end year can be supplied as integers or strings. If no end year is supplied then the
|
|
29
29
|
range will be from the beginning of the start year to the end of that year.
|
|
30
30
|
|
|
31
|
-
dataset.set_time_period_year_range(START YEAR, END YEAR)
|
|
31
|
+
dataset.set_time_period_year_range(START YEAR, END YEAR)
|
|
@@ -38,4 +38,4 @@ A list of valid update frequencies can be found using:
|
|
|
38
38
|
Transforming backwards and forwards between representations can be achieved with this
|
|
39
39
|
function:
|
|
40
40
|
|
|
41
|
-
update_frequency = Dataset.transform_update_frequency("UPDATE_FREQUENCY")
|
|
41
|
+
update_frequency = Dataset.transform_update_frequency("UPDATE_FREQUENCY")
|
|
@@ -70,4 +70,4 @@ List[str]] (Tuple containing list of added tags and list of deleted tags and tag
|
|
|
70
70
|
added).
|
|
71
71
|
|
|
72
72
|
From 3.7.1, the list of tags must be from a set of approved tags (see
|
|
73
|
-
[Set Tags](../how-to/operate-datasets/tags.md)).
|
|
73
|
+
[Set Tags](../how-to/operate-datasets/tags.md)).
|
|
@@ -39,7 +39,7 @@ dependencies = [
|
|
|
39
39
|
"defopt>=7.0.0",
|
|
40
40
|
"email_validator",
|
|
41
41
|
"hdx-python-country>=4.2.6",
|
|
42
|
-
"hdx-python-utilities>=4.2.
|
|
42
|
+
"hdx-python-utilities>=4.2.6",
|
|
43
43
|
"makefun",
|
|
44
44
|
"requests",
|
|
45
45
|
]
|
|
@@ -55,7 +55,7 @@ dev = [
|
|
|
55
55
|
"pytest-cov",
|
|
56
56
|
"pytest-mock",
|
|
57
57
|
"pre-commit",
|
|
58
|
-
"ruff==0.
|
|
58
|
+
"ruff==0.17.3",
|
|
59
59
|
]
|
|
60
60
|
|
|
61
61
|
[project.urls]
|
|
@@ -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 = '6.7.
|
|
22
|
-
__version_tuple__ = version_tuple = (6, 7,
|
|
21
|
+
__version__ = version = '6.7.8'
|
|
22
|
+
__version_tuple__ = version_tuple = (6, 7, 8)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -200,7 +200,7 @@ class Configuration(UserDict):
|
|
|
200
200
|
if hdx_read_only is None:
|
|
201
201
|
hdx_read_only = False
|
|
202
202
|
self.hdx_read_only = hdx_read_only
|
|
203
|
-
logger.info(f"Read only access to HDX: {
|
|
203
|
+
logger.info(f"Read only access to HDX: {self.hdx_read_only!s}")
|
|
204
204
|
|
|
205
205
|
if self.hdx_site == "hdx_custom_site":
|
|
206
206
|
hdx_key = None
|
|
File without changes
|
|
@@ -63,7 +63,7 @@ class DateHelper:
|
|
|
63
63
|
def get_time_period_info(
|
|
64
64
|
hdx_time_period: str,
|
|
65
65
|
date_format: str | None = None,
|
|
66
|
-
today: datetime =
|
|
66
|
+
today: datetime | None = None,
|
|
67
67
|
) -> dict:
|
|
68
68
|
"""Get time period as datetimes and strings in specified format.
|
|
69
69
|
If no format is supplied, the ISO 8601 format is used. Returns a
|
|
@@ -80,6 +80,8 @@ class DateHelper:
|
|
|
80
80
|
Returns:
|
|
81
81
|
Dictionary of date information
|
|
82
82
|
"""
|
|
83
|
+
if today is None:
|
|
84
|
+
today = now_utc()
|
|
83
85
|
result = {}
|
|
84
86
|
if hdx_time_period:
|
|
85
87
|
if hdx_time_period[0] == "[" and hdx_time_period[-1] == "]":
|
|
File without changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from collections.abc import Sequence
|
|
3
3
|
from os import getenv
|
|
4
|
+
from types import TracebackType
|
|
4
5
|
from typing import Any
|
|
5
6
|
|
|
6
7
|
from hdx.utilities.dictandlist import dict_of_sets_add
|
|
@@ -32,7 +33,7 @@ class HDXErrorHandler(ErrorHandler):
|
|
|
32
33
|
):
|
|
33
34
|
super().__init__(should_exit_on_error)
|
|
34
35
|
if write_to_hdx is None:
|
|
35
|
-
write_to_hdx = getenv("ERR_TO_HDX", True)
|
|
36
|
+
write_to_hdx = getenv("ERR_TO_HDX", "True")
|
|
36
37
|
if write_to_hdx in (False, 0, "false", "False", "FALSE", "N", "n", ""):
|
|
37
38
|
self._write_to_hdx = False
|
|
38
39
|
logger.info("Errors won't be written to HDX")
|
|
@@ -210,7 +211,12 @@ class HDXErrorHandler(ErrorHandler):
|
|
|
210
211
|
if self._write_to_hdx:
|
|
211
212
|
self.write_errors_to_hdx()
|
|
212
213
|
|
|
213
|
-
def __exit__(
|
|
214
|
+
def __exit__(
|
|
215
|
+
self,
|
|
216
|
+
exc_type: type[BaseException] | None,
|
|
217
|
+
exc_value: BaseException | None,
|
|
218
|
+
traceback: TracebackType | None,
|
|
219
|
+
) -> None:
|
|
214
220
|
if self._write_to_hdx:
|
|
215
221
|
self.write_errors_to_hdx()
|
|
216
222
|
super().__exit__(exc_type, exc_value, traceback)
|
|
File without changes
|
|
@@ -10,6 +10,7 @@ from pathlib import Path
|
|
|
10
10
|
from typing import (
|
|
11
11
|
TYPE_CHECKING,
|
|
12
12
|
Any,
|
|
13
|
+
ClassVar,
|
|
13
14
|
Optional,
|
|
14
15
|
Union,
|
|
15
16
|
)
|
|
@@ -19,7 +20,6 @@ from hdx.utilities.base_downloader import BaseDownload
|
|
|
19
20
|
from hdx.utilities.dateparse import (
|
|
20
21
|
default_date,
|
|
21
22
|
default_enddate,
|
|
22
|
-
now_utc,
|
|
23
23
|
now_utc_notz,
|
|
24
24
|
parse_date,
|
|
25
25
|
parse_date_range,
|
|
@@ -34,12 +34,11 @@ import hdx.api.utilities.url_utils
|
|
|
34
34
|
import hdx.data.organization as org_module
|
|
35
35
|
import hdx.data.resource as res_module
|
|
36
36
|
import hdx.data.showcase as sc_module
|
|
37
|
-
import hdx.data.user as user
|
|
38
|
-
import hdx.data.vocabulary as vocabulary
|
|
39
37
|
from hdx.api.configuration import Configuration
|
|
40
38
|
from hdx.api.locations import Locations
|
|
41
39
|
from hdx.api.utilities.date_helper import DateHelper
|
|
42
40
|
from hdx.api.utilities.filestore_helper import FilestoreHelper
|
|
41
|
+
from hdx.data import user, vocabulary
|
|
43
42
|
from hdx.data.activity import Activity
|
|
44
43
|
from hdx.data.hdxobject import HDXError, HDXObject
|
|
45
44
|
from hdx.data.resource_matcher import ResourceMatcher
|
|
@@ -67,7 +66,7 @@ class Dataset(HDXObject):
|
|
|
67
66
|
|
|
68
67
|
max_attempts = 5
|
|
69
68
|
max_int = sys.maxsize
|
|
70
|
-
update_frequencies = {
|
|
69
|
+
update_frequencies: ClassVar[dict[str, str]] = {
|
|
71
70
|
"-2": "As needed",
|
|
72
71
|
"-1": "Never",
|
|
73
72
|
"0": "Live",
|
|
@@ -224,7 +223,7 @@ class Dataset(HDXObject):
|
|
|
224
223
|
session = hdx.api.utilities.url_utils.get_ckan_ready_session(
|
|
225
224
|
self.configuration
|
|
226
225
|
)
|
|
227
|
-
for resource in dataset_dict.get("resources",
|
|
226
|
+
for resource in dataset_dict.get("resources", ()):
|
|
228
227
|
resource["url"] = hdx.api.utilities.url_utils.follow_url(
|
|
229
228
|
resource["url"], session=session
|
|
230
229
|
)
|
|
@@ -295,11 +294,10 @@ class Dataset(HDXObject):
|
|
|
295
294
|
The resource that was added after matching with any existing resource
|
|
296
295
|
"""
|
|
297
296
|
resource = self._get_resource_from_obj(resource)
|
|
298
|
-
if "package_id" in resource:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
)
|
|
297
|
+
if "package_id" in resource and not ignore_datasetid:
|
|
298
|
+
raise HDXError(
|
|
299
|
+
f"Resource {resource['name']} being added already has a dataset id!"
|
|
300
|
+
)
|
|
303
301
|
resource.check_both_url_filetoupload()
|
|
304
302
|
resource_index = ResourceMatcher.match_resource_list(self._resources, resource)
|
|
305
303
|
if resource_index is None:
|
|
@@ -331,11 +329,10 @@ class Dataset(HDXObject):
|
|
|
331
329
|
resource_objects = []
|
|
332
330
|
for resource in resources:
|
|
333
331
|
resource = self._get_resource_from_obj(resource)
|
|
334
|
-
if "package_id" in resource:
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
)
|
|
332
|
+
if "package_id" in resource and not ignore_datasetid:
|
|
333
|
+
raise HDXError(
|
|
334
|
+
f"Resource {resource['name']} being added already has a dataset id!"
|
|
335
|
+
)
|
|
339
336
|
resource.check_both_url_filetoupload()
|
|
340
337
|
resource_objects.append(resource)
|
|
341
338
|
(
|
|
@@ -371,9 +368,8 @@ class Dataset(HDXObject):
|
|
|
371
368
|
Returns:
|
|
372
369
|
True if resource removed or False if not
|
|
373
370
|
"""
|
|
374
|
-
if isinstance(resource, str):
|
|
375
|
-
|
|
376
|
-
raise HDXError(f"{resource} is not a valid resource id!")
|
|
371
|
+
if isinstance(resource, str) and is_valid_uuid(resource) is False:
|
|
372
|
+
raise HDXError(f"{resource} is not a valid resource id!")
|
|
377
373
|
return self._remove_hdxobject(self._resources, resource, delete=delete)
|
|
378
374
|
|
|
379
375
|
def get_resources(self) -> list["Resource"]:
|
|
@@ -593,8 +589,8 @@ class Dataset(HDXObject):
|
|
|
593
589
|
def revise(
|
|
594
590
|
match: dict[str, Any],
|
|
595
591
|
filter: Sequence[str] = (),
|
|
596
|
-
update: dict[str, Any] =
|
|
597
|
-
files_to_upload: dict[str, str] =
|
|
592
|
+
update: dict[str, Any] | None = None,
|
|
593
|
+
files_to_upload: dict[str, str] | None = None,
|
|
598
594
|
configuration: Configuration | None = None,
|
|
599
595
|
**kwargs: Any,
|
|
600
596
|
) -> "Dataset":
|
|
@@ -611,6 +607,10 @@ class Dataset(HDXObject):
|
|
|
611
607
|
Returns:
|
|
612
608
|
Dataset object
|
|
613
609
|
"""
|
|
610
|
+
if files_to_upload is None:
|
|
611
|
+
files_to_upload = {}
|
|
612
|
+
if update is None:
|
|
613
|
+
update = {}
|
|
614
614
|
separators = (",", ":")
|
|
615
615
|
data = {"match": json.dumps(match, separators=separators)}
|
|
616
616
|
if filter:
|
|
@@ -750,11 +750,11 @@ class Dataset(HDXObject):
|
|
|
750
750
|
for resource_index in resources_to_delete:
|
|
751
751
|
del resources_to_update[resource_index]
|
|
752
752
|
new_fsresources = {}
|
|
753
|
-
for index in filestore_resources:
|
|
753
|
+
for index, fsresource in filestore_resources.items():
|
|
754
754
|
if index > resource_index:
|
|
755
|
-
new_fsresources[index - 1] =
|
|
755
|
+
new_fsresources[index - 1] = fsresource
|
|
756
756
|
else:
|
|
757
|
-
new_fsresources[index] =
|
|
757
|
+
new_fsresources[index] = fsresource
|
|
758
758
|
filestore_resources = new_fsresources
|
|
759
759
|
for (
|
|
760
760
|
resource_index,
|
|
@@ -1182,15 +1182,13 @@ class Dataset(HDXObject):
|
|
|
1182
1182
|
"""
|
|
1183
1183
|
self.check_resources_url_filetoupload()
|
|
1184
1184
|
loadedid = self.data.get("id")
|
|
1185
|
-
if loadedid is not None:
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
loadedid = None
|
|
1185
|
+
if loadedid is not None and not self._dataset_load_from_hdx(loadedid):
|
|
1186
|
+
logger.warning(f"Failed to load dataset with id {loadedid}")
|
|
1187
|
+
loadedid = None
|
|
1189
1188
|
if not loadedid:
|
|
1190
1189
|
loadedid = self.data.get("name")
|
|
1191
|
-
if loadedid is not None:
|
|
1192
|
-
|
|
1193
|
-
loadedid = None
|
|
1190
|
+
if loadedid is not None and not self._dataset_load_from_hdx(loadedid):
|
|
1191
|
+
loadedid = None
|
|
1194
1192
|
if loadedid:
|
|
1195
1193
|
statuses, _ = self._dataset_hdx_update(
|
|
1196
1194
|
allow_no_resources=allow_no_resources,
|
|
@@ -1433,8 +1431,7 @@ class Dataset(HDXObject):
|
|
|
1433
1431
|
"""
|
|
1434
1432
|
resources = []
|
|
1435
1433
|
for dataset in datasets:
|
|
1436
|
-
|
|
1437
|
-
resources.append(resource)
|
|
1434
|
+
resources.extend(dataset.get_resources())
|
|
1438
1435
|
return resources
|
|
1439
1436
|
|
|
1440
1437
|
def get_activities(self, all_pages: bool = False, **kwargs: Any) -> list[Activity]:
|
|
@@ -1479,7 +1476,7 @@ class Dataset(HDXObject):
|
|
|
1479
1476
|
def get_time_period(
|
|
1480
1477
|
self,
|
|
1481
1478
|
date_format: str | None = None,
|
|
1482
|
-
today: datetime =
|
|
1479
|
+
today: datetime | None = None,
|
|
1483
1480
|
) -> dict:
|
|
1484
1481
|
"""Get dataset date as datetimes and strings in specified format. If no format is supplied, the ISO 8601
|
|
1485
1482
|
format is used. Returns a dictionary containing keys startdate (start date as datetime), enddate (end
|
|
@@ -1595,7 +1592,7 @@ class Dataset(HDXObject):
|
|
|
1595
1592
|
int(update_frequency)
|
|
1596
1593
|
except ValueError:
|
|
1597
1594
|
update_frequency = Dataset.transform_update_frequency(update_frequency)
|
|
1598
|
-
if update_frequency not in Dataset.update_frequencies
|
|
1595
|
+
if update_frequency not in Dataset.update_frequencies:
|
|
1599
1596
|
raise HDXError("Invalid update frequency supplied!")
|
|
1600
1597
|
self.data["data_update_frequency"] = update_frequency
|
|
1601
1598
|
|
|
@@ -1748,7 +1745,7 @@ class Dataset(HDXObject):
|
|
|
1748
1745
|
Returns:
|
|
1749
1746
|
True if country added or False if country already present
|
|
1750
1747
|
"""
|
|
1751
|
-
iso3,
|
|
1748
|
+
iso3, _match = Country.get_iso3_country_code_fuzzy(country, use_live=use_live)
|
|
1752
1749
|
if iso3 is None:
|
|
1753
1750
|
raise HDXError(f"Country: {country} - cannot find iso3 code!")
|
|
1754
1751
|
return self.add_other_location(
|
|
@@ -1883,7 +1880,7 @@ class Dataset(HDXObject):
|
|
|
1883
1880
|
Returns:
|
|
1884
1881
|
None
|
|
1885
1882
|
"""
|
|
1886
|
-
if isinstance(maintainer, user.User
|
|
1883
|
+
if isinstance(maintainer, (user.User, dict)):
|
|
1887
1884
|
if "id" not in maintainer:
|
|
1888
1885
|
maintainer = user.User.read_from_hdx(
|
|
1889
1886
|
maintainer["name"], configuration=self.configuration
|
|
@@ -1918,9 +1915,7 @@ class Dataset(HDXObject):
|
|
|
1918
1915
|
Returns:
|
|
1919
1916
|
None
|
|
1920
1917
|
"""
|
|
1921
|
-
if isinstance(organization, org_module.Organization)
|
|
1922
|
-
organization, dict
|
|
1923
|
-
):
|
|
1918
|
+
if isinstance(organization, (org_module.Organization, dict)):
|
|
1924
1919
|
if "id" not in organization:
|
|
1925
1920
|
organization = org_module.Organization.read_from_hdx(
|
|
1926
1921
|
organization["name"], configuration=self.configuration
|
|
@@ -1966,7 +1961,7 @@ class Dataset(HDXObject):
|
|
|
1966
1961
|
Returns:
|
|
1967
1962
|
Dataset showcase dict
|
|
1968
1963
|
"""
|
|
1969
|
-
if isinstance(showcase, sc_module.Showcase
|
|
1964
|
+
if isinstance(showcase, (sc_module.Showcase, dict)):
|
|
1970
1965
|
if "id" not in showcase:
|
|
1971
1966
|
showcase = sc_module.Showcase.read_from_hdx(showcase["name"])
|
|
1972
1967
|
showcase = showcase["id"]
|
|
@@ -1981,7 +1976,7 @@ class Dataset(HDXObject):
|
|
|
1981
1976
|
def add_showcase(
|
|
1982
1977
|
self,
|
|
1983
1978
|
showcase: Union["Showcase", dict, str],
|
|
1984
|
-
showcases_to_check: Sequence["Showcase"] = None,
|
|
1979
|
+
showcases_to_check: Sequence["Showcase"] | None = None,
|
|
1985
1980
|
) -> bool:
|
|
1986
1981
|
"""Add dataset to showcase
|
|
1987
1982
|
|
|
@@ -1995,8 +1990,8 @@ class Dataset(HDXObject):
|
|
|
1995
1990
|
dataset_showcase = self._get_dataset_showcase_dict(showcase)
|
|
1996
1991
|
if showcases_to_check is None:
|
|
1997
1992
|
showcases_to_check = self.get_showcases()
|
|
1998
|
-
for
|
|
1999
|
-
if dataset_showcase["showcase_id"] ==
|
|
1993
|
+
for showcase_to_check in showcases_to_check:
|
|
1994
|
+
if dataset_showcase["showcase_id"] == showcase_to_check["id"]:
|
|
2000
1995
|
return False
|
|
2001
1996
|
showcase = sc_module.Showcase(
|
|
2002
1997
|
{"id": dataset_showcase["showcase_id"]},
|
|
@@ -2008,7 +2003,7 @@ class Dataset(HDXObject):
|
|
|
2008
2003
|
def add_showcases(
|
|
2009
2004
|
self,
|
|
2010
2005
|
showcases: Sequence[Union["Showcase", dict, str]],
|
|
2011
|
-
showcases_to_check: Sequence["Showcase"] = None,
|
|
2006
|
+
showcases_to_check: Sequence["Showcase"] | None = None,
|
|
2012
2007
|
) -> bool:
|
|
2013
2008
|
"""Add dataset to multiple showcases
|
|
2014
2009
|
|
|
@@ -2229,7 +2224,7 @@ class Dataset(HDXObject):
|
|
|
2229
2224
|
"""
|
|
2230
2225
|
if isinstance(resource, int) and not isinstance(resource, bool):
|
|
2231
2226
|
resource = self._resources[resource]
|
|
2232
|
-
if isinstance(resource, res_module.Resource
|
|
2227
|
+
if isinstance(resource, (res_module.Resource, dict)):
|
|
2233
2228
|
res = resource.get("id")
|
|
2234
2229
|
if res is None:
|
|
2235
2230
|
resource = resource["name"]
|
|
@@ -2576,12 +2571,10 @@ class Dataset(HDXObject):
|
|
|
2576
2571
|
return None
|
|
2577
2572
|
startdate = result.get("startdate")
|
|
2578
2573
|
if startdate is not None:
|
|
2579
|
-
|
|
2580
|
-
dates[0] = startdate
|
|
2574
|
+
dates[0] = min(dates[0], startdate)
|
|
2581
2575
|
enddate = result.get("enddate")
|
|
2582
2576
|
if enddate is not None:
|
|
2583
|
-
|
|
2584
|
-
dates[1] = enddate
|
|
2577
|
+
dates[1] = max(dates[1], enddate)
|
|
2585
2578
|
return row
|
|
2586
2579
|
|
|
2587
2580
|
filepath = Path(folder) / filename
|
|
@@ -425,7 +425,7 @@ class HDXObject(UserDict, ABC):
|
|
|
425
425
|
try:
|
|
426
426
|
if files_to_upload:
|
|
427
427
|
for key, value in files_to_upload.items():
|
|
428
|
-
open_files_to_upload[key] = open(value, "rb")
|
|
428
|
+
open_files_to_upload[key] = open(value, "rb") # noqa: SIM115
|
|
429
429
|
return self.configuration.call_remoteckan(
|
|
430
430
|
self.actions()[action], data, files=open_files_to_upload
|
|
431
431
|
)
|
|
@@ -603,7 +603,7 @@ class HDXObject(UserDict, ABC):
|
|
|
603
603
|
return False
|
|
604
604
|
if isinstance(obj, str):
|
|
605
605
|
obj_id = obj
|
|
606
|
-
elif isinstance(obj, dict
|
|
606
|
+
elif isinstance(obj, (dict, HDXObject)):
|
|
607
607
|
obj_id = obj.get(matchon)
|
|
608
608
|
else:
|
|
609
609
|
raise HDXError("Type of object not a string, dict or T<=HDXObject")
|
|
@@ -613,7 +613,7 @@ class HDXObject(UserDict, ABC):
|
|
|
613
613
|
objid = objdata.get(matchon)
|
|
614
614
|
if objid and objid == obj_id:
|
|
615
615
|
if delete:
|
|
616
|
-
|
|
616
|
+
objdata.delete_from_hdx()
|
|
617
617
|
del objlist[i]
|
|
618
618
|
return True
|
|
619
619
|
return False
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
from collections.abc import Sequence
|
|
5
|
+
from contextlib import suppress
|
|
5
6
|
from typing import Any, Optional
|
|
6
7
|
|
|
7
8
|
from hdx.api.configuration import Configuration
|
|
8
9
|
from hdx.data.activity import Activity
|
|
9
|
-
from hdx.data.hdxobject import HDXObject
|
|
10
|
+
from hdx.data.hdxobject import HDXError, HDXObject
|
|
10
11
|
|
|
11
12
|
logger = logging.getLogger(__name__)
|
|
12
13
|
|
|
@@ -187,12 +188,10 @@ class Location(HDXObject):
|
|
|
187
188
|
if name in compiled_locations:
|
|
188
189
|
final_locations.append(compiled_locations[name])
|
|
189
190
|
else:
|
|
190
|
-
|
|
191
|
+
with suppress(HDXError):
|
|
191
192
|
missing_location = location._write_to_hdx("show", {"id": name})
|
|
192
193
|
if missing_location:
|
|
193
194
|
final_locations.append(missing_location)
|
|
194
|
-
except Exception:
|
|
195
|
-
pass
|
|
196
195
|
|
|
197
196
|
return final_locations
|
|
198
197
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
from collections.abc import Sequence
|
|
5
|
+
from contextlib import suppress
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
|
7
8
|
|
|
@@ -303,12 +304,10 @@ class Organization(HDXObject):
|
|
|
303
304
|
if name in compiled_orgs:
|
|
304
305
|
final_orgs.append(compiled_orgs[name])
|
|
305
306
|
else:
|
|
306
|
-
|
|
307
|
+
with suppress(HDXError):
|
|
307
308
|
missing_org = organization._write_to_hdx("show", {"id": name})
|
|
308
309
|
if missing_org:
|
|
309
310
|
final_orgs.append(missing_org)
|
|
310
|
-
except Exception:
|
|
311
|
-
pass
|
|
312
311
|
|
|
313
312
|
return final_orgs
|
|
314
313
|
|