antelope-interface 0.2.4__tar.gz → 0.2.5__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.4/src/antelope_interface.egg-info → antelope_interface-0.2.5}/PKG-INFO +1 -1
  2. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/pyproject.toml +1 -1
  3. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/setup.py +2 -0
  4. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/exchanges_from_spreadsheet.py +5 -0
  5. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/abstract_query.py +2 -1
  6. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/ibackground.py +3 -4
  7. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/ibasic.py +12 -0
  8. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/models/__init__.py +10 -5
  9. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/process_ref.py +4 -1
  10. {antelope_interface-0.2.4 → antelope_interface-0.2.5/src/antelope_interface.egg-info}/PKG-INFO +1 -1
  11. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/LICENSE +0 -0
  12. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/MANIFEST.in +0 -0
  13. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/README.md +0 -0
  14. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/setup.cfg +0 -0
  15. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/__init__.py +0 -0
  16. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/flows/__init__.py +0 -0
  17. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/flows/flow.py +0 -0
  18. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/flows/flow_interface.py +0 -0
  19. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/flows/openlca_locales.json +0 -0
  20. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/__init__.py +0 -0
  21. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/iconfigure.py +0 -0
  22. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/iexchange.py +0 -0
  23. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/iforeground.py +0 -0
  24. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/iindex.py +0 -0
  25. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/interfaces/iquantity.py +0 -0
  26. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/models/auth.py +0 -0
  27. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/__init__.py +0 -0
  28. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/base.py +0 -0
  29. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/catalog_ref.py +0 -0
  30. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/exchange_ref.py +0 -0
  31. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/flow_ref.py +0 -0
  32. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/quantity_ref.py +0 -0
  33. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/tests/__init__.py +0 -0
  34. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/refs/tests/test_flows.py +0 -0
  35. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope/xdb_tokens.py +0 -0
  36. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope_interface.egg-info/SOURCES.txt +0 -0
  37. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope_interface.egg-info/dependency_links.txt +0 -0
  38. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/src/antelope_interface.egg-info/requires.txt +0 -0
  39. {antelope_interface-0.2.4 → antelope_interface-0.2.5}/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.4
3
+ Version: 0.2.5
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.4"
25
+ version = "0.2.5"
26
26
 
27
27
  [tool.setuptools.packages.find]
28
28
  where = ["src"]
@@ -5,6 +5,8 @@ setup()
5
5
 
6
6
  """
7
7
  Version History:
8
+ 0.2.5 2024/05/06 - bg_lcia() becomes a basic interface route; sys_lcia() is the fully-featured background route
9
+
8
10
  0.2.4 2024/04/17 - split out BasicInterface from AbstractQuery.
9
11
  abandon setup.py except for this changelog.
10
12
  Redesign ExteriorFlow to have maybe a little bit more logic
@@ -1,11 +1,15 @@
1
1
  """
2
2
  This module provides a routine that generates a list of exchange refs from a properly formatted spreadsheet
3
3
  """
4
+
4
5
  from .refs import CatalogRef, ExchangeRef
5
6
  from .interfaces import check_direction
6
7
 
7
8
 
8
9
  class ValueIsBalance(Exception):
10
+ """
11
+ Used to signal when an exchange is reached that is designated as a balance.
12
+ """
9
13
  pass
10
14
 
11
15
 
@@ -93,6 +97,7 @@ def exchanges_from_spreadsheet(sheetlike, term_dict=None, node=None, origin=None
93
97
  - row(0) returns a header list
94
98
  - row(1) is the process's reference flow
95
99
  - subsequent rows are dependent flows
100
+
96
101
  !TODO: support multiple references with is_ref or is_reference field
97
102
 
98
103
  "entries" in the row() return must be "cell-like":
@@ -15,7 +15,8 @@ class PrivateArchive(Exception):
15
15
 
16
16
 
17
17
  class AbstractQuery(object):
18
- """ Not-quite-abstract base class for executing queries
18
+ """
19
+ Not-quite-abstract base class for executing queries
19
20
 
20
21
  Query implementation must provide:
21
22
  - origin (property)
@@ -20,7 +20,6 @@ More plugins are yet imagined.
20
20
 
21
21
  from .abstract_query import AbstractQuery
22
22
  from ..refs import ExchangeRef
23
- from itertools import chain
24
23
 
25
24
 
26
25
  class BackgroundRequired(Exception):
@@ -136,7 +135,7 @@ class BackgroundInterface(AbstractQuery):
136
135
  process, ref_flow=ref_flow, **kwargs)
137
136
 
138
137
  def _make_sys_lci_exchange(self, x):
139
- return ExchangeRef(self.get(x.process), self.make_ref(x.flow), x.direction, value=x.value,
138
+ return ExchangeRef(self.make_ref(x.process), self.make_ref(x.flow), x.direction, value=x.value,
140
139
  termination=x.termination, comment='SYS LCI', is_reference=False)
141
140
 
142
141
  def sys_lci(self, demand, **kwargs):
@@ -160,7 +159,7 @@ class BackgroundInterface(AbstractQuery):
160
159
  for i in self._perform_query(_interface, 'sys_lci', BackgroundRequired, demand, **kwargs):
161
160
  yield self._make_sys_lci_exchange(i)
162
161
 
163
- def bg_lcia(self, process, query_qty, observed=None, ref_flow=None, **kwargs):
162
+ def sys_lcia(self, process, query_qty, observed=None, ref_flow=None, **kwargs):
164
163
  """
165
164
 
166
165
  :param process:
@@ -170,7 +169,7 @@ class BackgroundInterface(AbstractQuery):
170
169
  :param kwargs:
171
170
  :return:
172
171
  """
173
- return self._perform_query(_interface, 'bg_lcia', BackgroundRequired,
172
+ return self._perform_query(_interface, 'sys_lcia', BackgroundRequired,
174
173
  process, query_qty, observed=observed, ref_flow=ref_flow, **kwargs)
175
174
 
176
175
  '''
@@ -142,4 +142,16 @@ class BasicInterface(AbstractQuery):
142
142
  except TypeError:
143
143
  return False
144
144
 
145
+ def bg_lcia(self, process, query_qty=None, ref_flow=None, **kwargs):
146
+ """
147
+
148
+ :param process:
149
+ :param query_qty: if omitted, a catalog may select a default LCIA method
150
+ :param ref_flow:
151
+ :param kwargs:
152
+ :return:
153
+ """
154
+ return self._perform_query('basic', 'bg_lcia', BasicRequired,
155
+ process, query_qty, ref_flow=ref_flow, **kwargs)
156
+
145
157
 
@@ -287,6 +287,10 @@ class ExteriorFlow(DirectedFlow):
287
287
  """
288
288
  context: List[str]
289
289
 
290
+ @property
291
+ def termination(self):
292
+ return self.context
293
+
290
294
  @classmethod
291
295
  def from_background(cls, flow, direction, context):
292
296
  if hasattr(context, 'entity_type'):
@@ -341,7 +345,7 @@ class ReferenceExchange(Exchange):
341
345
  termination: None
342
346
 
343
347
  @classmethod
344
- def from_exchange(cls, x):
348
+ def from_exchange(cls, x, **kwargs):
345
349
  if x.termination is not None:
346
350
  cx = list(x.termination)
347
351
  else:
@@ -429,10 +433,11 @@ def generate_pydantic_inventory(xs, mode=None, values=False, ref_flow=None):
429
433
 
430
434
  :param xs: iterable of exchanges
431
435
  :param mode: [None] whether to filter the exchanges by type. could be one of:
432
- None: generate all exchanges
433
- 'interior'
434
- 'exterior'
435
- 'cutoff'
436
+ - None: generate all exchanges
437
+ - 'interior'
438
+ - 'exterior'
439
+ - 'cutoff'
440
+
436
441
  :param values: (bool) [False] whether to include exchange values.
437
442
  :param ref_flow: (ignored if values=False) the reference flow with which the exchange value was computed. If None,
438
443
  this implies the exchange reports un-allocated exchange values
@@ -315,4 +315,7 @@ class ProcessRef(EntityRef):
315
315
  :return:
316
316
  """
317
317
  ref_flow = self._use_ref_exch(ref_flow)
318
- return self._query.bg_lcia(self.external_ref, lcia_qty, observed=observed, ref_flow=ref_flow, **kwargs)
318
+ if observed:
319
+ return self._query.sys_lcia(self.external_ref, lcia_qty, observed=observed, ref_flow=ref_flow, **kwargs)
320
+ else:
321
+ return self._query.bg_lcia(self.external_ref, lcia_qty, ref_flow=ref_flow, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: antelope_interface
3
- Version: 0.2.4
3
+ Version: 0.2.5
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