antelope-interface 0.2.5__tar.gz → 0.2.6__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.
- {antelope_interface-0.2.5/src/antelope_interface.egg-info → antelope_interface-0.2.6}/PKG-INFO +1 -1
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/pyproject.toml +1 -1
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/setup.py +4 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/__init__.py +4 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/ibasic.py +1 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/iexchange.py +14 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/iforeground.py +33 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/models/__init__.py +11 -9
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/catalog_ref.py +12 -3
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/process_ref.py +4 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6/src/antelope_interface.egg-info}/PKG-INFO +1 -1
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/LICENSE +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/MANIFEST.in +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/README.md +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/setup.cfg +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/exchanges_from_spreadsheet.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/flows/__init__.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/flows/flow.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/flows/flow_interface.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/flows/openlca_locales.json +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/__init__.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/abstract_query.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/ibackground.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/iconfigure.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/iindex.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/iquantity.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/models/auth.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/__init__.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/base.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/exchange_ref.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/flow_ref.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/quantity_ref.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/tests/__init__.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/refs/tests/test_flows.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/xdb_tokens.py +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope_interface.egg-info/SOURCES.txt +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope_interface.egg-info/dependency_links.txt +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope_interface.egg-info/requires.txt +0 -0
- {antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope_interface.egg-info/top_level.txt +0 -0
|
@@ -5,6 +5,10 @@ setup()
|
|
|
5
5
|
|
|
6
6
|
"""
|
|
7
7
|
Version History:
|
|
8
|
+
0.2.6 2024/05/29 - split_subfragment and fragments_with_flow into fg interface
|
|
9
|
+
contrib_lcia is an exchange method
|
|
10
|
+
un-resolved CatalogRefs can now return their replacement, if provided a query at instantiation
|
|
11
|
+
|
|
8
12
|
0.2.5 2024/05/06 - bg_lcia() becomes a basic interface route; sys_lcia() is the fully-featured background route
|
|
9
13
|
|
|
10
14
|
0.2.4 2024/04/17 - split out BasicInterface from AbstractQuery.
|
|
@@ -144,6 +144,7 @@ class BasicInterface(AbstractQuery):
|
|
|
144
144
|
|
|
145
145
|
def bg_lcia(self, process, query_qty=None, ref_flow=None, **kwargs):
|
|
146
146
|
"""
|
|
147
|
+
Basic interface permits cumulative LCIA scores to be retrieved, but only if values=True
|
|
147
148
|
|
|
148
149
|
:param process:
|
|
149
150
|
:param query_qty: if omitted, a catalog may select a default LCIA method
|
|
@@ -103,3 +103,17 @@ class ExchangeInterface(AbstractQuery):
|
|
|
103
103
|
"""
|
|
104
104
|
return self._perform_query(_interface, 'exchange_relation', ExchangeRequired,
|
|
105
105
|
process, ref_flow, exch_flow, direction, termination=termination, **kwargs)
|
|
106
|
+
|
|
107
|
+
def contrib_lcia(self, process, quantity=None, ref_flow=None, **kwargs):
|
|
108
|
+
"""
|
|
109
|
+
exchange interface provides the ability to perform a contribution analysis of a process's LCIA scores.
|
|
110
|
+
In core, this is accomplished with ephemeral fragments.
|
|
111
|
+
|
|
112
|
+
:param process:
|
|
113
|
+
:param quantity: if omitted, a catalog may select a default LCIA method
|
|
114
|
+
:param ref_flow:
|
|
115
|
+
:param kwargs:
|
|
116
|
+
:return:
|
|
117
|
+
"""
|
|
118
|
+
return self._perform_query(_interface, 'contrib_lcia', ExchangeRequired,
|
|
119
|
+
process, quantity, ref_flow, **kwargs)
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/iforeground.py
RENAMED
|
@@ -95,6 +95,39 @@ class ForegroundInterface(AbstractQuery):
|
|
|
95
95
|
"""
|
|
96
96
|
return self.make_ref(self._perform_query(_interface, 'child_flows', ForegroundRequired, fragment, **kwargs))
|
|
97
97
|
|
|
98
|
+
def fragments_with_flow(self, flow, direction=None,**kwargs):
|
|
99
|
+
"""
|
|
100
|
+
Generates fragments made with the specified flow, optionally filtering by direction, reference status, and
|
|
101
|
+
background status. For all three filters, the default None is to generate all fragments.
|
|
102
|
+
:param flow:
|
|
103
|
+
:param direction: [None | 'Input' | 'Output']
|
|
104
|
+
:param kwargs:
|
|
105
|
+
:return:
|
|
106
|
+
"""
|
|
107
|
+
return self._perform_query(_interface, 'fragments_with_flow', ForegroundRequired,
|
|
108
|
+
flow, direction=direction, **kwargs)
|
|
109
|
+
|
|
110
|
+
def split_subfragment(self, fragment, replacement=None, **kwargs):
|
|
111
|
+
"""
|
|
112
|
+
Given a non-reference fragment, split it off into a new reference fragment, and create a surrogate child
|
|
113
|
+
that terminates to it.
|
|
114
|
+
|
|
115
|
+
without replacement:
|
|
116
|
+
Old: ...parent-->fragment
|
|
117
|
+
New: ...parent-->surrogate#fragment; (fragment)
|
|
118
|
+
|
|
119
|
+
with replacement:
|
|
120
|
+
Old: ...parent-->fragment; (replacement)
|
|
121
|
+
New: ...parent-->surrogate#replacement; (fragment); (replacement)
|
|
122
|
+
|
|
123
|
+
:param fragment:
|
|
124
|
+
:param replacement:
|
|
125
|
+
:param kwargs:
|
|
126
|
+
:return:
|
|
127
|
+
"""
|
|
128
|
+
return self._perform_query(_interface, 'split_subfragment', ForegroundRequired,
|
|
129
|
+
fragment, replacement=replacement, **kwargs)
|
|
130
|
+
|
|
98
131
|
def anchors(self, fragment, **kwargs):
|
|
99
132
|
"""
|
|
100
133
|
List observed anchors for a fragment
|
|
@@ -275,8 +275,8 @@ class DirectedFlow(ResponseModel):
|
|
|
275
275
|
return self.flow.flowable
|
|
276
276
|
|
|
277
277
|
@classmethod
|
|
278
|
-
def
|
|
279
|
-
return cls(flow=FlowSpec.
|
|
278
|
+
def from_observed(cls, obj):
|
|
279
|
+
return cls(flow=FlowSpec.from_flow(obj.flow), direction=obj.direction)
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
class ExteriorFlow(DirectedFlow):
|
|
@@ -305,7 +305,7 @@ class ExteriorFlow(DirectedFlow):
|
|
|
305
305
|
return cls(flow=FlowSpec.from_flow(flow), direction=direction, context=cx)
|
|
306
306
|
|
|
307
307
|
@classmethod
|
|
308
|
-
def
|
|
308
|
+
def from_exterior(cls, obj):
|
|
309
309
|
if obj.type == 'context':
|
|
310
310
|
context = obj.termination.as_list()
|
|
311
311
|
elif obj.type == 'cutoff':
|
|
@@ -317,7 +317,7 @@ class ExteriorFlow(DirectedFlow):
|
|
|
317
317
|
|
|
318
318
|
class Exchange(ResponseModel):
|
|
319
319
|
"""
|
|
320
|
-
Do we need to add locale??
|
|
320
|
+
Do we need to add locale?? no it's in the flow entity
|
|
321
321
|
"""
|
|
322
322
|
origin: str
|
|
323
323
|
process: str
|
|
@@ -337,7 +337,8 @@ class Exchange(ResponseModel):
|
|
|
337
337
|
term = x.termination
|
|
338
338
|
cx = None
|
|
339
339
|
return cls(origin=x.process.origin, process=x.process.external_ref, flow=FlowEntity.from_flow(x.flow),
|
|
340
|
-
direction=x.direction, termination=term, context=cx, type=x.type, comment=x.comment, str=str(x),
|
|
340
|
+
direction=x.direction, termination=term, context=cx, type=x.type, comment=x.comment, str=str(x),
|
|
341
|
+
**kwargs)
|
|
341
342
|
|
|
342
343
|
|
|
343
344
|
class ReferenceExchange(Exchange):
|
|
@@ -351,11 +352,12 @@ class ReferenceExchange(Exchange):
|
|
|
351
352
|
else:
|
|
352
353
|
cx = None
|
|
353
354
|
return cls(origin=x.process.origin, process=x.process.external_ref, flow=FlowEntity.from_flow(x.flow),
|
|
354
|
-
direction=x.direction, termination=None, context=cx, type=x.type, comment=x.comment, str=str(x)
|
|
355
|
+
direction=x.direction, termination=None, context=cx, type=x.type, comment=x.comment, str=str(x),
|
|
356
|
+
**kwargs)
|
|
355
357
|
|
|
356
358
|
|
|
357
359
|
class ReferenceValue(ReferenceExchange):
|
|
358
|
-
value: float
|
|
360
|
+
value: float = 0.0
|
|
359
361
|
|
|
360
362
|
@classmethod
|
|
361
363
|
def from_rx(cls, x):
|
|
@@ -609,13 +611,13 @@ class SummaryLciaScore(AggregatedLciaScore):
|
|
|
609
611
|
|
|
610
612
|
|
|
611
613
|
class LciaDetail(ResponseModel):
|
|
612
|
-
exchange: Optional[
|
|
614
|
+
exchange: Optional[ExteriorFlow]
|
|
613
615
|
factor: QuantityConversion
|
|
614
616
|
result: float
|
|
615
617
|
|
|
616
618
|
@classmethod
|
|
617
619
|
def from_detailed_lcia_result(cls, d):
|
|
618
|
-
return cls(exchange=
|
|
620
|
+
return cls(exchange=ExteriorFlow.from_exterior(d.exchange),
|
|
619
621
|
factor=QuantityConversion.from_qrresult(d.factor),
|
|
620
622
|
result=d.result)
|
|
621
623
|
|
|
@@ -3,7 +3,7 @@ The main import.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
from .base import BaseRef
|
|
6
|
+
from .base import BaseRef, InvalidQuery, NoCatalog
|
|
7
7
|
from .flow_ref import FlowRef
|
|
8
8
|
# from .fragment_ref import FragmentRef
|
|
9
9
|
from .process_ref import ProcessRef
|
|
@@ -66,7 +66,7 @@ class CatalogRef(BaseRef):
|
|
|
66
66
|
return QuantityRef(external_ref, query, **kwargs)
|
|
67
67
|
# elif etype == 'fragment':
|
|
68
68
|
# return FragmentRef(external_ref, query, reference_entity, **kwargs)
|
|
69
|
-
return cls(query.origin, external_ref, entity_type=etype, **kwargs)
|
|
69
|
+
return cls(query.origin, external_ref, entity_type=etype, query=query, **kwargs)
|
|
70
70
|
|
|
71
71
|
def __init__(self, origin, external_ref, entity_type=None, reference_entity=None, **kwargs):
|
|
72
72
|
"""
|
|
@@ -78,7 +78,7 @@ class CatalogRef(BaseRef):
|
|
|
78
78
|
"""
|
|
79
79
|
super(CatalogRef, self).__init__(origin, external_ref, **kwargs)
|
|
80
80
|
|
|
81
|
-
if 'Name' not in
|
|
81
|
+
if 'Name' not in self._d:
|
|
82
82
|
self['Name'] = self.link
|
|
83
83
|
|
|
84
84
|
self._asgn_etype = entity_type
|
|
@@ -143,3 +143,12 @@ class CatalogRef(BaseRef):
|
|
|
143
143
|
|
|
144
144
|
def cf(self, *args, **kwargs):
|
|
145
145
|
return 0.0
|
|
146
|
+
|
|
147
|
+
def resolve(self):
|
|
148
|
+
if self.has_property('query'):
|
|
149
|
+
try:
|
|
150
|
+
return self['query'].get(self.external_ref)
|
|
151
|
+
except InvalidQuery:
|
|
152
|
+
return self
|
|
153
|
+
else:
|
|
154
|
+
raise NoCatalog(self.origin)
|
|
@@ -306,6 +306,10 @@ class ProcessRef(EntityRef):
|
|
|
306
306
|
for i in lci:
|
|
307
307
|
yield self._to_exch_ref(i, i.value)
|
|
308
308
|
|
|
309
|
+
def contrib_lcia(self, quantity=None, ref_flow=None, **kwargs):
|
|
310
|
+
ref_flow = self._use_ref_exch(ref_flow)
|
|
311
|
+
return self._query.contrib_lcia(self.external_ref, quantity, ref_flow=ref_flow, **kwargs)
|
|
312
|
+
|
|
309
313
|
def bg_lcia(self, lcia_qty, observed=None, ref_flow=None, **kwargs):
|
|
310
314
|
"""
|
|
311
315
|
:param lcia_qty: should be a quantity ref (or qty), not an external ID
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/exchanges_from_spreadsheet.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/flows/openlca_locales.json
RENAMED
|
File without changes
|
|
File without changes
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/abstract_query.py
RENAMED
|
File without changes
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope/interfaces/ibackground.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{antelope_interface-0.2.5 → antelope_interface-0.2.6}/src/antelope_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|