-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add facility to obtain WFP exchange rates
Allow current and historic rates to be passed to Currency.setup() to prefill the cache
- Loading branch information
Showing
10 changed files
with
246 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,12 +50,16 @@ Homepage = "https://github.com/OCHA-DAP/hdx-python-country" | |
[project.optional-dependencies] | ||
test = ["pytest", "pytest-cov"] | ||
dev = ["pre-commit"] | ||
wfp = ["data-bridges-client@git+ssh://[email protected]/WFP-VAM/DataBridgesAPI@dev#egg=data-bridges-client"] | ||
|
||
|
||
######### | ||
# Hatch # | ||
######### | ||
|
||
[tool.hatch.metadata] | ||
allow-direct-references = true | ||
|
||
# Build | ||
|
||
[tool.hatch.build.targets.wheel] | ||
|
@@ -76,7 +80,7 @@ version_scheme = "python-simplified-semver" | |
# Tests | ||
|
||
[tool.hatch.envs.test] | ||
features = ["test"] | ||
features = ["test", "wfp"] | ||
|
||
[tool.hatch.envs.test.scripts] | ||
test = """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,22 @@ | |
# This file is autogenerated by pip-compile with Python 3.11 | ||
# by the following command: | ||
# | ||
# pip-compile --all-extras --output-file=requirements.txt --resolver=backtracking pyproject.toml | ||
# pip-compile --all-extras --output-file=requirements.txt pyproject.toml | ||
# | ||
annotated-types==0.6.0 | ||
# via pydantic | ||
anyio==4.3.0 | ||
# via httpx | ||
attrs==23.2.0 | ||
# via | ||
# frictionless | ||
# jsonlines | ||
# jsonschema | ||
certifi==2024.2.2 | ||
# via requests | ||
# via | ||
# httpcore | ||
# httpx | ||
# requests | ||
cfgv==3.4.0 | ||
# via pre-commit | ||
chardet==5.2.0 | ||
|
@@ -24,7 +29,11 @@ click==8.1.7 | |
colorama==0.4.6 | ||
# via typer | ||
coverage[toml]==7.4.3 | ||
# via pytest-cov | ||
# via | ||
# coverage | ||
# pytest-cov | ||
data-bridges-client @ git+ssh://[email protected]/WFP-VAM/DataBridgesAPI@dev | ||
# via hdx-python-country (pyproject.toml) | ||
distlib==0.3.8 | ||
# via virtualenv | ||
et-xmlfile==1.1.0 | ||
|
@@ -33,14 +42,23 @@ filelock==3.13.1 | |
# via virtualenv | ||
frictionless==5.16.1 | ||
# via hdx-python-utilities | ||
h11==0.14.0 | ||
# via httpcore | ||
hdx-python-utilities==3.6.5 | ||
# via hdx-python-country (pyproject.toml) | ||
httpcore==1.0.4 | ||
# via httpx | ||
httpx==0.27.0 | ||
# via data-bridges-client | ||
humanize==4.9.0 | ||
# via frictionless | ||
identify==2.5.35 | ||
# via pre-commit | ||
idna==3.6 | ||
# via requests | ||
# via | ||
# anyio | ||
# httpx | ||
# requests | ||
ijson==3.2.3 | ||
# via hdx-python-utilities | ||
iniconfig==2.0.0 | ||
|
@@ -87,8 +105,10 @@ ply==3.11 | |
# libhxl | ||
pre-commit==3.6.2 | ||
# via hdx-python-country (pyproject.toml) | ||
pydantic==2.6.2 | ||
# via frictionless | ||
pydantic==2.6.3 | ||
# via | ||
# data-bridges-client | ||
# frictionless | ||
pydantic-core==2.16.3 | ||
# via pydantic | ||
pygments==2.17.2 | ||
|
@@ -105,6 +125,7 @@ pytest-cov==4.1.0 | |
# via hdx-python-country (pyproject.toml) | ||
python-dateutil==2.8.2 | ||
# via | ||
# data-bridges-client | ||
# frictionless | ||
# hdx-python-utilities | ||
# libhxl | ||
|
@@ -128,7 +149,7 @@ requests-file==2.0.0 | |
# via hdx-python-utilities | ||
rfc3986==2.0.0 | ||
# via frictionless | ||
rich==13.7.0 | ||
rich==13.7.1 | ||
# via typer | ||
ruamel-yaml==0.18.6 | ||
# via hdx-python-utilities | ||
|
@@ -142,6 +163,10 @@ six==1.16.0 | |
# via | ||
# isodate | ||
# python-dateutil | ||
sniffio==1.3.1 | ||
# via | ||
# anyio | ||
# httpx | ||
stringcase==1.2.0 | ||
# via frictionless | ||
structlog==24.1.0 | ||
|
@@ -153,9 +178,12 @@ tabulate==0.9.0 | |
text-unidecode==1.3 | ||
# via python-slugify | ||
typer[all]==0.9.0 | ||
# via frictionless | ||
# via | ||
# frictionless | ||
# typer | ||
typing-extensions==4.10.0 | ||
# via | ||
# data-bridges-client | ||
# frictionless | ||
# pydantic | ||
# pydantic-core | ||
|
@@ -164,8 +192,9 @@ unidecode==1.3.8 | |
# via | ||
# libhxl | ||
# pyphonetics | ||
urllib3==2.2.1 | ||
urllib3==2.0.7 | ||
# via | ||
# data-bridges-client | ||
# libhxl | ||
# requests | ||
validators==0.22.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
from datetime import datetime | ||
|
||
from ._version import version as __version__ # noqa: F401 | ||
from hdx.utilities.dateparse import get_timestamp_from_datetime | ||
|
||
|
||
def get_int_timestamp(date: datetime) -> int: | ||
""" | ||
Get integer timestamp from datetime object | ||
Args: | ||
date (datetime): datetime object | ||
Returns: | ||
int: Integer timestamp | ||
""" | ||
return int(round(get_timestamp_from_datetime(date))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.