def parse_bandwidth(bandwidth_lines_list, server_vers):
    if server_vers == 'Five':
        #2015-09-22 10:23:03.737 #o13uUhWMyXek Served all 3.2 MB of 3.2 MB; 0 bytes from cache, 3.2 MB stored from Internet, 0 bytes from peers
        daily_total_from_cache, daily_total_from_apple, peer_amount = 0.0, 0.0, 0.0
        for each in bandwidth_lines_list:
            if each[14] != '0':
                if each[15] != 'GB':
                    this_loops_fromapple = float(each[14]) / 1024
                elif each[15] == 'GB':
                    this_loops_fromapple = float(each[14])
                daily_total_from_apple += this_loops_fromapple
            elif each[19] != '0':
                if each[20] != 'GB':
                    peer_amount += float(each[19]) / 1024
            elif each[10] != '0':
                if each[11] != 'GB':
                    daily_total_from_cache += float(each[10]) / 1024
                elif each[11] == 'GB':
                    daily_total_from_cache += float(each[10])
        if peer_amount == 0.0:
            peer_amount = 'no peer servers detected'
        else:
            peer_amount = 'along with %s from peers' % gen_mb_or_gb(peer_amount)
    else:
        logged_bytes_from_cache, logged_bytes_from_apple, logged_bytes_from_peers = [], [], []
        for each in bandwidth_lines_list:
            strip_parens = (each[15])[1:] # silly log line cleanup
            logged_bytes_from_cache.append(normalize_gbs(each[6], each[5]))
            logged_bytes_from_apple.append(normalize_gbs(each[16], strip_parens))
            if not each[19] == '0':
                logged_bytes_from_peers.append(normalize_gbs(each[20], each[19]))
        daily_total_from_cache = alice(logged_bytes_from_cache)
        daily_total_from_apple = alice(logged_bytes_from_apple)
        # check for peers, set default
        peer_amount = 'no peer servers detected'
        if len(logged_bytes_from_peers) > 1:
            if max(logged_bytes_from_peers) > 0.1:
                daily_total_from_peers = alice(logged_bytes_from_peers)
                daily_total_from_apple = daily_total_from_apple - daily_total_from_peers
                peer_amount = 'along with %s from peers' % gen_mb_or_gb(daily_total_from_peers)
    return daily_total_from_cache, daily_total_from_apple, peer_amount
Read an arff file.
dataset/ETHPy150Open macadmins/sashay/sashay.py/parse_bandwidth--crossover with--dataset/ETHPy150Open scipy/scipy/scipy/io/arff/arffread.py/loadarff