hestia-earth-utils 0.15.9__tar.gz → 0.15.10__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 (44) hide show
  1. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/PKG-INFO +1 -1
  2. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/emission.py +2 -0
  3. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/lookup_utils.py +15 -0
  4. hestia_earth_utils-0.15.10/hestia_earth/utils/version.py +1 -0
  5. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth_utils.egg-info/PKG-INFO +1 -1
  6. hestia_earth_utils-0.15.9/hestia_earth/utils/version.py +0 -1
  7. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/MANIFEST.in +0 -0
  8. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/README.md +0 -0
  9. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/bin/hestia-format-upload +0 -0
  10. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/bin/hestia-pivot-csv +0 -0
  11. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/__init__.py +0 -0
  12. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/__init__.py +0 -0
  13. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/api.py +0 -0
  14. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/blank_node.py +0 -0
  15. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/calculation_status.py +0 -0
  16. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/cycle.py +0 -0
  17. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/date.py +0 -0
  18. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/descriptive_stats.py +0 -0
  19. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/lookup.py +0 -0
  20. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/model.py +0 -0
  21. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/pipeline.py +0 -0
  22. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/pivot/__init__.py +0 -0
  23. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/pivot/_shared.py +0 -0
  24. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/pivot/pivot_csv.py +0 -0
  25. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/pivot/pivot_json.py +0 -0
  26. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/request.py +0 -0
  27. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/stats.py +0 -0
  28. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/storage/__init__.py +0 -0
  29. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/storage/_azure_client.py +0 -0
  30. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/storage/_local_client.py +0 -0
  31. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/storage/_s3_client.py +0 -0
  32. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/storage/_sns_client.py +0 -0
  33. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/table.py +0 -0
  34. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/term.py +0 -0
  35. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth/utils/tools.py +0 -0
  36. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth_utils.egg-info/SOURCES.txt +0 -0
  37. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth_utils.egg-info/dependency_links.txt +0 -0
  38. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth_utils.egg-info/requires.txt +0 -0
  39. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/hestia_earth_utils.egg-info/top_level.txt +0 -0
  40. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/setup.cfg +0 -0
  41. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/setup.py +0 -0
  42. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/tests/pivot/__init__.py +0 -0
  43. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/tests/pivot/test_pivot_csv.py +0 -0
  44. {hestia_earth_utils-0.15.9 → hestia_earth_utils-0.15.10}/tests/pivot/test_pivot_json.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hestia_earth_utils
3
- Version: 0.15.9
3
+ Version: 0.15.10
4
4
  Summary: HESTIA's utils library
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-utils
6
6
  Author: HESTIA Team
@@ -5,6 +5,7 @@ from .lookup import download_lookup, lookup_term_ids
5
5
  from .lookup_utils import (
6
6
  is_in_system_boundary,
7
7
  is_siteType_allowed,
8
+ is_site_measurement_id_allowed,
8
9
  is_product_termType_allowed,
9
10
  is_product_id_allowed,
10
11
  is_input_termType_allowed,
@@ -30,6 +31,7 @@ def cycle_emission_is_in_system_boundary(cycle: dict):
30
31
  def filter_term(term_id: str):
31
32
  return is_in_system_boundary(term_id) and all(map(lambda check: check(cycle, term_id), [
32
33
  is_siteType_allowed,
34
+ is_site_measurement_id_allowed,
33
35
  is_product_termType_allowed,
34
36
  is_product_id_allowed,
35
37
  is_input_termType_allowed,
@@ -30,6 +30,11 @@ def _get_site_types(node: dict):
30
30
  return non_empty_list([site.get('siteType') for site in sites])
31
31
 
32
32
 
33
+ def _get_site_measurements(node: dict):
34
+ sites = [node] if _is_site(node) else _get_sites(node)
35
+ return non_empty_list([site.get('measurements', []) for site in sites])
36
+
37
+
33
38
  @lru_cache()
34
39
  def _allowed_model_mapping(model: str, term_id: str, column: str):
35
40
  mapping = _allowed_mapping_data()
@@ -76,6 +81,16 @@ def is_siteType_allowed(data: dict, term_id: str):
76
81
  ])
77
82
 
78
83
 
84
+ def is_site_measurement_id_allowed(data: dict, term_id: str):
85
+ measurements = _get_site_measurements(data)
86
+ values = non_empty_list([v.get('term', {}).get('@id') for v in measurements])
87
+ allowed_values = _allowed_mapping(term_id, 'siteMeasurementIdsAllowed')
88
+ return True if any([
89
+ _ALLOW_ALL in allowed_values,
90
+ len(values) == 0
91
+ ]) else any([value in allowed_values for value in values])
92
+
93
+
79
94
  def is_product_termType_allowed(data: dict, term_id: str):
80
95
  products = data.get('products', [])
81
96
  values = non_empty_list([p.get('term', {}).get('termType') for p in products])
@@ -0,0 +1 @@
1
+ VERSION = '0.15.10'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hestia-earth-utils
3
- Version: 0.15.9
3
+ Version: 0.15.10
4
4
  Summary: HESTIA's utils library
5
5
  Home-page: https://gitlab.com/hestia-earth/hestia-utils
6
6
  Author: HESTIA Team
@@ -1 +0,0 @@
1
- VERSION = '0.15.9'