def main(cc_list, outname, ccfname, bin_size, print_table = False): geo_binsize = bin_size countrydist = builddistdict(cc_list) country_codes = countrydist.keys() cc_to_countries = build_cc_to_country(country_codes) country2cont = readcountrycont(ccfname) cont2country = buildcont2country(cc_to_countries, country2cont) gentable, gensizetable = buildgentable(countrydist, cc_to_countries, country2cont, cont2country, geo_binsize) outf = open(outname, 'w') pickle.dump(gentable, outf) outf.close() if print_table: printtables(countrydist, gentable, gensizetable)
def main(dbname, outname, ccfname, print_table): c = dbOpen(dbname) c.execute('Select final_cc_cname from source') countries = c.fetchall() countrydist = builddistdict(countries) country2cont = readcountrycont(ccfname) cont2country = buildcont2country(country2cont) gentable, gensizetable = buildgentable(countrydist, country2cont, cont2country, geo_binsize) outf = open(outname, 'w') pickle.dump(gentable, outf) outf.close() if print_table: printtables(countrydist, gentable, gensizetable)
def main(dbname, outname, ccfname, print_table=False): c = dbOpen(dbname) c.execute("Select cc_by_ip from source") countrydist = builddistdict(c.fetchall()) country_codes = countrydist.keys() cc_to_countries = build_cc_to_country(country_codes) country2cont = readcountrycont(ccfname) cont2country = buildcont2country(cc_to_countries, country2cont) gentable, gensizetable = buildgentable(countrydist, cc_to_countries, country2cont, cont2country, geo_binsize) outf = open(outname, "w") pickle.dump(gentable, outf) outf.close() if print_table: printtables(countrydist, gentable, gensizetable)