Skip to content

Commit cd5ba17

Browse files
committed
fix left value
1 parent d90475a commit cd5ba17

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

absbox/client.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ def run(self, deal,
375375
if result is None or 'error' in result or 'Left' in result:
376376
leftVal = result.get("Left","")
377377
raise AbsboxError(f"❌{MsgColor.Error.value}Failed to get response from run: {leftVal}")
378-
print(result)
379378
result = result['Right']
380379
rawWarnMsg = map( lambda x:f"{MsgColor.Warning.value}{x['contents']}", filter_by_tags(result[RunResp.LogResp.value], enumVals(ValidationMsg)))
381380
if rawWarnMsg and showWarning:
@@ -422,7 +421,7 @@ def runByScenarios(self, deal,
422421
result = self._send_req(req, url, timeout=30)
423422

424423
if result is None or 'error' in result or "Left" in set(tz.concat([ _.keys() for _ in result.values()])):
425-
leftVal = result.get("Left","")
424+
leftVal = { k:v['Left'] for k,v in result.items() if "Left" in v }
426425
raise AbsboxError(f"❌{MsgColor.Error.value}Failed to get response from run: {leftVal}")
427426

428427
result = tz.valmap(lambda x:x['Right'] ,result)
@@ -477,7 +476,7 @@ def runPoolByScenarios(self, pool, poolAssump, rateAssump=None, read=True, debug
477476
result = self._send_req(req, url)
478477

479478
if result is None or 'error' in result or "Left" in set(tz.concat([ _.keys() for _ in result.values()])):
480-
leftVal = result.get("Left","")
479+
leftVal = { k:v['Left'] for k,v in result.items() if "Left" in v }
481480
raise AbsboxError(f"❌{MsgColor.Error.value}Failed to get response from run: {leftVal}")
482481

483482
result = tz.valmap(lambda x:x['Right'] ,result)
@@ -559,7 +558,7 @@ def runStructs(self, deals, poolAssump=None, nonPoolAssump=None, runAssump=None,
559558
result = self._send_req(req, url)
560559

561560
if result is None or 'error' in result or "Left" in set(tz.concat([ _.keys() for _ in result.values()])):
562-
leftVal = result.get("Left","")
561+
leftVal = { k:v['Left'] for k,v in result.items() if "Left" in v }
563562
raise AbsboxError(f"❌{MsgColor.Error.value}Failed to get response from run: {leftVal}")
564563

565564
result = tz.valmap(lambda x:x['Right'] ,result)
@@ -602,7 +601,7 @@ def runByDealScenarios(self, deal,
602601
result = self._send_req(req, url, timeout=30)
603602

604603
if result is None or 'error' in result or "Left" in set(tz.concat([ _.keys() for _ in result.values()])):
605-
604+
leftVal = { k:v['Left'] for k,v in result.items() if "Left" in v }
606605
raise AbsboxError(f"❌{MsgColor.Error.value}Failed to get response from run: {leftVal}")
607606

608607
result = tz.valmap(lambda x:x['Right'] ,result)
@@ -655,7 +654,7 @@ def runByCombo(self,
655654
result = self._send_req(req, url, timeout=30)
656655

657656
if result is None or 'error' in result or "Left" in set(tz.concat([ _.keys() for _ in result.values()])):
658-
leftVal = result.get("Left","")
657+
leftVal = { k:v['Left'] for k,v in result.items() if "Left" in v }
659658
raise AbsboxError(f"❌{MsgColor.Error.value}Failed to get response from run: {leftVal}")
660659

661660
result = tz.valmap(lambda x:x['Right'] ,result)

absbox/report.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from htpy import body, h1, head, html, li, title, ul, div, span, h3, h2, a
66
from markupsafe import Markup
77
from absbox import readInspect
8-
from absbox import readBondsCf,readFeesCf,readAccsCf
8+
from absbox import readBondsCf,readFeesCf,readAccsCf,readPoolsCf
99

1010

1111
class OutputType(int, enum.Enum):
@@ -25,8 +25,7 @@ def singleToMap(x,defaultName = "Consol")->dict:
2525
def mapToList(m:dict,anchor=False):
2626
m2 = {}
2727
if not anchor:
28-
m2 = {h3[k]:div[Markup(v.to_html())]
29-
for k,v in m.items() }
28+
m2 = {h3[k]:div[Markup(v.to_html())] for k,v in m.items() }
3029
else:
3130
m2 = {h3(id=f"anchor-{anchor}-{k}")[k]:div[Markup(v.to_html())]
3231
for k,v in m.items() }
@@ -62,7 +61,7 @@ def toHtml(r:dict, p:str, style=OutputType.Plain, debug=False):
6261

6362
# read joint cashflows
6463
seciont4 = [ div[ h2(id=f"anchor-{_t}")[_t],Markup(x.to_html()) ]
65-
for (_t,x) in [("MultiFee",readFeesCf(feeDf)),("MultiBond",readBondsCf(bondDf,popColumns=[])),("MultiAccounts",readAccsCf(accDf))]
64+
for (_t,x) in [("MultiFee",readFeesCf(feeDf)),("MultiBond",readBondsCf(bondDf,popColumns=[])),("MultiAccounts",readAccsCf(accDf)),("MultiPools", readPoolsCf(poolDf))]
6665
]
6766

6867
c = html[

0 commit comments

Comments
 (0)