antelope-interface 0.2.6__tar.gz → 0.2.6.2__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 (39) hide show
  1. {antelope_interface-0.2.6/src/antelope_interface.egg-info → antelope_interface-0.2.6.2}/PKG-INFO +1 -1
  2. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/pyproject.toml +1 -1
  3. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/setup.py +3 -0
  4. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/__init__.py +1 -1
  5. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/__init__.py +1 -1
  6. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/ibackground.py +12 -0
  7. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/ibasic.py +18 -1
  8. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/iindex.py +2 -1
  9. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/base.py +5 -5
  10. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/process_ref.py +13 -0
  11. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2/src/antelope_interface.egg-info}/PKG-INFO +1 -1
  12. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/LICENSE +0 -0
  13. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/MANIFEST.in +0 -0
  14. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/README.md +0 -0
  15. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/setup.cfg +0 -0
  16. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/exchanges_from_spreadsheet.py +0 -0
  17. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/flows/__init__.py +0 -0
  18. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/flows/flow.py +0 -0
  19. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/flows/flow_interface.py +0 -0
  20. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/flows/openlca_locales.json +0 -0
  21. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/abstract_query.py +0 -0
  22. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/iconfigure.py +0 -0
  23. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/iexchange.py +0 -0
  24. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/iforeground.py +0 -0
  25. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/interfaces/iquantity.py +0 -0
  26. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/models/__init__.py +0 -0
  27. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/models/auth.py +0 -0
  28. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/__init__.py +0 -0
  29. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/catalog_ref.py +0 -0
  30. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/exchange_ref.py +0 -0
  31. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/flow_ref.py +0 -0
  32. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/quantity_ref.py +0 -0
  33. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/tests/__init__.py +0 -0
  34. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/refs/tests/test_flows.py +0 -0
  35. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope/xdb_tokens.py +0 -0
  36. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope_interface.egg-info/SOURCES.txt +0 -0
  37. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope_interface.egg-info/dependency_links.txt +0 -0
  38. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope_interface.egg-info/requires.txt +0 -0
  39. {antelope_interface-0.2.6 → antelope_interface-0.2.6.2}/src/antelope_interface.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: antelope_interface
3
- Version: 0.2.6
3
+ Version: 0.2.6.2
4
4
  Summary: A common interface for accessing LCA data
5
5
  Author-email: Brandon Kuczenski <bkuczenski@ucsb.edu>
6
6
  License: BSD-3-Clause
@@ -22,7 +22,7 @@ classifiers = [
22
22
  "Topic :: Scientific/Engineering"
23
23
  ]
24
24
  dependencies = ["synonym_dict >= 0.2.4", "pydantic >= 2.5.0"]
25
- version = "0.2.6"
25
+ version = "0.2.6.2"
26
26
 
27
27
  [tool.setuptools.packages.find]
28
28
  where = ["src"]
@@ -5,6 +5,9 @@ setup()
5
5
 
6
6
  """
7
7
  Version History:
8
+ 0.2.6.2 2024/06/11 - get_context into basic interface
9
+ 0.2.6.1 2024/06/06 - ItemNotFound
10
+
8
11
  0.2.6 2024/05/29 - split_subfragment and fragments_with_flow into fg interface
9
12
  contrib_lcia is an exchange method
10
13
  un-resolved CatalogRefs can now return their replacement, if provided a query at instantiation
@@ -7,7 +7,7 @@ resource of some kind. The interfaces must be instantiated in order to be used.
7
7
 
8
8
  from .interfaces import ANTELOPE_INTERFACES
9
9
 
10
- from .interfaces.ibasic import BasicInterface, EntityNotFound, NoAccessToEntity
10
+ from .interfaces.ibasic import BasicInterface, EntityNotFound, NoAccessToEntity, ItemNotFound
11
11
  from .interfaces.iconfigure import ConfigureInterface
12
12
  from .interfaces.iexchange import ExchangeInterface, ExchangeRequired
13
13
  from .interfaces.iindex import IndexInterface, IndexRequired, directions, comp_dir, num_dir, check_direction, valid_sense, comp_sense
@@ -1,3 +1,3 @@
1
1
  from .abstract_query import ANTELOPE_INTERFACES
2
- from .ibasic import EntityNotFound, NoAccessToEntity
2
+ from .ibasic import EntityNotFound, NoAccessToEntity, ItemNotFound
3
3
  from .iindex import check_direction, InvalidDirection, InvalidSense
@@ -252,3 +252,15 @@ class BackgroundInterface(AbstractQuery):
252
252
  """
253
253
  return self._perform_query(_interface, 'bf', BackgroundRequired,
254
254
  process, ref_flow=ref_flow, **kwargs)
255
+
256
+ def deep_lcia(self, process, quantity_ref, ref_flow=None, **kwargs):
257
+ """
258
+ Performs LCIA at the A-matrix level
259
+ :param process:
260
+ :param quantity_ref: quantity's factors must be accessible to the background's index query
261
+ :param ref_flow:
262
+ :param kwargs:
263
+ :return:
264
+ """
265
+ return self._perform_query(_interface, 'deep_lcia', BackgroundRequired,
266
+ process, quantity_ref, ref_flow=ref_flow, **kwargs)
@@ -30,6 +30,13 @@ class NoAccessToEntity(Exception):
30
30
  pass
31
31
 
32
32
 
33
+ class ItemNotFound(Exception):
34
+ """
35
+ not a KeyError
36
+ """
37
+ pass
38
+
39
+
33
40
  class BasicInterface(AbstractQuery):
34
41
  """
35
42
  BasicInterface core methods.
@@ -95,13 +102,23 @@ class BasicInterface(AbstractQuery):
95
102
  :param item: the desired property
96
103
  :return:
97
104
  """
98
- return self._perform_query('basic', 'get_item', EntityNotFound,
105
+ return self._perform_query('basic', 'get_item', ItemNotFound,
99
106
  external_ref, item)
100
107
 
101
108
  def get_uuid(self, external_ref):
102
109
  return self._perform_query('basic', 'get_uuid', EntityNotFound,
103
110
  external_ref)
104
111
 
112
+ def get_context(self, term, **kwargs):
113
+ """
114
+ Return the context matching the specified term
115
+ :param term:
116
+ :param kwargs:
117
+ :return:
118
+ """
119
+ return self._perform_query('basic', 'get_context', BasicRequired,
120
+ term, ** kwargs)
121
+
105
122
  def get_reference(self, external_ref):
106
123
  return self._perform_query('basic', 'get_reference', EntityNotFound,
107
124
  external_ref)
@@ -148,6 +148,7 @@ class IndexInterface(AbstractQuery):
148
148
  return self._perform_query(_interface, 'contexts', IndexRequired,
149
149
  ** kwargs)
150
150
 
151
+ '''
151
152
  def get_context(self, term, **kwargs):
152
153
  """
153
154
  Return the context matching the specified term
@@ -157,7 +158,7 @@ class IndexInterface(AbstractQuery):
157
158
  """
158
159
  return self._perform_query(_interface, 'get_context', IndexRequired,
159
160
  term, ** kwargs)
160
-
161
+ '''
161
162
  def quantities(self, **kwargs):
162
163
  """
163
164
  Generate quantities
@@ -33,7 +33,7 @@ The CatalogRef can instantiate a grounded reference if supplied with a query obj
33
33
  from synonym_dict import LowerDict
34
34
 
35
35
  from ..flows import BaseEntity
36
- from ..interfaces import NoAccessToEntity, EntityNotFound
36
+ from ..interfaces import NoAccessToEntity, EntityNotFound, ItemNotFound
37
37
 
38
38
  import re
39
39
 
@@ -416,12 +416,12 @@ class EntityRef(BaseRef):
416
416
  raise
417
417
  try:
418
418
  val = lit.get_item(item)
419
- except KeyError:
419
+ except ItemNotFound:
420
420
  self._d[item] = _MissingItem
421
- raise
422
- except KeyError:
421
+ raise KeyError(item)
422
+ except ItemNotFound:
423
423
  self._d[item] = _MissingItem
424
- raise
424
+ raise KeyError(item)
425
425
  # we used to catch '' too but this is ng- remote will think it's a property but local will raise MissingItem
426
426
  if val is not None: # and val != ''
427
427
  self._d[item] = val
@@ -323,3 +323,16 @@ class ProcessRef(EntityRef):
323
323
  return self._query.sys_lcia(self.external_ref, lcia_qty, observed=observed, ref_flow=ref_flow, **kwargs)
324
324
  else:
325
325
  return self._query.bg_lcia(self.external_ref, lcia_qty, ref_flow=ref_flow, **kwargs)
326
+
327
+ def deep_lcia(self, lcia_qty, ref_flow=None, detailed=False, **kwargs):
328
+ """
329
+ Perform LCIA inside the black box, returning an LCIA result whose components are background processes.
330
+ :param lcia_qty:
331
+ :param ref_flow:
332
+ :param detailed: [False] default- report only summaries. [True] - include full details for each component. This
333
+ can be very data intensive. (approx
334
+ :param kwargs:
335
+ :return:
336
+ """
337
+ ref_flow = self._use_ref_exch(ref_flow)
338
+ return self._query.deep_lcia(self.external_ref, lcia_qty, ref_flow=ref_flow, detailed=detailed, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: antelope_interface
3
- Version: 0.2.6
3
+ Version: 0.2.6.2
4
4
  Summary: A common interface for accessing LCA data
5
5
  Author-email: Brandon Kuczenski <bkuczenski@ucsb.edu>
6
6
  License: BSD-3-Clause