Spaces:
Sleeping
Sleeping
Update app.py
Browse files396 unmodified lines3973983994004014022 unmodified lines40540640740840941041141241373 unmodified lines487488489490491492124 unmodified lines61761861962062162298 unmodified lines72172272372472572630 unmodified lines75775875976076176251 unmodified lines814815816817818819820821822823824396 unmodified linestransfers = []for (s,b), w in TRANSFER_COUNTS.items():transfers.append((s, b, w))loops = []for a,c,w1 in buys:2 unmodified linesloops.append((a, c, b))loops = list({(a,c,b) for (a,c,b) in loops})return buys, sells, transfers, loopsBUYS, SELLS, TRANSFERS, LOOPS = build_flows()# ---------------------------# Inspector summaries73 unmodified linesconst SELLS = __SELLS__;const TRANSFERS = __TRANSFERS__;const LOOPS = __LOOPS__;function draw() {const container = document.getElementById("arc-container");124 unmodified lines.attr("data-tgt", tname);});const loopGroup = svg.append("g").attr("class", "loops");LOOPS.forEach(lp => {const a = lp[0], c = lp[1], b = lp[2];98 unmodified linesbuyGroup.selectAll("path").style("opacity", function(){ return isConn(this)?0.98:0.06; });sellGroup.selectAll("path").style("opacity", function(){ return isConn(this)?0.98:0.06; });transferGroup.selectAll("path").style("opacity", function(){ return isConn(this)?0.98:0.06; });loopGroup.selectAll("path").style("opacity", 0.9);}30 unmodified lines<b>Sells:</b> ${sells.length ? sells.join(", ") : "<span style='color:#777'>None</span>"}<br><b>Transfers:</b> ${transfers.length ? transfers.join(", ") : "<span style='color:#777'>None</span>"}<br><b>Loops:</b> ${loops.length ? loops.join(", ") : "<span style='color:#777'>None</span>"}</div>`;}51 unmodified linestransfers_json = json.dumps(transfers)loops_json = json.dumps(loops)html = JS_TEMPLATE.replace("__NODES__", nodes_json) \.replace("__NODE_TYPE__", node_type_json) \.replace("__BUYS__", buys_json) \.replace("__SELLS__", sells_json) \.replace("__TRANSFERS__", transfers_json) \.replace("__LOOPS__", loops_json)return htmlinitial_html = make_arc_html(NODES, NODE_TYPE, BUYS, SELLS, TRANSFERS, LOOPS)396 unmodified lines3973983994004014024034044054064072 unmodified lines41041141241341441541641741873 unmodified lines492493494495496497498124 unmodified lines62362462562662762862963063163263363463563663763863964064164264364464598 unmodified lines74474574674774874975075175275330 unmodified lines78478578678778878979079151 unmodified lines843844845846847848849850851852853854855396 unmodified linestransfers = []for (s,b), w in TRANSFER_COUNTS.items():transfers.append((s, b, w))fresh_buys = []for amc, comps in FRESH_BUY.items():for c in comps:fresh_buys.append((amc, c, 2)) # weight 2 or 3 as you preferloops = []for a,c,w1 in buys:2 unmodified linesloops.append((a, c, b))loops = list({(a,c,b) for (a,c,b) in loops})return buys, sells, transfers, loops,fresh_buysBUYS, SELLS, TRANSFERS, LOOPS,FRESH_BUYS_FLOW = build_flows()# ---------------------------# Inspector summaries73 unmodified linesconst SELLS = __SELLS__;const TRANSFERS = __TRANSFERS__;const LOOPS = __LOOPS__;const FRESH = __FRESH__;function draw() {const container = document.getElementById("arc-container");124 unmodified lines.attr("data-tgt", tname);});const freshGroup = svg.append("g").attr("class", "fresh");FRESH.forEach(f => {const a = f[0], c = f[1], wt = f[2];if (!(a in nameToIndex) || !(c in nameToIndex)) return;const s = nodePos[nameToIndex[a]];const t = nodePos[nameToIndex[c]];freshGroup.append("path").attr("d", bezierPath(s.x, s.y, t.x, t.y, true)).attr("fill", "none").attr("stroke", "#1abc9c") // teal color.attr("stroke-width", stroke(wt)).attr("opacity", 0.95).attr("data-src", a).attr("data-tgt", c);});const loopGroup = svg.append("g").attr("class", "loops");LOOPS.forEach(lp => {const a = lp[0], c = lp[1], b = lp[2];98 unmodified linesbuyGroup.selectAll("path").style("opacity", function(){ return isConn(this)?0.98:0.06; });sellGroup.selectAll("path").style("opacity", function(){ return isConn(this)?0.98:0.06; });transferGroup.selectAll("path").style("opacity", function(){ return isConn(this)?0.98:0.06; });freshGroup.selectAll("path").style("opacity", function(){return isConn(this) ? 0.98 : 0.06;});loopGroup.selectAll("path").style("opacity", 0.9);}30 unmodified lines<b>Sells:</b> ${sells.length ? sells.join(", ") : "<span style='color:#777'>None</span>"}<br><b>Transfers:</b> ${transfers.length ? transfers.join(", ") : "<span style='color:#777'>None</span>"}<br><b>Loops:</b> ${loops.length ? loops.join(", ") : "<span style='color:#777'>None</span>"}<span style="display:inline-block;width:12px;height:8px;background:#1abc9c;margin-right:6px;"></span> FRESH BUY (teal)</div>`;}51 unmodified linestransfers_json = json.dumps(transfers)loops_json = json.dumps(loops)html = JS_TEMPLATE.replace("__NODES__", nodes_json) \.replace("__NODE_TYPE__", node_type_json) \.replace("__BUYS__", buys_json) \.replace("__SELLS__", sells_json) \.replace("__TRANSFERS__", transfers_json) \.replace("__LOOPS__", loops_json) \.replace("__FRESH__", json.dumps(fresh_buys))return htmlinitial_html = make_arc_html(NODES, NODE_TYPE, BUYS, SELLS, TRANSFERS, LOOPS)
app.py+38-7