Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarans committed Feb 15, 2024
1 parent 050dd2f commit aace57c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ attrs==23.2.0
# frictionless
# jsonlines
# jsonschema
certifi==2023.11.17
certifi==2024.2.2
# via requests
cffi==1.16.0
# via cryptography
Expand Down Expand Up @@ -55,13 +55,13 @@ frictionless==5.16.1
# via hdx-python-utilities
hdx-python-country==3.6.4
# via hdx-python-api (pyproject.toml)
hdx-python-utilities==3.6.4
hdx-python-utilities==3.6.5
# via
# hdx-python-api (pyproject.toml)
# hdx-python-country
humanize==4.9.0
# via frictionless
identify==2.5.33
identify==2.5.34
# via pre-commit
idna==3.6
# via
Expand All @@ -85,7 +85,7 @@ jsonschema==4.17.3
# via
# frictionless
# tableschema-to-template
libhxl==5.2
libhxl==5.2.1
# via
# hdx-python-api (pyproject.toml)
# hdx-python-country
Expand All @@ -97,7 +97,7 @@ markdown-it-py==3.0.0
# via rich
marko==2.0.2
# via frictionless
markupsafe==2.1.4
markupsafe==2.1.5
# via jinja2
mdurl==0.1.2
# via markdown-it-py
Expand All @@ -123,19 +123,19 @@ ply==3.11
# libhxl
pockets==0.9.1
# via sphinxcontrib-napoleon
pre-commit==3.6.0
pre-commit==3.6.1
# via hdx-python-api (pyproject.toml)
pyasn1==0.5.1
# via
# hdx-python-api (pyproject.toml)
# ndg-httpsclient
pycparser==2.21
# via cffi
pydantic==2.6.0
pydantic==2.6.1
# via
# frictionless
# inflect
pydantic-core==2.16.1
pydantic-core==2.16.2
# via pydantic
pygments==2.17.2
# via rich
Expand All @@ -160,7 +160,7 @@ python-dateutil==2.8.2
# libhxl
python-io-wrapper==0.3.1
# via libhxl
python-slugify==8.0.2
python-slugify==8.0.4
# via
# ckanapi
# frictionless
Expand All @@ -186,7 +186,7 @@ rfc3986==2.0.0
# via frictionless
rich==13.7.0
# via typer
ruamel-yaml==0.18.5
ruamel-yaml==0.18.6
# via hdx-python-utilities
ruamel-yaml-clib==0.2.8
# via ruamel-yaml
Expand Down
4 changes: 2 additions & 2 deletions src/hdx/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import warnings
from copy import deepcopy
from datetime import datetime
from datetime import datetime, timezone
from os.path import isfile, join
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -614,7 +614,7 @@ def _save_dataset_add_filestore_resources(
# No need to output timezone info here so no need to use now_utc()
self.data[
"updated_by_script"
] = f"{scriptinfo} ({datetime.utcnow().isoformat(timespec='microseconds')})"
] = f"{scriptinfo} ({datetime.now(timezone.utc).isoformat(timespec='microseconds')})"
batch = kwargs.get("batch")
if batch:
if not is_valid_uuid(batch):
Expand Down
4 changes: 2 additions & 2 deletions src/hdx/data/filestore_helper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Helper to the Dataset class for handling resources with filestores.
"""
from datetime import datetime
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Any, Dict

from hdx.utilities.dictandlist import merge_two_dictionaries
Expand Down Expand Up @@ -100,7 +100,7 @@ def dataset_merge_filestore_resource(
if resource.get_file_to_upload():
resource["url"] = cls.temporary_url
if data_updated:
resource["last_modified"] = datetime.utcnow().isoformat(
resource["last_modified"] = datetime.now(timezone.utc).isoformat(
timespec="microseconds"
)
resource.data_updated = False
8 changes: 4 additions & 4 deletions src/hdx/data/resource.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Resource class containing all logic for creating, checking, and updating resources."""
import logging
import warnings
from datetime import datetime
from datetime import datetime, timezone
from os.path import join
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
Expand Down Expand Up @@ -392,9 +392,9 @@ def _resource_merge_hdx_update(
"""
data_updated = kwargs.pop("data_updated", self.data_updated)
if data_updated and not self.file_to_upload:
self.old_data["last_modified"] = datetime.utcnow().isoformat(
timespec="microseconds"
)
self.old_data["last_modified"] = datetime.now(
timezone.utc
).isoformat(timespec="microseconds")
self.data_updated = False
# old_data will be merged into data in the next step
self._merge_hdx_update(
Expand Down

0 comments on commit aace57c

Please sign in to comment.