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.
Files changed (57) hide show
  1. {hestia_earth_utils-0.16.10/hestia_earth_utils.egg-info → hestia_earth_utils-0.16.11}/PKG-INFO +1 -1
  2. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/blank_node.py +0 -1
  3. hestia_earth_utils-0.16.11/hestia_earth/utils/version.py +1 -0
  4. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11/hestia_earth_utils.egg-info}/PKG-INFO +1 -1
  5. hestia_earth_utils-0.16.11/tests/test_blank_node.py +73 -0
  6. hestia_earth_utils-0.16.10/hestia_earth/utils/version.py +0 -1
  7. hestia_earth_utils-0.16.10/tests/test_blank_node.py +0 -59
  8. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/MANIFEST.in +0 -0
  9. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/README.md +0 -0
  10. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/bin/hestia-format-upload +0 -0
  11. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/bin/hestia-pivot-csv +0 -0
  12. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/__init__.py +0 -0
  13. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/api.py +0 -0
  14. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/calculation_status.py +0 -0
  15. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/cycle.py +0 -0
  16. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/date.py +0 -0
  17. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/descriptive_stats.py +0 -0
  18. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/emission.py +0 -0
  19. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/lookup.py +0 -0
  20. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/lookup_utils.py +0 -0
  21. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/model.py +0 -0
  22. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pipeline.py +0 -0
  23. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/__init__.py +0 -0
  24. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/_shared.py +0 -0
  25. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/pivot_csv.py +0 -0
  26. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/pivot/pivot_json.py +0 -0
  27. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/request.py +0 -0
  28. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/stats.py +0 -0
  29. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/__init__.py +0 -0
  30. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_azure_client.py +0 -0
  31. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_local_client.py +0 -0
  32. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_s3_client.py +0 -0
  33. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/storage/_sns_client.py +0 -0
  34. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/table.py +0 -0
  35. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/term.py +0 -0
  36. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth/utils/tools.py +0 -0
  37. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/SOURCES.txt +0 -0
  38. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/dependency_links.txt +0 -0
  39. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/requires.txt +0 -0
  40. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/hestia_earth_utils.egg-info/top_level.txt +0 -0
  41. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/setup.cfg +0 -0
  42. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/setup.py +0 -0
  43. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_api.py +0 -0
  44. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_calculation_status.py +0 -0
  45. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_cycle.py +0 -0
  46. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_date.py +0 -0
  47. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_descriptive_stats.py +0 -0
  48. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_emission.py +0 -0
  49. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_lookup.py +0 -0
  50. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_lookup_utils.py +0 -0
  51. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_model.py +0 -0
  52. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_pipeline.py +0 -0
  53. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_request.py +0 -0
  54. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_stats.py +0 -0
  55. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_table.py +0 -0
  56. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/tests/test_term.py +0 -0
  57. {hestia_earth_utils-0.16.10 → hestia_earth_utils-0.16.11}/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.10
3
+ Version: 0.16.11
4
4
  Summary: HESTIA's utils library
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-utils
6
6
  Author: HESTIA Team
@@ -176,7 +176,6 @@ def get_node_value(
176
176
  isinstance(value, float),
177
177
  isinstance(value, int),
178
178
  isinstance(value, bool),
179
- value is None,
180
179
  ]
181
180
  )
182
181
  else default if not non_empty_value(value) else value
@@ -0,0 +1 @@
1
+ VERSION = "0.16.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hestia_earth_utils
3
- Version: 0.16.10
3
+ Version: 0.16.11
4
4
  Summary: HESTIA's utils library
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-utils
6
6
  Author: HESTIA Team
@@ -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