antelope-interface 0.3.2__tar.gz → 0.3.3__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 (43) hide show
  1. {antelope_interface-0.3.2/src/antelope_interface.egg-info → antelope_interface-0.3.3}/PKG-INFO +1 -1
  2. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/pyproject.toml +1 -1
  3. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/setup.py +2 -0
  4. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/exchange_ref.py +30 -0
  5. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/process_ref.py +33 -0
  6. {antelope_interface-0.3.2 → antelope_interface-0.3.3/src/antelope_interface.egg-info}/PKG-INFO +1 -1
  7. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/LICENSE +0 -0
  8. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/MANIFEST.in +0 -0
  9. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/README.md +0 -0
  10. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/setup.cfg +0 -0
  11. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/__init__.py +0 -0
  12. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/exchanges_from_spreadsheet.py +0 -0
  13. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/flows/__init__.py +0 -0
  14. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/flows/flow.py +0 -0
  15. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/flows/flow_interface.py +0 -0
  16. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/flows/openlca_locales.json +0 -0
  17. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/__init__.py +0 -0
  18. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/abstract_query.py +0 -0
  19. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/ibackground.py +0 -0
  20. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/ibasic.py +0 -0
  21. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/iconfigure.py +0 -0
  22. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/iexchange.py +0 -0
  23. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/iforeground.py +0 -0
  24. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/iindex.py +0 -0
  25. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/interfaces/iquantity.py +0 -0
  26. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/models/__init__.py +0 -0
  27. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/models/auth.py +0 -0
  28. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/models/comparators.py +0 -0
  29. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/qdb/__init__.py +0 -0
  30. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/qdb/qdb.py +0 -0
  31. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/qdb/units.py +0 -0
  32. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/__init__.py +0 -0
  33. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/base.py +0 -0
  34. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/catalog_ref.py +0 -0
  35. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/flow_ref.py +0 -0
  36. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/quantity_ref.py +0 -0
  37. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/tests/__init__.py +0 -0
  38. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/refs/tests/test_flows.py +0 -0
  39. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope/xdb_tokens.py +0 -0
  40. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope_interface.egg-info/SOURCES.txt +0 -0
  41. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope_interface.egg-info/dependency_links.txt +0 -0
  42. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope_interface.egg-info/requires.txt +0 -0
  43. {antelope_interface-0.3.2 → antelope_interface-0.3.3}/src/antelope_interface.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: antelope_interface
3
- Version: 0.3.2
3
+ Version: 0.3.3
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.3.2"
25
+ version = "0.3.3"
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.3.3 2025/09/08 - Apply ordering to exchange refs; pandas-friendly output for process refs
9
+
8
10
  0.3.2 2025/08/01 - 0.3.2 release. better background handling.
9
11
 
10
12
  0.3.1 2025/06/18 - 0.3.1 release. small tweaks to method signatures.
@@ -233,6 +233,36 @@ class ExchangeRef(object):
233
233
  except AttributeError:
234
234
  return False
235
235
 
236
+ def __lt__(self, other):
237
+ if EXCHANGE_TYPES.index(self.type) < EXCHANGE_TYPES.index(other.type):
238
+ return True
239
+ if self.type == other.type:
240
+ return (self.flow.external_ref, self.direction, self.value) < \
241
+ (other.flow.external_ref, other.direction, other.value)
242
+ return False
243
+
244
+ def __le__(self, other):
245
+ if self.__eq__(other):
246
+ return True
247
+ if self.__lt__(other):
248
+ return True
249
+ return False
250
+
251
+ def __gt__(self, other):
252
+ if EXCHANGE_TYPES.index(self.type) > EXCHANGE_TYPES.index(other.type):
253
+ return True
254
+ if self.type == other.type:
255
+ return (self.flow.external_ref, self.direction, self.value) > \
256
+ (other.flow.external_ref, other.direction, other.value)
257
+ return False
258
+
259
+ def __ge__(self, other):
260
+ if self.__eq__(other):
261
+ return True
262
+ if self.__gt__(other):
263
+ return True
264
+ return False
265
+
236
266
  @property
237
267
  def key(self):
238
268
  return self._hash
@@ -341,3 +341,36 @@ class ProcessRef(EntityRef):
341
341
  """
342
342
  ref_flow = self._use_ref_exch(ref_flow)
343
343
  return self._query.deep_lcia(self.external_ref, lcia_qty, ref_flow=ref_flow, detailed=detailed, **kwargs)
344
+
345
+ @property
346
+ def inventory_as_series(self):
347
+ """
348
+ Use this as generative input to pandas.Series:
349
+ s = pandas.Series(process_ref.inventory_as_series)
350
+ :return:
351
+ """
352
+ def _tx_cx(_ex):
353
+ if _ex.type == 'reference':
354
+ return '*'
355
+ elif _ex.type == 'node':
356
+ return '#'
357
+ elif _ex.type == 'context':
358
+ return _ex.termination.name
359
+ else:
360
+ return None
361
+ return {(k.flow.name, _tx_cx(k), k.direction, k.unit): k.value for k in self.inventory()}
362
+
363
+ @property
364
+ def inventory_as_dataframe(self):
365
+ """
366
+ Use this as generative input to pandas.DataFrame:
367
+ df = pandas.DataFrame(process_ref.inventory_as_dataframe)
368
+ :return:
369
+ """
370
+ def _cx_of(_ex):
371
+ if _ex.type == 'context':
372
+ return _ex.termination.name
373
+ return None
374
+ for k in self.inventory():
375
+ yield {'Flow': k.flow.name, 'Direction': k.direction, 'Type': k.type, 'Unit': k.flow.unit,
376
+ 'Value': k.value, 'Context': _cx_of(k)}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: antelope_interface
3
- Version: 0.3.2
3
+ Version: 0.3.3
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