hestia-earth-utils 0.16.15__tar.gz → 0.16.16__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.15 → hestia_earth_utils-0.16.16}/PKG-INFO +2 -2
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pivot/_shared.py +0 -1
- hestia_earth_utils-0.16.16/hestia_earth/utils/version.py +1 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth_utils.egg-info/PKG-INFO +2 -2
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth_utils.egg-info/requires.txt +1 -1
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_api.py +0 -1
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_blank_node.py +36 -21
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_calculation_status.py +5 -15
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_cycle.py +7 -2
- hestia_earth_utils-0.16.15/hestia_earth/utils/version.py +0 -1
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/MANIFEST.in +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/README.md +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/bin/hestia-format-upload +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/bin/hestia-pivot-csv +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/__init__.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/api.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/blank_node.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/calculation_status.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/cycle.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/date.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/descriptive_stats.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/emission.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/lookup.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/lookup_utils.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/model.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pipeline.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pivot/__init__.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pivot/pivot_csv.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pivot/pivot_json.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/request.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/stats.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/storage/__init__.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/storage/_azure_client.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/storage/_local_client.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/storage/_s3_client.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/storage/_sns_client.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/table.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/term.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/tools.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth_utils.egg-info/SOURCES.txt +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth_utils.egg-info/dependency_links.txt +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth_utils.egg-info/top_level.txt +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/setup.cfg +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/setup.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_date.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_descriptive_stats.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_emission.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_lookup.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_lookup_utils.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_model.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_pipeline.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_request.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_stats.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_table.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_term.py +0 -0
- {hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/tests/test_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hestia_earth_utils
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.16
|
|
4
4
|
Summary: HESTIA's utils library
|
|
5
5
|
Home-page: https://gitlab.com/hestia-earth/hestia-utils
|
|
6
6
|
Author: HESTIA Team
|
|
@@ -13,7 +13,7 @@ Requires-Dist: hestia-earth-schema>=35.0.1
|
|
|
13
13
|
Requires-Dist: requests>=2.24.0
|
|
14
14
|
Requires-Dist: urllib3~=1.26.0
|
|
15
15
|
Requires-Dist: python-dateutil>=2.8.1
|
|
16
|
-
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: pandas<3,>=2
|
|
17
17
|
Requires-Dist: flatten_json
|
|
18
18
|
Dynamic: author
|
|
19
19
|
Dynamic: author-email
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.16.16"
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth_utils.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hestia_earth_utils
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.16
|
|
4
4
|
Summary: HESTIA's utils library
|
|
5
5
|
Home-page: https://gitlab.com/hestia-earth/hestia-utils
|
|
6
6
|
Author: HESTIA Team
|
|
@@ -13,7 +13,7 @@ Requires-Dist: hestia-earth-schema>=35.0.1
|
|
|
13
13
|
Requires-Dist: requests>=2.24.0
|
|
14
14
|
Requires-Dist: urllib3~=1.26.0
|
|
15
15
|
Requires-Dist: python-dateutil>=2.8.1
|
|
16
|
-
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: pandas<3,>=2
|
|
17
17
|
Requires-Dist: flatten_json
|
|
18
18
|
Dynamic: author
|
|
19
19
|
Dynamic: author-email
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import json
|
|
3
|
+
from pytest import mark
|
|
4
|
+
from unittest.mock import patch
|
|
5
|
+
from hestia_earth.schema import TermTermType
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
# from pytest import mark
|
|
5
|
-
# from hestia_earth.schema import TermTermType
|
|
6
|
-
|
|
7
|
-
from tests.utils import fixtures_path
|
|
7
|
+
from tests.utils import EMISSION_IDS, fixtures_path
|
|
8
8
|
from hestia_earth.utils.blank_node import (
|
|
9
9
|
get_node_value,
|
|
10
10
|
ArrayTreatment,
|
|
11
|
-
|
|
11
|
+
get_blank_nodes_calculation_status,
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
fixtures_folder = os.path.join(fixtures_path, "blank_node")
|
|
@@ -57,18 +57,33 @@ def test_get_node_value():
|
|
|
57
57
|
assert get_node_value(blank_node, "value", array_treatment=ArrayTreatment.SUM) == 30
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
@mark.parametrize(
|
|
61
|
+
"folder,list_key,termType",
|
|
62
|
+
[
|
|
63
|
+
("cycle", "emissions", TermTermType.EMISSION),
|
|
64
|
+
("cycle-with-transformations", "emissions", TermTermType.EMISSION),
|
|
65
|
+
],
|
|
66
|
+
)
|
|
67
|
+
@patch(
|
|
68
|
+
"hestia_earth.utils.blank_node.cycle_emissions_in_system_boundary",
|
|
69
|
+
return_value=EMISSION_IDS,
|
|
70
|
+
)
|
|
71
|
+
def test_get_blank_nodes_calculation_status(
|
|
72
|
+
mock_, folder: str, list_key: str, termType: TermTermType
|
|
73
|
+
):
|
|
74
|
+
with open(
|
|
75
|
+
f"{calculation_status_folder}/{folder}/node.jsonld", encoding="utf-8"
|
|
76
|
+
) as f:
|
|
77
|
+
node = json.load(f)
|
|
78
|
+
|
|
79
|
+
with open(
|
|
80
|
+
f"{calculation_status_folder}/{folder}/{list_key}-{termType.value}.json",
|
|
81
|
+
encoding="utf-8",
|
|
82
|
+
) as f:
|
|
83
|
+
expected = json.load(f)
|
|
84
|
+
|
|
85
|
+
result = get_blank_nodes_calculation_status(
|
|
86
|
+
node, list_key=list_key, termType=termType
|
|
87
|
+
)
|
|
88
|
+
print(json.dumps(result, indent=2))
|
|
89
|
+
assert result == expected, folder
|
|
@@ -13,28 +13,18 @@ def test_emissions_with_status():
|
|
|
13
13
|
|
|
14
14
|
result = _emissions_with_status(nodes[0])
|
|
15
15
|
assert result == {
|
|
16
|
-
"emissions-total":
|
|
16
|
+
"emissions-total": 202,
|
|
17
17
|
"emissions-complete": 55,
|
|
18
|
-
"emissions-incomplete":
|
|
19
|
-
"emissions-missing":
|
|
18
|
+
"emissions-incomplete": 1,
|
|
19
|
+
"emissions-missing": 146,
|
|
20
20
|
"emissions": result["emissions"], # ignore
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
result = _emissions_with_status(nodes[1])
|
|
24
24
|
assert result == {
|
|
25
|
-
"emissions-total":
|
|
25
|
+
"emissions-total": 202,
|
|
26
26
|
"emissions-complete": 0,
|
|
27
27
|
"emissions-incomplete": 13,
|
|
28
|
-
"emissions-missing":
|
|
28
|
+
"emissions-missing": 189,
|
|
29
29
|
"emissions": result["emissions"], # ignore
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# def test_get_nodes_calculations_status_dataframe():
|
|
34
|
-
# with open(os.path.join(fixtures_folder, 'nodes.json')) as f:
|
|
35
|
-
# nodes = json.load(f)
|
|
36
|
-
|
|
37
|
-
# expected = open(os.path.join(fixtures_folder, 'result.csv'), 'r').read()
|
|
38
|
-
|
|
39
|
-
# df = get_nodes_calculations_status_dataframe(nodes, file_format='csv')
|
|
40
|
-
# assert df.to_csv(None, index=None) == expected
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import json
|
|
3
3
|
import pytest
|
|
4
|
+
from unittest.mock import patch
|
|
4
5
|
|
|
5
|
-
from tests.utils import fixtures_path
|
|
6
|
+
from tests.utils import EMISSION_IDS, fixtures_path
|
|
6
7
|
from hestia_earth.utils.cycle import get_cycle_emissions_calculation_status
|
|
7
8
|
|
|
8
9
|
fixtures_folder = os.path.join(fixtures_path, "blank_node", "calculation_status")
|
|
@@ -14,7 +15,11 @@ _folders = [
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
@pytest.mark.parametrize("folder", _folders)
|
|
17
|
-
|
|
18
|
+
@patch(
|
|
19
|
+
"hestia_earth.utils.blank_node.cycle_emissions_in_system_boundary",
|
|
20
|
+
return_value=EMISSION_IDS,
|
|
21
|
+
)
|
|
22
|
+
def test_get_cycle_emissions_calculation_status(mock_, folder: str):
|
|
18
23
|
with open(
|
|
19
24
|
os.path.join(fixtures_folder, folder, "node.jsonld"), encoding="utf-8"
|
|
20
25
|
) as f:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.16.15"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/calculation_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/descriptive_stats.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/lookup_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pivot/__init__.py
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pivot/pivot_csv.py
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/pivot/pivot_json.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/storage/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/hestia_earth/utils/storage/_s3_client.py
RENAMED
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/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.15 → hestia_earth_utils-0.16.16}/hestia_earth_utils.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{hestia_earth_utils-0.16.15 → hestia_earth_utils-0.16.16}/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
|