<commit_before>#!/usr/bin/env python

import csv
import json

def disp_as(asn):
    if as_info.has_key(asn):
        trans_ref = as_trans.get(asn)
        if trans_ref == None:
            trans_info = [ '-', '-' ]
        else:
            trans_info = [ as_trans[asn]['t'], as_trans[asn]['g'] ]
        info = "{} [{}](t: {} g: {})".format(
                    as_info[asn]['short_descr'], asn, trans_info[0],
                    trans_info[1])
    else:
        info = asn

    return info

# Load the short names for the ASes
with open('data/as-info.json', 'rb') as as_info_file:
    as_info = json.load(as_info_file)

# Load transit degrees
# with open('as-rank/as-transit-degree.json', 'r') as as_trans_file:
#     as_trans = json.load(as_trans_file)
as_trans = {}
with open('as-rank/20140601.degrees.txt', 'r') as as_trans_file:
    as_trans_data = csv.reader(filter(lambda row: row[0]!='#',as_trans_file), delimiter=" ")
    for asn, transit_deg, global_deg in as_trans_data:
        as_trans[asn] = dict(t=transit_deg, g=global_deg)

 
with open('local-as-rel-info.csv', 'rb') as rel_file:
    rel_info = csv.reader(rel_file, delimiter="|")

    for src,dst,rel in rel_info:
        if rel != '?':
            continue
        print "{0} -> {1}".format(disp_as(src), disp_as(dst))<commit_msg>Local AS relationship file was pointing to its old location<commit_after>#!/usr/bin/env python

import csv
import json

def disp_as(asn):
    if as_info.has_key(asn):
        trans_ref = as_trans.get(asn)
        if trans_ref == None:
            trans_info = [ '-', '-' ]
        else:
            trans_info = [ as_trans[asn]['t'], as_trans[asn]['g'] ]
        info = "{} [{}](t: {} g: {})".format(
                    as_info[asn]['short_descr'], asn, trans_info[0],
                    trans_info[1])
    else:
        info = asn

    return info

# Load the short names for the ASes
with open('data/as-info.json', 'rb') as as_info_file:
    as_info = json.load(as_info_file)

# Load transit degrees
# with open('as-rank/as-transit-degree.json', 'r') as as_trans_file:
#     as_trans = json.load(as_trans_file)
as_trans = {}
with open('as-rank/20140601.degrees.txt', 'r') as as_trans_file:
    as_trans_data = csv.reader(filter(lambda row: row[0]!='#',as_trans_file), delimiter=" ")
    for asn, transit_deg, global_deg in as_trans_data:
        as_trans[asn] = dict(t=transit_deg, g=global_deg)

 
with open('data/local-as-rel-info.csv', 'rb') as rel_file:
    rel_info = csv.reader(rel_file, delimiter="|")

    for src,dst,rel in rel_info:
        if rel != '?':
            continue
        print "{0} -> {1}".format(disp_as(src), disp_as(dst))
{'fraction_non_alphanumeric': 0.159442140972484, 'fraction_numerical': 0.00980022615906521, 'mean_word_length': 2.8519593613933236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5684234', 'n_tokens_mistral': 1002, 'n_tokens_neox': 973, 'n_words': 200}