From 65086be1cd848a61561043ba0c8e3ad14f639122 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 10 Jul 2020 10:25:08 +0100 Subject: [PATCH] Remove last traces of 'BPC' output code close #576 --- commodity.py | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/commodity.py b/commodity.py index 87733f09..fec7d2b7 100644 --- a/commodity.py +++ b/commodity.py @@ -14,24 +14,21 @@ bracketmap = { 3: 'High', } -(COMMODITY_DEFAULT, COMMODITY_BPC, COMMODITY_CSV) = range(3) +# DEFAULT means semi-colon separation +# CSV means comma separation +(COMMODITY_DEFAULT, COMMODITY_CSV) = range(2) def export(data, kind=COMMODITY_DEFAULT, filename=None): querytime = config.getint('querytime') or int(time.time()) if not filename: - kind_str = 'bpc' - if kind != COMMODITY_BPC: - kind_str = 'csv' - filename = '{system}.{starport}.{time}.{kind}'.format( system=data['lastSystem']['name'].strip(), starport=data['lastStarport']['name'].strip(), time=time.strftime('%Y-%m-%dT%H.%M.%S', time.localtime(querytime)), - kind=kind_str + kind='csv' ) - filename = join(config.get('outdir'), filename) if kind == COMMODITY_CSV: @@ -39,20 +36,6 @@ def export(data, kind=COMMODITY_DEFAULT, filename=None): header = sep.join(('System', 'Station', 'Commodity', 'Sell', 'Buy', 'Demand', '', 'Supply', '', 'Date', '\n')) rowheader = sep.join((data['lastSystem']['name'], data['lastStarport']['name'])) - elif kind == COMMODITY_BPC: - sep = ';' - header = sep.join( - ('userID', 'System', 'Station', 'Commodity', 'Sell', 'Buy', 'Demand', '', 'Supply', '', 'Date\n') - ) - - cmdr = data['commander']['name'].strip() - - header_cmdr = cmdr - if sep in cmdr: - header_cmdr = f'"{cmdr}"' - - rowheader = sep.join((header_cmdr, data['lastSystem']['name'], data['lastStarport']['name'])) - else: sep = ',' header = sep.join(