Example #1
0
 def download_company_data(name):
   HubAnalyzer.report_downloading_progress = True
   HubAnalyzer.enforce_download_in_presence_of_data = True
   try:
     HubAnalyzer.getCompanyUsers(name)
   except Exception as e:
     print(str(e))
     return
Example #2
0
 def print_hubs():
   print("companies")
   company_dict = HubAnalyzer.generate_company_dictionary()
   for name, descr in company_dict.items():
     print(name + " <-->  " + descr + "(company)")
   print("hubs")
   hub_dict = HubAnalyzer.generate_hub_dictionary()
   for name, descr in hub_dict.items():
     print(name + " <-->  " + descr)
Example #3
0
 def check_and_download(hubname,company_flag):
   if hubname is None:
     return None
   hubs  = HubAnalyzer.get_hub_names()
   companies = HubAnalyzer.get_company_names()
   if not company_flag:
     if hubname in hubs and hubname in companies:
       print("Name is ambiguous, there is a company and a hub with this name; assuming hub by default.")
       prefix = "hubs/"
     elif hubname in hubs:
       prefix = "hubs/"
     elif hubname in companies:
       prefix = "companies/"
     else:
       print("There is no name record for *" + hubname + "*, assuming it is a hub, not a company.")
   else:
     prefix = "companies/"
   datafile = "data/"+prefix+hubname
   if os.path.isfile(datafile):
     return Reader.read_list_of_users(datafile)
   else:
     print("Data for *" +hubname+ "* is not in the local dataset, downloading it now... ")
     HubAnalyzer.report_downloading_progress = True
     if company_flag:
       HubAnalyzer.getCompanyUsers(hubname)
     else:
       HubAnalyzer.getUsers(hubname)
     return Reader.read_list_of_users(datafile)
Example #4
0
 def updatehub(hubname):
   print("Updating: " + hubname)
   HubAnalyzer.report_downloading_progress = True
   HubAnalyzer.enforce_download_in_presence_of_data = True
   HubAnalyzer.getUsers(hubname)
   HubAnalyzer.enforce_download_in_presence_of_data = False
Example #5
0
                company_flag1 = False
                company_flag2 = False
                company_flag3 = False
                if args['company']:
                    for i in args['company']:
                        if i == 1:
                            company_flag1 = True
                        if i == 2:
                            company_flag2 = True
                        if i == 3:
                            company_flag3 = True
                set1 = Reader.check_and_download(hub1, company_flag1)
                set2 = Reader.check_and_download(hub2, company_flag2)
                set3 = Reader.check_and_download(hub3, company_flag3)
                print_stats(set1, set2, set3,
                            HubAnalyzer.convert_label(hub1, company_flag1),
                            HubAnalyzer.convert_label(hub2, company_flag2),
                            HubAnalyzer.convert_label(hub3, company_flag3))
            except Exception as e:
                print(str(e))
        else:
            print("To get statistics at least two hubs must be specified")

    if args['draw']:
        if len(args['draw']) >= 2:
            hub1 = args['draw'][0].strip()
            hub2 = args['draw'][1].strip()
            if len(args['draw']) > 2:
                hub3 = args['draw'][2]
            else:
                hub3 = None