def find_in_all(): while True: # for line in open("domains"): # response = line.strip() print "input your query" response = raw_input().strip() if response == "q": break if domain_p.match(response): for db_name in client.database_names(): if len(db_name) < 7: continue for coll_name in coll_name_list[0:4]: ext = client[db_name][coll_name].find_one({"_id": response}) if ext: writer = open("output/" + response, "a") print db_name, coll_name, response writer.write(str(ext) + "\n") writer.write(str(client[db_name][coll_name + "_matrix"].find_one({"_id": response})) + "\n") writer.close() break elif ip_p.match(response): for db_name in client.database_names(): if len(db_name) < 7: continue for coll_name in coll_name_list[4:8]: ext = client[db_name][coll_name].find_one({"_id": response}) if ext: writer = open("output/" + response, "a") print db_name, coll_name, response writer.write(str(ext) + "\n") writer.write(str(client[db_name][coll_name + "_matrix"].find_one({"_id": response})) + "\n") writer.close() break
def handle_exception(db_name): print "\nPausing... (Hit ENTER to conti, type q to exit.)" response = raw_input().strip() while response: if response == "q": break if domain_p.match(response): for i in range(0, 4): ext = client[db_name][coll_name_list[i]].find_one({"_id": response}) if ext: print i + 1 print ext print client[db_name][coll_name_list[i] + "_matrix"].find_one({"_id": response}) break else: print "not found", coll_name_list[i] elif ip_p.match(response): for i in range(4, 8): ext = client[db_name][coll_name_list[i]].find_one({"_id": response}) if ext: print i + 1 print ext print client[db_name][coll_name_list[i] + "_matrix"].find_one({"_id": response}) break else: print "not found", coll_name_list[i] response = raw_input().strip() if response == "q": return False return True
def find_in_all(): while True: #for line in open("domains"): #response = line.strip() print "input your query" response = raw_input().strip() if response == "q": break if domain_p.match(response): for db_name in client.database_names(): if len(db_name) < 7: continue for coll_name in coll_name_list[0:4]: ext = client[db_name][coll_name].find_one( {"_id": response}) if ext: writer = open("output/" + response, "a") print db_name, coll_name, response writer.write(str(ext) + "\n") writer.write( str(client[db_name][coll_name + "_matrix"]. find_one({"_id": response})) + "\n") writer.close() break elif ip_p.match(response): for db_name in client.database_names(): if len(db_name) < 7: continue for coll_name in coll_name_list[4:8]: ext = client[db_name][coll_name].find_one( {"_id": response}) if ext: writer = open("output/" + response, "a") print db_name, coll_name, response writer.write(str(ext) + "\n") writer.write( str(client[db_name][coll_name + "_matrix"]. find_one({"_id": response})) + "\n") writer.close() break
def handle_exception(db_name): print '\nPausing... (Hit ENTER to conti, type q to exit.)' response = raw_input().strip() while response: if response == 'q': break if domain_p.match(response): for i in range(0, 4): ext = client[db_name][coll_name_list[i]].find_one( {"_id": response}) if ext: print i + 1 print ext print client[db_name][coll_name_list[i] + "_matrix"].find_one( {"_id": response}) break else: print "not found", coll_name_list[i] elif ip_p.match(response): for i in range(4, 8): ext = client[db_name][coll_name_list[i]].find_one( {"_id": response}) if ext: print i + 1 print ext print client[db_name][coll_name_list[i] + "_matrix"].find_one( {"_id": response}) break else: print "not found", coll_name_list[i] response = raw_input().strip() if response == 'q': return False return True