hestia-earth-utils 0.16.10__tar.gz → 0.16.11__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.
- {hestia_earth_utils-0.16.10/hestia_earth_utils.egg-info → hestia_earth_utils-0.16.11}/PKG-INFO +1 -1
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/blank_node.py +0 -1
- hestia_earth_utils-0.16.11/hestia_earth/utils/version.py +1 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11/hestia_earth_utils.egg-info}/PKG-INFO +1 -1
- hestia_earth_utils-0.16.11/tests/test_blank_node.py +73 -0
- hestia_earth_utils-0.16.10/hestia_earth/utils/version.py +0 -1
- hestia_earth_utils-0.16.10/tests/test_blank_node.py +0 -59
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/MANIFEST.in +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/README.md +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/bin/hestia-format-upload +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/bin/hestia-pivot-csv +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/__init__.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/api.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/calculation_status.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/cycle.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/date.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/descriptive_stats.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/emission.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/lookup.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/lookup_utils.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/model.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pipeline.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/__init__.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/_shared.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/pivot_csv.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/pivot_json.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/request.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/stats.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/__init__.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_azure_client.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_local_client.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_s3_client.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_sns_client.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/table.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/term.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/tools.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/SOURCES.txt +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/dependency_links.txt +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/requires.txt +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/top_level.txt +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/setup.cfg +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/setup.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_api.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_calculation_status.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_cycle.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_date.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_descriptive_stats.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_emission.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_lookup.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_lookup_utils.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_model.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_pipeline.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_request.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_stats.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_table.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_term.py +0 -0
- {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_tools.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.16.11"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
from pytest import mark
|
|
4
|
+
from hestia_earth.schema import TermTermType
|
|
5
|
+
|
|
6
|
+
from tests.utils import fixtures_path
|
|
7
|
+
from hestia_earth.utils.blank_node import (
|
|
8
|
+
get_node_value,
|
|
9
|
+
ArrayTreatment,
|
|
10
|
+
get_blank_nodes_calculation_status,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
fixtures_folder = os.path.join(fixtures_path, "blank_node")
|
|
14
|
+
calculation_status_folder = os.path.join(fixtures_folder, "calculation_status")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_get_node_value():
|
|
18
|
+
assert get_node_value(None) == 0
|
|
19
|
+
|
|
20
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}, "value": [10]}
|
|
21
|
+
assert get_node_value(blank_node, "value", default=None) == 10
|
|
22
|
+
|
|
23
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}, "value": [0]}
|
|
24
|
+
assert get_node_value(blank_node, "value", default=None) == 0
|
|
25
|
+
|
|
26
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}}
|
|
27
|
+
assert get_node_value(blank_node, "value", default=None) is None
|
|
28
|
+
|
|
29
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}, "value": [10, 20]}
|
|
30
|
+
assert get_node_value(blank_node, "value", default=None) == 30
|
|
31
|
+
|
|
32
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}, "value": True}
|
|
33
|
+
assert get_node_value(blank_node, "value", default=None) is True
|
|
34
|
+
|
|
35
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}, "value": 10}
|
|
36
|
+
assert get_node_value(blank_node, "value", default=None) == 10
|
|
37
|
+
|
|
38
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}, "value": None}
|
|
39
|
+
assert get_node_value(blank_node, "value", default=None) is None
|
|
40
|
+
|
|
41
|
+
blank_node = {"term": {"termType": "crop", "@id": "wheatGrain"}, "value": None}
|
|
42
|
+
assert get_node_value(blank_node, "value", default=0) == 0
|
|
43
|
+
|
|
44
|
+
blank_node = {
|
|
45
|
+
"term": {"termType": "crop", "@id": "wheatGrain"},
|
|
46
|
+
"value": [10, None, 20],
|
|
47
|
+
}
|
|
48
|
+
assert (
|
|
49
|
+
get_node_value(blank_node, "value", array_treatment=ArrayTreatment.MEAN) == 15
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
blank_node = {
|
|
53
|
+
"term": {"termType": "crop", "@id": "wheatGrain"},
|
|
54
|
+
"value": [10, None, 20],
|
|
55
|
+
}
|
|
56
|
+
assert get_node_value(blank_node, "value", array_treatment=ArrayTreatment.SUM) == 30
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# @mark.parametrize(
|
|
60
|
+
# 'folder,list_key,termType',
|
|
61
|
+
# [
|
|
62
|
+
# ('cycle', 'emissions', TermTermType.EMISSION),
|
|
63
|
+
# ]
|
|
64
|
+
# )
|
|
65
|
+
# def test_get_blank_nodes_calculation_status(folder: str, list_key: str, termType: TermTermType):
|
|
66
|
+
# with open(f"{calculation_status_folder}/{folder}/node.jsonld", encoding='utf-8') as f:
|
|
67
|
+
# node = json.load(f)
|
|
68
|
+
|
|
69
|
+
# with open(f"{calculation_status_folder}/{folder}/{list_key}-{termType.value}.json", encoding='utf-8') as f:
|
|
70
|
+
# expected = json.load(f)
|
|
71
|
+
|
|
72
|
+
# result = get_blank_nodes_calculation_status(node, list_key=list_key, termType=termType)
|
|
73
|
+
# assert result == expected, folder
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.16.10"
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# import os
|
|
2
|
-
# import json
|
|
3
|
-
# from pytest import mark
|
|
4
|
-
# from hestia_earth.schema import TermTermType
|
|
5
|
-
|
|
6
|
-
# from tests.utils import fixtures_path
|
|
7
|
-
# from hestia_earth.utils.blank_node import get_node_value, ArrayTreatment, get_blank_nodes_calculation_status
|
|
8
|
-
|
|
9
|
-
# fixtures_folder = os.path.join(fixtures_path, 'blank_node')
|
|
10
|
-
# calculation_status_folder = os.path.join(fixtures_folder, 'calculation_status')
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# def test_get_node_value():
|
|
14
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': [10]}
|
|
15
|
-
# assert get_node_value(blank_node, 'value', default=None) == 10
|
|
16
|
-
|
|
17
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': [0]}
|
|
18
|
-
# assert get_node_value(blank_node, 'value', default=None) == 0
|
|
19
|
-
|
|
20
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}}
|
|
21
|
-
# assert get_node_value(blank_node, 'value', default=None) is None
|
|
22
|
-
|
|
23
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': [10, 20]}
|
|
24
|
-
# assert get_node_value(blank_node, 'value', default=None) == 15
|
|
25
|
-
|
|
26
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': True}
|
|
27
|
-
# assert get_node_value(blank_node, 'value', default=None) is True
|
|
28
|
-
|
|
29
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': 10}
|
|
30
|
-
# assert get_node_value(blank_node, 'value', default=None) == 10
|
|
31
|
-
|
|
32
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': None}
|
|
33
|
-
# assert get_node_value(blank_node, 'value', default=None) is None
|
|
34
|
-
|
|
35
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': None}
|
|
36
|
-
# assert get_node_value(blank_node, 'value', default=0) == 0
|
|
37
|
-
|
|
38
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': [10, None, 20]}
|
|
39
|
-
# assert get_node_value(blank_node, 'value', default=None) == 15
|
|
40
|
-
|
|
41
|
-
# blank_node = {'term': {'termType': 'crop', '@id': 'wheatGrain'}, 'value': [10, None, 20]}
|
|
42
|
-
# assert get_node_value(blank_node, 'value', array_treatment=ArrayTreatment.SUM) == 30
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# @mark.parametrize(
|
|
46
|
-
# 'folder,list_key,termType',
|
|
47
|
-
# [
|
|
48
|
-
# ('cycle', 'emissions', TermTermType.EMISSION),
|
|
49
|
-
# ]
|
|
50
|
-
# )
|
|
51
|
-
# def test_get_blank_nodes_calculation_status(folder: str, list_key: str, termType: TermTermType):
|
|
52
|
-
# with open(f"{calculation_status_folder}/{folder}/node.jsonld", encoding='utf-8') as f:
|
|
53
|
-
# node = json.load(f)
|
|
54
|
-
|
|
55
|
-
# with open(f"{calculation_status_folder}/{folder}/{list_key}-{termType.value}.json", encoding='utf-8') as f:
|
|
56
|
-
# expected = json.load(f)
|
|
57
|
-
|
|
58
|
-
# result = get_blank_nodes_calculation_status(node, list_key=list_key, termType=termType)
|
|
59
|
-
# assert result == expected, folder
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/calculation_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/descriptive_stats.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/lookup_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/__init__.py
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/_shared.py
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/pivot_csv.py
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/pivot_json.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_s3_client.py
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_sns_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/requires.txt
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/top_level.txt
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
|