def test_dame_utils_clean_list(self): du = DameUtils() self.assertEqual( du.clean_list([ '', 'H. Peter Anvin', '*****@*****.**', 'Ram Yalamanchili', 'Ferenc Wagner' ]), ['H. Peter Anvin', 'Ram Yalamanchili', 'Ferenc Wagner']) l1 = [ '', '', 'de', '', '', 'ar', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'ca', 'cl', '', '', '' ] self.assertEqual(du.clean_list(l1), ['de', 'ar', 'ca', 'cl'])
def test_dame_utils_clean_list_method_returns_correct_result(self): du = DameUtils() self.assertEqual( du.clean_list([ '', 'H. Peter Anvin', '*****@*****.**', 'Ram Yalamanchili', 'Ferenc Wagner' ]), ['H. Peter Anvin', 'Ram Yalamanchili', 'Ferenc Wagner'])
from app.dame_perceval import DamePerceval from app.dame_utils import DameUtils import sys import argparse parser = argparse.ArgumentParser() parser.add_argument("url", help="Uniform Resource Link") parser.add_argument('--directory') parser.add_argument('--version', action='version', version='0.1') args = parser.parse_args() if (len(sys.argv) > 1): ds = DameSexmachine() du = DameUtils() dp = DamePerceval() l1 = dp.list_committers(args.url, args.directory) l2 = du.delete_duplicated(l1) l3 = du.clean_list(l2) females = 0 males = 0 unknowns = 0 for g in l3: sm = ds.guess(g, binary=True) if (sm == 0): females = females + 1 elif (sm == 1): males = males + 1 else: unknowns = unknowns + 1 print("The number of males sending commits is %s" % males) print("The number of females sending commits is %s" % females)
import argparse parser = argparse.ArgumentParser() parser.add_argument("surname", help="display the gender") #parser.add_argument('--total', required=True, default="ine", choices=['ine', 'es', 'us']) parser.add_argument('--verbose', default=False, action="store_true") args = parser.parse_args() results = [] de = DameEthnicity() du = DameUtils() surname = args.surname.upper() l = de.inesurname2ethnicity(surname, 'all') l = sorted(du.clean_list(l)) if (len(l) > 0): print( "In Spain (Instituto Nacional de Estadística) the surname %s is present with people of another countries:" % surname) else: print( "In Spain (Instituto Nacional de Estadística) the surname %s is not present with people of another countries" % surname) #print(l) # print(de.locale2eng('ci')) # print(de.locale2eng('cu')) # print(de.locale2eng('fr')) # print(de.locale2eng('gt')) # print(de.locale2eng('it'))