当前位置: 首页>>代码示例>>Python>>正文


Python names.get_first_name函数代码示例

本文整理汇总了Python中names.get_first_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_first_name函数的具体用法?Python get_first_name怎么用?Python get_first_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_first_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_personal_shopper_assignment

    def test_personal_shopper_assignment(self):
        #Create some personal shoppers
        personal_shopper1 = PersonalShopper.objects.create(
            first_name=names.get_first_name(gender="female"),
            last_name=names.get_last_name(),
        )
        personal_shopper2 = PersonalShopper.objects.create(
            first_name=names.get_first_name(gender="female"),
            last_name=names.get_last_name(),
        )

        personal_shopper1.save()
        personal_shopper2.save()

        personal_shopper1.regions.add(self.region)
        personal_shopper2.regions.add(self.region)

        #Create some users without recent orders and assign them to personal shopper 1
        for _ in xrange(5):
            member = Member.objects.create(
                first_name=names.get_first_name(gender='male'),
                last_name=names.get_last_name(),
                phone_number=random.randint(1, 9999999999),
                region=random_region(),
                personal_shopper=personal_shopper1,
            )

            member.save()

        #Check if a new member would be assigned to personal shopper 2
        self.assertEqual(assign_personal_shopper(self.region), personal_shopper2)
开发者ID:jghyllebert,项目名称:member-distribution,代码行数:31,代码来源:tests.py

示例2: __init__

    def __init__(self):
        id_length = random.randint(config.min_id_length, config.max_id_length)
        self.id = utils.random_string(id_length)

        sex = random.choice(['male', 'female'])
        if sex == 'male':
            self.sex = 'M'
        else:
            self.sex = 'F'

        self.first_name = names.get_first_name(sex)
        self.last_name = names.get_last_name()
        self.middle_name = ''
        if config.gen_mid_name:
            if random.random() < config.gen_mid_name_chance:
                if random.randint(0, 1):
                    self.middle_name = names.get_first_name(sex)
                else:
                    self.middle_name = names.get_first_name(sex)[0]

        start = datetime.datetime(1900, 1, 1)
        end = datetime.datetime.now()
        self.birth_date = utils.random_date_between(start, end)

        self.aliases = []
        if config.gen_alias:
            for i in xrange(config.gen_alias_max):
                if random.random() < config.gen_alias_chance:
                    self.aliases.append(self.generate_alias())

        self.studies = self.generate_studies(self.birth_date)
开发者ID:IMAGE-ET,项目名称:dcmenvgen,代码行数:31,代码来源:hierarchy.py

示例3: test_random_gender

 def test_random_gender(self):
     counts = defaultdict(int)
     rounds = 5000.0
     with patch_file(test_files):
         for i in range(int(rounds)):
             names.get_first_name()
             counts[names.get_first_name()] += 1
     self.assertAlmostEqual(counts['Male'] / rounds, 0.500, delta=0.05)
     self.assertAlmostEqual(counts['Female'] / rounds, 0.500, delta=0.05)
开发者ID:djibson,项目名称:names,代码行数:9,代码来源:test_names.py

示例4: test_empty_file

 def test_empty_file(self):
     empty_files = {
         'first:male': full_path('test/empty.txt'),
         'first:female': full_path('test/empty.txt'),
         'last': full_path('test/empty.txt'),
     }
     with patch_file(empty_files):
         self.assertEqual(names.get_first_name(gender='male'), "")
         self.assertEqual(names.get_first_name(gender='female'), "")
         self.assertEqual(names.get_last_name(), "")
开发者ID:djibson,项目名称:names,代码行数:10,代码来源:test_names.py

示例5: test_competitor_creation

def test_competitor_creation(sh):

  prefix = Preferences.TestingPrefix

  sh = SetupHelper.SetupHelper()
  sh.setManualDbCursor(DatabaseConnection.DatabaseConnection().getDatabaseCursor())
  if random() < 0.5:
      print sh.createNewCompetitor(names.get_last_name(), names.get_first_name(gender='male'), "U18M", prefix)
  else:
      print sh.createNewCompetitor(names.get_last_name(), names.get_first_name(gender='female'), "U18F", prefix)
开发者ID:balugege,项目名称:PCompetition,代码行数:10,代码来源:SetupHelperTest.py

示例6: test_correct_files

 def test_correct_files(self):
     with patch_file(test_files):
         self.assertEqual(names.get_first_name(gender='male'), "Male")
         self.assertEqual(names.get_first_name(gender='female'), "Female")
         self.assertEqual(names.get_last_name(), "Last")
         # Test with cached responses
         self.assertEqual(names.get_first_name(gender='male',
                                               cached=True), "Male")
         self.assertEqual(names.get_first_name(gender='female',
                                               cached=True), "Female")
         self.assertEqual(names.get_last_name(True), "Last")
开发者ID:juiceinc,项目名称:names,代码行数:11,代码来源:test_names.py

示例7: generate_user

def generate_user(organization, session, **kwargs):
    first_name = names.get_first_name()
    user = create_user(
        organization_id=organization.id,
        first_name=names.get_first_name(),
        last_name=names.get_last_name(),
        email='{}+{}@company.com'.format(first_name, uuid.uuid4()),
        session=session,
        **kwargs
    )
    return user
开发者ID:barakalon,项目名称:marco-polo,代码行数:11,代码来源:models.py

示例8: insert_random_seller

    def insert_random_seller(self, repeat=qsellers):
        ''' Inserir registros com valores randomicos '''

        seller_list = []
        for _ in range(repeat):
            d = gen_timestamp(2014, 2015) + '+00'
            fname = names.get_first_name()
            lname = names.get_last_name()
            email = fname[0].lower() + '.' + lname.lower() + '@example.com'
            birthday = gen_timestamp() + '+00'
            active = rstr.rstr('01', 1)
            internal = rstr.rstr('01', 1)
            commissioned = rstr.rstr('01', 1)
            commission = 0.01
            seller_list.append(
                (gen_cpf(), fname, lname, email, gen_phone(), birthday, active, internal, commissioned, commission, d, d))
        try:
            self.db.cursor.executemany("""
            INSERT INTO vendas_seller (cpf, firstname, lastname, email, phone, birthday, active, internal, commissioned, commission, created, modified)
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
            """, seller_list)
            self.db.commit_db()
            print("Inserindo %s registros na tabela vendas_seller." % repeat)
            print("Registros criados com sucesso.")
        except sqlite3.IntegrityError:
            print("Aviso: O email deve ser único.")
            return False
开发者ID:leandroguedesdasilva,项目名称:vendas,代码行数:27,代码来源:manager_db.py

示例9: inserir_randomico

 def inserir_randomico(self, repeat=10):
     ''' Inserir registros com valores randomicos names '''
     lista = []
     for _ in range(repeat):
         date = datetime.datetime.now().isoformat(" ")
         fname = names.get_first_name()
         lname = names.get_last_name()
         name = fname + ' ' + lname
         email = fname[0].lower() + '.' + lname.lower() + '@email.com'
         c = gen_city()
         city = c[0]
         uf = c[1]
         lista.append((name, gen_age(), gen_cpf(),
                       email, gen_phone(),
                       city, uf, date))
     try:
         self.db.cursor.executemany("""
         INSERT INTO clientes (nome, idade, cpf, email, fone, cidade, uf, criado_em)
         VALUES (?,?,?,?,?,?,?,?)
         """, lista)
         self.db.commit_db()
         print("Inserindo %s registros na tabela..." % repeat)
         print("Registros criados com sucesso.")
     except sqlite3.IntegrityError:
         print("Aviso: O email deve ser único.")
         return False
开发者ID:RaphaDinelli,项目名称:python-sqlite,代码行数:26,代码来源:manager_db_.py

示例10: gen_admin

 def gen_admin(self):
     b, admin = User.create_user(username=self.random_alphanum(5, 20), password="password", usertype=UserType.Administrator, email=self.random_email(),
                      first_name=names.get_first_name(), last_name=names.get_last_name(), print_stdout=False)
     admin = admin.get_typed_user()
     admin.hospital = self.random_hospital().first()
     admin.is_pending = False
     admin.save()
开发者ID:sseveiN,项目名称:HealthNet,代码行数:7,代码来源:generate_random.py

示例11: __init__

    def __init__(self):
        # Gender
        self.gender = self.gender()
        self.genderTitle = self.genderTitle()
        self.genderPronoun = self.genderPronoun()
        self.genderPossessive = self.genderPossessive()

        # Basics
        self.firstName = names.get_first_name(self.gender)
        self.lastName = names.get_last_name()
        self.personality = self.personality(self.gender)

        # Appearance
        self.eyecolor = data.pick('appearance.eyes.color')
        self.skincolor = data.pick('appearance.skin.color')
        self.hairtype = data.pick('appearance.hair.type')
        self.haircolor = data.pick('appearance.hair.color')
        self.hairstyle = data.pick('appearance.hair.style.'+self.gender)
        self.height = data.pick('appearance.height')
        self.build = data.pick('appearance.build.'+self.gender)
        
        # Other
        self.minimumAge = 18
        self.previousService = self.previousService()
        self.birthPlace = data.pick('places.birthplaces')
开发者ID:zleach,项目名称:tradewind,代码行数:25,代码来源:people.py

示例12: populate_candidates

def populate_candidates():
    """
    Sends requests to connect to populate our sandbox Connector with 5 random
    candidates.
    """
    for i in range(5):
        last_name = names.get_last_name()
        candidate = {
            'first_name': names.get_first_name(),
            'last_name': last_name,
            'email': '{}{}@example.com'.format(last_name,
                                               choice(range(100)))
        }
        candidate_data = {
            # A random job_id will be fine as we are in a sandbox environment
            'candidate': candidate, 'applications': [{'job_id': '101'}]
        }

        # We can choose to either include a callback header with our
        # request, or to poll until the application is complete. Here
        # we use the callback functionality.
        headers = {
            'content-type': 'application/rolepoint.v2+json',
            'x-rolepoint-callback-url': url_for(
                'application_processed_callback',
                app_id=len(CREATED_CANDIDATES), _external=True
            )
        }

        requests.post(
            CONNECT_URL + '/v1/{}/candidate'.format(CONFIG['connector_id']),
            json=candidate_data, auth=AUTH, headers=headers
        )
        candidate['status'] = 'In Progress'
        CREATED_CANDIDATES.append(candidate)
开发者ID:rolepoint,项目名称:connect-examples,代码行数:35,代码来源:app.py

示例13: Bfunc

def Bfunc():
    global Bnames
    Bnames = ""
    while Bnames == "":
        name = names.get_first_name()
        if name[0] == "B":
            Bnames = name
开发者ID:ojzcroc,项目名称:ThatOneActor,代码行数:7,代码来源:That+one+actor.py

示例14: Cfunc

def Cfunc():
    global Cnames
    Cnames = ""
    while Cnames == "":
        name = names.get_first_name()
        if name[0] == "C":
            Cnames = name
开发者ID:ojzcroc,项目名称:ThatOneActor,代码行数:7,代码来源:That+one+actor.py

示例15: generate_ledger

def generate_ledger(num_nodes, num_transactions, max_amount, min_amount):
    max_num_transactions = num_nodes * (num_nodes - 1)
    if num_transactions is None:
        num_transactions = 10
    elif num_transactions == "max":
        num_transactions = max_num_transactions
    elif int(num_transactions) > max_num_transactions:
        print("num transactions is larger than max num transactions ({})".format(max_num_transactions))
        exit(1)
    num_transactions = int(num_transactions)
    ledger = {}
    while len(ledger) < num_nodes:
        name = names.get_first_name()
        if name in ledger:
            continue
        ledger[name] = dict()
    keys = list(ledger.keys())
    for i in range(num_transactions):
        name_from = None
        name_to = None
        while name_to == name_from or name_to in ledger[name_from]:
            name_from = random.choice(keys)
            name_to = random.choice(keys)
        amount = random.randint(min_amount * 100, max_amount * 100) / 100
        # mark entry in ledger
        ledger[name_from][name_to] = amount
    return ledger
开发者ID:mvanderh,项目名称:resolve_debts,代码行数:27,代码来源:generate_ledger.py


注:本文中的names.get_first_name函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。