diff --git a/.config/pre-commit-config.yaml b/.config/pre-commit-config.yaml index 3c154e5..8da3e32 100644 --- a/.config/pre-commit-config.yaml +++ b/.config/pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: end-of-file-fixer - id: check-ast - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.1 + rev: v0.6.4 hooks: # Run the linter. - id: ruff @@ -17,7 +17,7 @@ repos: - id: ruff-format args: [--config, .config/ruff.toml] - repo: https://github.com/astral-sh/uv-pre-commit - rev: 0.2.13 + rev: 0.4.5 hooks: # Run the pip compile - id: pip-compile diff --git a/pyproject.toml b/pyproject.toml index 4fe626a..35bea8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "defopt>=6.4.0", "email_validator", "hdx-python-country>=3.7.7", - "hdx-python-utilities>=3.7.2", + "hdx-python-utilities>=3.7.3", "libhxl>=5.2.1", "makefun", "ndg-httpsclient", diff --git a/requirements.txt b/requirements.txt old mode 100755 new mode 100644 index 4d7df47..268e28d --- a/requirements.txt +++ b/requirements.txt @@ -2,17 +2,17 @@ # uv pip compile pyproject.toml --resolver=backtracking --all-extras -o requirements.txt annotated-types==0.7.0 # via pydantic -attrs==23.2.0 +attrs==24.2.0 # via # frictionless # jsonlines # jsonschema # referencing -cachetools==5.4.0 +cachetools==5.5.0 # via google-auth -certifi==2024.7.4 +certifi==2024.8.30 # via requests -cffi==1.16.0 +cffi==1.17.1 # via cryptography cfgv==3.4.0 # via pre-commit @@ -24,9 +24,9 @@ ckanapi==4.8 # via hdx-python-api (pyproject.toml) click==8.1.7 # via typer -coverage==7.6.0 +coverage==7.6.1 # via pytest-cov -cryptography==43.0.0 +cryptography==43.0.1 # via pyopenssl defopt==6.4.0 # via hdx-python-api (pyproject.toml) @@ -46,9 +46,9 @@ et-xmlfile==1.1.0 # via openpyxl filelock==3.15.4 # via virtualenv -frictionless==5.17.0 +frictionless==5.17.1 # via hdx-python-utilities -google-auth==2.32.0 +google-auth==2.34.0 # via # google-auth-oauthlib # gspread @@ -58,7 +58,7 @@ gspread==6.1.2 # via hdx-python-api (pyproject.toml) hdx-python-country==3.7.7 # via hdx-python-api (pyproject.toml) -hdx-python-utilities==3.7.2 +hdx-python-utilities==3.7.3 # via # hdx-python-api (pyproject.toml) # hdx-python-country @@ -66,7 +66,7 @@ humanize==4.10.0 # via frictionless identify==2.6.0 # via pre-commit -idna==3.7 +idna==3.8 # via # email-validator # requests @@ -106,7 +106,7 @@ markupsafe==2.1.5 # via jinja2 mdurl==0.1.2 # via markdown-it-py -more-itertools==10.3.0 +more-itertools==10.5.0 # via inflect ndg-httpsclient==0.5.1 # via hdx-python-api (pyproject.toml) @@ -132,7 +132,7 @@ ply==3.11 # libhxl pockets==0.9.1 # via sphinxcontrib-napoleon -pre-commit==3.7.1 +pre-commit==3.8.0 # via hdx-python-api (pyproject.toml) pyasn1==0.6.0 # via @@ -144,9 +144,9 @@ pyasn1-modules==0.4.0 # via google-auth pycparser==2.22 # via cffi -pydantic==2.8.2 +pydantic==2.9.0 # via frictionless -pydantic-core==2.20.1 +pydantic-core==2.23.2 # via pydantic pygments==2.18.0 # via rich @@ -173,7 +173,7 @@ python-slugify==8.0.4 # via # ckanapi # frictionless -pyyaml==6.0.1 +pyyaml==6.0.2 # via # frictionless # pre-commit @@ -200,9 +200,9 @@ requests-oauthlib==2.0.0 # via google-auth-oauthlib rfc3986==2.0.0 # via frictionless -rich==13.7.1 +rich==13.8.0 # via typer -rpds-py==0.19.1 +rpds-py==0.20.0 # via # jsonschema # referencing @@ -212,13 +212,13 @@ ruamel-yaml==0.18.6 # via hdx-python-utilities ruamel-yaml-clib==0.2.8 # via ruamel-yaml -setuptools==71.1.0 +setuptools==74.1.2 # via ckanapi shellingham==1.5.4 # via typer simpleeval==0.9.13 # via frictionless -simplejson==3.19.2 +simplejson==3.19.3 # via ckanapi six==1.16.0 # via @@ -241,7 +241,7 @@ text-unidecode==1.3 # via python-slugify typeguard==4.3.0 # via inflect -typer==0.12.3 +typer==0.12.5 # via frictionless typing-extensions==4.12.2 # via @@ -250,6 +250,8 @@ typing-extensions==4.12.2 # pydantic-core # typeguard # typer +tzdata==2024.1 + # via pydantic unidecode==1.3.8 # via # libhxl @@ -258,16 +260,18 @@ urllib3==2.2.2 # via # libhxl # requests -validators==0.33.0 +validators==0.34.0 # via frictionless virtualenv==20.26.3 # via pre-commit -wheel==0.43.0 +wheel==0.44.0 # via libhxl xlrd==2.0.1 # via hdx-python-utilities xlrd3==1.1.0 # via libhxl +xlsx2csv==0.8.3 + # via hdx-python-utilities xlsxwriter==3.2.0 # via tableschema-to-template xlwt==1.3.0 diff --git a/src/hdx/data/dataset.py b/src/hdx/data/dataset.py index 85129f5..381ba72 100755 --- a/src/hdx/data/dataset.py +++ b/src/hdx/data/dataset.py @@ -935,7 +935,8 @@ def _dataset_update_resources( resources_to_delete = list(reversed(resources_to_delete)) if match_resource_order: new_resource_order = [ - (x["name"], x["format"]) for x in resources_metadata_to_update + (x["name"], x["format"].lower()) + for x in resources_metadata_to_update ] else: new_resource_order = None diff --git a/tests/hdx/api/test_ckan.py b/tests/hdx/api/test_ckan.py index 6f6c608..30f4ae2 100644 --- a/tests/hdx/api/test_ckan.py +++ b/tests/hdx/api/test_ckan.py @@ -74,23 +74,26 @@ def gclient(self): @pytest.fixture(scope="function") def setup_teardown_folder(self, configuration, gclient, params): - payload = { - "name": "hdx_python_api_test_tmp", - "mimeType": "application/vnd.google-apps.folder", - "parents": ["1dvx0H0RG5ZfM9QL148uymWpbuxAqmOzD"], - } - r = gclient.http_client.request( - "post", DRIVE_FILES_API_V3_URL, json=payload, params=params - ) - folderid = r.json()["id"] - yield gclient, folderid - - payload = {"trashed": True} - url = f"{DRIVE_FILES_API_V3_URL}/{folderid}" - gclient.http_client.request("patch", url, json=payload, params=params) - Vocabulary._approved_vocabulary = None - Vocabulary._tags_dict = None - Configuration.delete() + try: + payload = { + "name": "hdx_python_api_test_tmp", + "mimeType": "application/vnd.google-apps.folder", + "parents": ["1dvx0H0RG5ZfM9QL148uymWpbuxAqmOzD"], + } + r = gclient.http_client.request( + "post", DRIVE_FILES_API_V3_URL, json=payload, params=params + ) + folderid = r.json()["id"] + yield gclient, folderid + finally: + payload = {"trashed": True} + url = f"{DRIVE_FILES_API_V3_URL}/{folderid}" + gclient.http_client.request( + "patch", url, json=payload, params=params + ) + Vocabulary._approved_vocabulary = None + Vocabulary._tags_dict = None + Configuration.delete() def test_create_dataset( self,